Commit e982c17d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

try to get base categories from a temporary object if possible.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29962 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 019037fe
...@@ -424,6 +424,15 @@ class ERP5TypeInformation(XMLObject, ...@@ -424,6 +424,15 @@ class ERP5TypeInformation(XMLObject,
'getInstanceBaseCategoryList') 'getInstanceBaseCategoryList')
def getInstanceBaseCategoryList(self): def getInstanceBaseCategoryList(self):
""" Return all base categories of the portal type """ """ Return all base categories of the portal type """
# try to get categories from a temporary object if possible
module = self.getPortalObject().getDefaultModule(self.getId())
if module is not None:
return module.newContent(portal_type=self.getId(), temp_object=1).getBaseCategoryList()
# XXX The following does not return the list of all categories currently
# (as implementation does not follow exactly the accessor generation,
# like for Expression evaluation). Should be probably better to get
# the list from property holder and not from property sheet
# get categories from portal type # get categories from portal type
base_category_set = set(self.getTypeBaseCategoryList()) base_category_set = set(self.getTypeBaseCategoryList())
...@@ -447,15 +456,7 @@ class ERP5TypeInformation(XMLObject, ...@@ -447,15 +456,7 @@ class ERP5TypeInformation(XMLObject,
'getInstancePropertyAndBaseCategoryList') 'getInstancePropertyAndBaseCategoryList')
def getInstancePropertyAndBaseCategoryList(self): def getInstancePropertyAndBaseCategoryList(self):
"""Return all the properties and base categories of the portal type. """ """Return all the properties and base categories of the portal type. """
# XXX Does not return the list of all properties and categories currently
# (as implementation does not follow exactly the accessor generation,
# like for Expression evaluation). Should be probably better to get
# the list from property holder and not from property sheet
# get categories from portal type
return_set = set() return_set = set()
for category in self.getTypeBaseCategoryList():
return_set.add(category)
return_set.add(category + '_free_text')
# get the property sheet list for the portal type # get the property sheet list for the portal type
ps_list = [getattr(PropertySheet, p, None) ps_list = [getattr(PropertySheet, p, None)
...@@ -476,11 +477,10 @@ class ERP5TypeInformation(XMLObject, ...@@ -476,11 +477,10 @@ class ERP5TypeInformation(XMLObject,
return_set.add(property['id'] + '_' + suffix) return_set.add(property['id'] + '_' + suffix)
else: else:
return_set.add(property['id']) return_set.add(property['id'])
category_list = getattr(base, '_categories', None) # get base categories
if category_list: for category in self.getInstanceBaseCategoryList():
for category in category_list: return_set.add(category)
return_set.add(category) return_set.add(category + '_free_text')
return_set.add(category + '_free_text')
# XXX Can't return set to restricted code in Zope 2.8. # XXX Can't return set to restricted code in Zope 2.8.
return list(return_set) return list(return_set)
......
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