[open-ils-commits] r8593 - branches/acq-experiment/Open-ILS/src/python/oils

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Feb 4 11:07:12 EST 2008


Author: erickson
Date: 2008-02-04 10:39:01 -0500 (Mon, 04 Feb 2008)
New Revision: 8593

Modified:
   branches/acq-experiment/Open-ILS/src/python/oils/org.py
Log:
repaired logic error in union-tree builder

Modified: branches/acq-experiment/Open-ILS/src/python/oils/org.py
===================================================================
--- branches/acq-experiment/Open-ILS/src/python/oils/org.py	2008-02-04 15:36:28 UTC (rev 8592)
+++ branches/acq-experiment/Open-ILS/src/python/oils/org.py	2008-02-04 15:39:01 UTC (rev 8593)
@@ -105,11 +105,14 @@
             main_node = main_tree
 
             while node.id() == main_node.id():
-                node = node.children()[0]
-                main_node = main_node.children()[0]
+                child = node.children()[0]
+                main_child_node = main_node.children()[0]
+                child.parent_ou(node)
+                main_child_node.parent_ou(main_node)
+                node = child
+                main_node = main_child_node
 
-            print main_node.id()
-            OrgUtil.get_org_unit(main_node.parent_ou()).children().append(node)
+            main_node.parent_ou().children().append(node)
 
         return main_tree
 
@@ -127,14 +130,14 @@
         return orglist
 
     @staticmethod
-    def debug_org(org_unit, indent=0):
+    def debug_tree(org_unit, indent=0):
         ''' Simple function to print the tree of orgs provided '''
         import sys
         for i in range(indent):
-            sys.stdout.write('-')
-        print org_unit.shortname()
+            sys.stdout.write('_')
+        print '%s id=%s depth=%s' % (org_unit.shortname(), str(org_unit.id()), str(OrgUtil.get_org_type(org_unit).depth()))
         indent += 1
         for child in org_unit.children():
-            OrgUtil.debug_org(child, indent)
+            OrgUtil.debug_tree(child, indent)
         
 



More information about the open-ils-commits mailing list