Commit e002a807 authored by Jérome Perrin's avatar Jérome Perrin

don't fail if Preference portal type is not installed.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13016 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 82b837de
......@@ -42,8 +42,6 @@ from Products.ERP5Form import _dtmldir
from Products.ERP5Form.Document.Preference import Priority
class func_code: pass
def updatePreferenceClassPropertySheetList():
# The Preference class should be imported from the common location
# in ERP5Type since it could be overloaded in another product
......@@ -60,6 +58,7 @@ def updatePreferenceClassPropertySheetList():
class_property_sheet_list = tuple(property_sheets)
Preference.property_sheets = class_property_sheet_list
def createPreferenceToolAccessorList(portal) :
"""
Initialize all Preference methods on the preference tool.
......@@ -73,8 +72,9 @@ def createPreferenceToolAccessorList(portal) :
typestool = getToolByName(portal, 'portal_types')
pref_portal_type = typestool.getTypeInfo('Preference')
if pref_portal_type is None:
LOG('createPreferenceToolAccessor', PROBLEM,
LOG('ERP5Form.PreferenceTool', PROBLEM,
'Preference type information is not installed.')
else:
# 'Dynamic' property sheets added through ZMI
zmi_property_sheet_list = []
for property_sheet in pref_portal_type.property_sheet_list :
......@@ -82,7 +82,7 @@ def createPreferenceToolAccessorList(portal) :
zmi_property_sheet_list.append(
getattr(__import__(property_sheet), property_sheet))
except ImportError, e :
LOG('createPreferenceToolAccessor', PROBLEM,
LOG('ERP5Form.PreferenceTool', PROBLEM,
'unable to import Property Sheet %s' % property_sheet, e)
# 'Static' property sheets defined on the class
# The Preference class should be imported from the common location
......@@ -105,6 +105,9 @@ def createPreferenceToolAccessorList(portal) :
method = PreferenceMethod(attribute_name)
setattr(PreferenceTool, attribute_name, method)
class func_code: pass
class PreferenceMethod(Method) :
""" A method object that lookup the attribute on preferences. """
# This is required to call the method form the Web
......
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