[Erp5-report] r8499 - in /erp5/trunk/products/ERP5: Document/Domain.py Tool/DomainTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Jul 18 16:59:43 CEST 2006
Author: yo
Date: Tue Jul 18 16:59:42 2006
New Revision: 8499
URL: http://svn.erp5.org?rev=8499&view=rev
Log:
Rewrite buggy getDomainByPath.
Modified:
erp5/trunk/products/ERP5/Document/Domain.py
erp5/trunk/products/ERP5/Tool/DomainTool.py
Modified: erp5/trunk/products/ERP5/Document/Domain.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/Domain.py?rev=8499&r1=8498&r2=8499&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/Domain.py (original)
+++ erp5/trunk/products/ERP5/Document/Domain.py Tue Jul 18 16:59:42 2006
@@ -118,9 +118,11 @@
domain = domain.__of__(self)
return domain
- def getChildDomainValueList(self, *args, **kw):
+ def getChildDomainValueList(self, parent = None, **kw):
"""
Return child domain objects already present or me may generate
dynamically childs.
"""
- return self.portal_domains.getChildDomainValueList(self, *args, **kw)
+ if parent is None:
+ parent = self
+ return self.portal_domains.getChildDomainValueList(parent, **kw)
Modified: erp5/trunk/products/ERP5/Tool/DomainTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/DomainTool.py?rev=8499&r1=8498&r2=8499&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/DomainTool.py (original)
+++ erp5/trunk/products/ERP5/Tool/DomainTool.py Tue Jul 18 16:59:42 2006
@@ -225,7 +225,7 @@
- def getChildDomainValueList(self, parent,**kw):
+ def getChildDomainValueList(self, parent, **kw):
"""
Return child domain objects already present adn thois generetaded dynamically
"""
@@ -239,14 +239,17 @@
"""
Return the domain object for a given path
"""
- domain = None
- for subdomain in path.split('/'):
- if domain is None:
- domain = self[subdomain]
- domains = self.getChildDomainValueList(domain)
- for d in domains:
+ path = path.split('/')
+ base_domain_id = path[0]
+ domain = self[base_domain_id]
+ for depth, subdomain in enumerate(path[1:]):
+ domain_list = self.getChildDomainValueList(domain, depth=depth)
+ for d in domain_list:
if d.getId() == subdomain:
domain = d
+ break
+ else:
+ raise KeyError, subdomain
return domain
InitializeClass(DomainTool)
More information about the Erp5-report
mailing list