1- # $Id: client.py,v 1.92 2003-02-18 03:58:18 richard Exp $
1+ # $Id: client.py,v 1.93 2003-02-18 04:56:29 richard Exp $
22
33__doc__ = """
44WWW request handler (also used in the stand-alone server).
@@ -821,14 +821,26 @@ def _editnodes(self, all_props, all_links, newids=None):
821821 ''' Use the props in all_props to perform edit and creation, then
822822 use the link specs in all_links to do linking.
823823 '''
824+ # print '='*75
825+ # print 'ALL_PROPS', all_props
824826 # figure dependencies and re-work links
825827 deps = {}
826828 links = {}
827829 for cn , nodeid , propname , vlist in all_links :
830+ if not all_props .has_key ((cn , nodeid )):
831+ # link item to link to doesn't (and won't) exist
832+ continue
828833 for value in vlist :
834+ if not all_props .has_key (value ):
835+ # link item to link to doesn't (and won't) exist
836+ continue
829837 deps .setdefault ((cn , nodeid ), []).append (value )
830838 links .setdefault (value , []).append ((cn , nodeid , propname ))
831839
840+ # print '*'*75
841+ # print 'LINKS', links
842+ # print 'DEPS', deps
843+
832844 # figure chained dependencies ordering
833845 order = []
834846 done = {}
@@ -839,10 +851,12 @@ def _editnodes(self, all_props, all_links, newids=None):
839851 if done .has_key (needed ):
840852 continue
841853 tlist = deps .get (needed , [])
854+ # print 'SOLVING', needed, tlist
842855 for target in tlist :
843856 if not done .has_key (target ):
844857 break
845858 else :
859+ # print 'DONE', needed
846860 done [needed ] = 1
847861 order .append (needed )
848862 change = 1
@@ -1558,22 +1572,7 @@ class <designator> (where <designator> must be
15581572 if not props .get ('content' , '' ):
15591573 del all_props [(cn , id )]
15601574
1561- # clean up the links, removing ones that aren't possible
1562- l = []
1563- for entry in all_links :
1564- (cn , nodeid , propname , destlist ) = entry
1565- source = (cn , nodeid )
1566- if not all_props .has_key (source ) or not all_props [source ]:
1567- # nothing to create - don't try to link
1568- continue
1569- # nothing to create - don't try to link
1570- continue
1571- for dest in destlist [:]:
1572- if not all_props .has_key (dest ) or not all_props [dest ]:
1573- destlist .remove (dest )
1574- l .append (entry )
1575-
1576- return all_props , l
1575+ return all_props , all_links
15771576
15781577def fixNewlines (text ):
15791578 ''' Homogenise line endings.
0 commit comments