Commit 40f56e2a authored by Jérome Perrin's avatar Jérome Perrin

lookup "preference" attributes on all property sheets.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4774 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 57ca88b7
...@@ -36,6 +36,7 @@ from Products.ERP5Type import Permissions ...@@ -36,6 +36,7 @@ from Products.ERP5Type import Permissions
from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Accessor.TypeDefinition import list_types from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5Form.Document.Preference import Preference
from Products.ERP5Form import _dtmldir from Products.ERP5Form import _dtmldir
class PreferenceTool(BaseTool): class PreferenceTool(BaseTool):
...@@ -123,11 +124,19 @@ class PreferenceTool(BaseTool): ...@@ -123,11 +124,19 @@ class PreferenceTool(BaseTool):
# When creating an ERP5 Site, this method is called, but the # When creating an ERP5 Site, this method is called, but the
# type is not installed yet # type is not installed yet
return [] return []
for property_sheet in pref_portal_type.property_sheet_list : # 'Dynamic' property sheets added through ZMI
# import the property sheet zmi_property_sheet_list = tuple(map(lambda property_sheet:
property_sheet = getattr(__import__(property_sheet), property_sheet) getattr(__import__(property_sheet), property_sheet),
pref_portal_type.property_sheet_list))
# 'Static' property sheets defined on the class
class_property_sheet_list = Preference.property_sheets
for property_sheet in ( zmi_property_sheet_list +
class_property_sheet_list ) :
# then generate common method names # then generate common method names
for prop in property_sheet._properties : for prop in property_sheet._properties :
if not prop.get('preference', 0) :
# only properties marked as preference are used
continue
attribute = prop['id'] attribute = prop['id']
attr_list += [ attribute, attr_list += [ attribute,
'get%s' % convertToUpperCase(attribute), 'get%s' % convertToUpperCase(attribute),
......
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