Commit 2d24ecb7 authored by Aurel's avatar Aurel

add method getChildDomainValueList and getDomainByPath which generated

domains dynamically based on the script defined on the base domain


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5797 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 24686d50
...@@ -223,4 +223,30 @@ class DomainTool(BaseTool): ...@@ -223,4 +223,30 @@ class DomainTool(BaseTool):
mapped_value = mapped_value.asContext(**mapped_value_property_dict) mapped_value = mapped_value.asContext(**mapped_value_property_dict)
return mapped_value return mapped_value
def getChildDomainValueList(self, parent,**kw):
"""
Return child domain objects already present adn thois generetaded dynamically
"""
# get static domain
object_list = list(parent.objectValues())
# get dynamic object genretade from script
object_list.extend(parent.getDomainGeneratorList())
return object_list
def getDomainByPath(self, path):
"""
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:
if d.getId() == subdomain:
domain = d
return domain
InitializeClass(DomainTool) InitializeClass(DomainTool)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment