diff --git a/product/ERP5/Document/Domain.py b/product/ERP5/Document/Domain.py index 535acaf05dda9c041e57946cecc073b8afbf7e57..d2c3219f8732c97a8948530d38d40ae3317da11a 100644 --- a/product/ERP5/Document/Domain.py +++ b/product/ERP5/Document/Domain.py @@ -118,9 +118,11 @@ class Domain(Predicate, MetaNode, MetaResource): 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) diff --git a/product/ERP5/Tool/DomainTool.py b/product/ERP5/Tool/DomainTool.py index 66df9e8650ec96ed7dbc784a109e8d1dda5694df..97e8f545ecd381ad0aa6e4f7f9bb823de33370ba 100644 --- a/product/ERP5/Tool/DomainTool.py +++ b/product/ERP5/Tool/DomainTool.py @@ -225,7 +225,7 @@ class DomainTool(BaseTool): - def getChildDomainValueList(self, parent,**kw): + def getChildDomainValueList(self, parent, **kw): """ Return child domain objects already present adn thois generetaded dynamically """ @@ -239,14 +239,17 @@ class DomainTool(BaseTool): """ 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)