Commit 3371d75e authored by Aurel's avatar Aurel

implement method to call the domain generator and to create temporary domains


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5792 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c01bf28e
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# #
############################################################################## ##############################################################################
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
...@@ -85,6 +84,9 @@ class Domain(Predicate, MetaNode, MetaResource): ...@@ -85,6 +84,9 @@ class Domain(Predicate, MetaNode, MetaResource):
# Declarative interfaces # Declarative interfaces
__implements__ = ( Interface.Predicate, ) __implements__ = ( Interface.Predicate, )
# Declarative properties
property_sheets = ( PropertySheet.Domain, )
security.declareProtected( Permissions.AccessContentsInformation, 'getRelativeUrl' ) security.declareProtected( Permissions.AccessContentsInformation, 'getRelativeUrl' )
def getRelativeUrl(self): def getRelativeUrl(self):
""" """
...@@ -93,37 +95,25 @@ class Domain(Predicate, MetaNode, MetaResource): ...@@ -93,37 +95,25 @@ class Domain(Predicate, MetaNode, MetaResource):
""" """
return '/'.join(self.portal_url.getRelativeContentPath(self)[1:]) return '/'.join(self.portal_url.getRelativeContentPath(self)[1:])
# Generator API - DRAFT # Generator API
# We must overload objectValues and friends
def DRAFT_objectValues(self):
# We must return objects which are inside the domain
# + objects which are generated by the domain generator
return super.objectValues() + self.getDomainGeneratorList()
pass
# How to define a generated subdomain # How to define a generated subdomain
security.declareProtected( Permissions.AccessContentsInformation, 'getDomainGeneratorList' )
def getDomainGeneratorList(self, depth=0): def getDomainGeneratorList(self, depth=0):
# We call a script which builds for us a list DomainGenerator instances # We call a script which builds for us a list DomainGenerator instances
# We need a way to know how deep we are in the domain generation # We need a way to know how deep we are in the domain generation
# to prevent infinite recursion # to prevent infinite recursion XXX not implemented
pass from Products.ERP5Type.Document import newTempDomainGenerator
klass = tmp_domain_generator = newTempDomainGenerator(self, 'new_generator')
# # Hand made temp object (rather than ERP5Type generated) because we need script = self.getDomainGeneratorMethodId('')
# # it now return tmp_domain_generator.getDomainGeneratorList(depth=depth, klass=klass, script=script, parent=self)
# class DomainGenerator(TempDomain):
# """ security.declareProtected( Permissions.AccessContentsInformation, 'generateTempDomain' )
# This class defines a predicate as well as all necessary def generateTempDomain(self, id):
# information to generate subdomains. """
We generate temp domain here because we must set an aquisition wrapper
# Instances are stored in RAM as temp objects """
from Products.ERP5Type.Document import newTempDomain
# Generator API - DRAFT domain = newTempDomain(self, id)
# """ domain = domain.__of__(self)
return domain
# # We must overload objectValues and friends
# def objectValues(self):
# # We must return objects which are generated by the domain generator
# return self.getDomainGeneratorList(depth = self.depth + 1)
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