Commit 817a204d authored by Alexandre Boeglin's avatar Alexandre Boeglin

Fixed initializePortalTypeDynamicProperties.

When the function was called on a new Portal Type (not present in aq_portal_type)
with recursive = 1, no Accessor was generated, and the Portal Type was added to aq_portal_type,
thus preventing a future call of initializePortalTypeDynamicProperties to generate anything.

I just removed the recursive argument, and ajusted the recursive call to use parent_object instead of self,
which should allow to recursively create Workflows Accessors.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3269 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e4ac7439
...@@ -117,13 +117,13 @@ def getClassPropertyList(klass): ...@@ -117,13 +117,13 @@ def getClassPropertyList(klass):
getClassPropertyList(super_klass))) getClassPropertyList(super_klass)))
return ps_list return ps_list
def initializeClassDynamicProperties(self, klass, recursive=0): def initializeClassDynamicProperties(self, klass):
id = '' id = ''
#LOG('before aq_method_generated %s' % id, 0, str(klass.__name__)) #LOG('before aq_method_generated %s' % id, 0, str(klass.__name__))
if not Base.aq_method_generated.has_key(klass): if not Base.aq_method_generated.has_key(klass):
# Recurse to superclasses # Recurse to superclasses
for super_klass in klass.__bases__: for super_klass in klass.__bases__:
if getattr(super_klass, 'isRADContent', 0): initializeClassDynamicProperties(self, super_klass, recursive=1) if getattr(super_klass, 'isRADContent', 0): initializeClassDynamicProperties(self, super_klass)
# Initialize default properties # Initialize default properties
#LOG('in aq_method_generated %s' % id, 0, str(klass.__name__)) #LOG('in aq_method_generated %s' % id, 0, str(klass.__name__))
from Utils import initializeDefaultProperties from Utils import initializeDefaultProperties
...@@ -132,7 +132,7 @@ def initializeClassDynamicProperties(self, klass, recursive=0): ...@@ -132,7 +132,7 @@ def initializeClassDynamicProperties(self, klass, recursive=0):
# Mark as generated # Mark as generated
Base.aq_method_generated[klass] = 1 Base.aq_method_generated[klass] = 1
def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): def initializePortalTypeDynamicProperties(self, klass, ptype):
id = '' id = ''
#LOG('before aq_portal_type %s' % id, 0, str(ptype)) #LOG('before aq_portal_type %s' % id, 0, str(ptype))
if not Base.aq_portal_type.has_key(ptype): if not Base.aq_portal_type.has_key(ptype):
...@@ -143,9 +143,9 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -143,9 +143,9 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
parent_object = self.aq_parent parent_object = self.aq_parent
parent_klass = parent_object.__class__ parent_klass = parent_object.__class__
parent_type = parent_object.portal_type parent_type = parent_object.portal_type
if getattr(parent_klass, 'isRADContent', 0) and (ptype != parent_type or klass != parent_klass): if getattr(parent_klass, 'isRADContent', 0) and (ptype != parent_type or klass != parent_klass) \
initializePortalTypeDynamicProperties(self, parent_klass, parent_type, recursive=1) and not Base.aq_portal_type.has_key(parent_type):
if not recursive: initializePortalTypeDynamicProperties(parent_object, parent_klass, parent_type)
# Initiatise portal_type properties (XXX) # Initiatise portal_type properties (XXX)
ptype_object = getattr(aq_base(self.portal_types), ptype, None) ptype_object = getattr(aq_base(self.portal_types), ptype, None)
cat_list = [] cat_list = []
......
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