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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 23 09:25:16 EST 2008


Author: erickson
Date: 2008-01-23 08:58:35 -0500 (Wed, 23 Jan 2008)
New Revision: 8476

Modified:
   branches/acq-experiment/Open-ILS/src/python/oils/org.py
Log:
added method to return flat list of related orgs

Modified: branches/acq-experiment/Open-ILS/src/python/oils/org.py
===================================================================
--- branches/acq-experiment/Open-ILS/src/python/oils/org.py	2008-01-23 13:57:00 UTC (rev 8475)
+++ branches/acq-experiment/Open-ILS/src/python/oils/org.py	2008-01-23 13:58:35 UTC (rev 8476)
@@ -88,6 +88,18 @@
         return root
 
     @staticmethod
+    def get_related_list(org_unit):
+        ''' Returns a flat list of related org_units '''
+        tree = OrgUtil.get_related_tree(org_unit)
+        orglist = []
+        def flatten(node):
+            orglist.append(node)
+            for child in node.children():
+                flatten(child)
+        flatten(tree)
+        return orglist
+
+    @staticmethod
     def debug_org(org_unit, indent=0):
         ''' Simple function to print the tree of orgs provided '''
         import sys



More information about the open-ils-commits mailing list