[open-ils-commits] r8478 -
branches/acq-experiment/Open-ILS/src/python/oils
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Jan 23 09:35:09 EST 2008
Author: erickson
Date: 2008-01-23 09:08:27 -0500 (Wed, 23 Jan 2008)
New Revision: 8478
Modified:
branches/acq-experiment/Open-ILS/src/python/oils/org.py
Log:
verifying existance of local tree before performing some functions
Modified: branches/acq-experiment/Open-ILS/src/python/oils/org.py
===================================================================
--- branches/acq-experiment/Open-ILS/src/python/oils/org.py 2008-01-23 14:07:42 UTC (rev 8477)
+++ branches/acq-experiment/Open-ILS/src/python/oils/org.py 2008-01-23 14:08:27 UTC (rev 8478)
@@ -9,6 +9,11 @@
_flat_org_tree = {}
@staticmethod
+ def _verify_tree():
+ if not OrgUtil._org_tree:
+ OrgUtil.fetch_org_tree()
+
+ @staticmethod
def fetch_org_tree():
''' Returns the whole org_unit tree '''
@@ -35,6 +40,7 @@
@staticmethod
def get_org_unit(org_id):
+ OrgUtil._verify_tree()
return OrgUtil._flat_org_tree[org_id]
@@ -65,7 +71,8 @@
''' Returns a cloned tree of orgs including all ancestors and
descendants of the provided org '''
- org = org_unit = org_unit.shallow_clone()
+ OrgUtil._verify_tree()
+ org = org_unit = OrgUtil.get_org_unit(org_unit.id()).shallow_clone()
while org.parent_ou():
parent = org.parent_ou()
if not isinstance(parent, osrf.net_obj.NetworkObject):
@@ -90,6 +97,7 @@
@staticmethod
def get_related_list(org_unit):
''' Returns a flat list of related org_units '''
+ OrgUtil._verify_tree()
tree = OrgUtil.get_related_tree(org_unit)
orglist = []
def flatten(node):
More information about the open-ils-commits
mailing list