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 @@
#
##############################################################################
from Globals import InitializeClass
from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
......@@ -85,6 +84,9 @@ class Domain(Predicate, MetaNode, MetaResource):
# Declarative interfaces
__implements__ = ( Interface.Predicate, )
# Declarative properties
property_sheets = ( PropertySheet.Domain, )
security.declareProtected( Permissions.AccessContentsInformation, 'getRelativeUrl' )
def getRelativeUrl(self):
"""
......@@ -93,37 +95,25 @@ class Domain(Predicate, MetaNode, MetaResource):
"""
return '/'.join(self.portal_url.getRelativeContentPath(self)[1:])
# Generator API - DRAFT
# 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
# Generator API
# How to define a generated subdomain
security.declareProtected( Permissions.AccessContentsInformation, 'getDomainGeneratorList' )
def getDomainGeneratorList(self, depth=0):
# 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
# to prevent infinite recursion
pass
# # Hand made temp object (rather than ERP5Type generated) because we need
# # it now
# class DomainGenerator(TempDomain):
# """
# This class defines a predicate as well as all necessary
# information to generate subdomains.
# Instances are stored in RAM as temp objects
# Generator API - DRAFT
# """
# # 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)
# to prevent infinite recursion XXX not implemented
from Products.ERP5Type.Document import newTempDomainGenerator
klass = tmp_domain_generator = newTempDomainGenerator(self, 'new_generator')
script = self.getDomainGeneratorMethodId('')
return tmp_domain_generator.getDomainGeneratorList(depth=depth, klass=klass, script=script, parent=self)
security.declareProtected( Permissions.AccessContentsInformation, 'generateTempDomain' )
def generateTempDomain(self, id):
"""
We generate temp domain here because we must set an aquisition wrapper
"""
from Products.ERP5Type.Document import newTempDomain
domain = newTempDomain(self, id)
domain = domain.__of__(self)
return domain
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