Commit 87de9a5d authored by Gabriel Monnerat's avatar Gabriel Monnerat

refactor code to get a property from system preference activated when some...

refactor code to get a property from system preference activated when some property is not passed in configuration

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45106 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 539a0eb4
......@@ -96,7 +96,9 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def build(self, business_configuration):
portal = self.getPortalObject()
preference = portal.portal_preferences._getOb(self.object_id, None)
portal_preferences = portal.portal_preferences
preference = portal_preferences._getOb(self.object_id, None)
activated_preference = portal_preferences.getActiveSystemPreference()
if preference is None:
preference = portal.portal_preferences.newContent(
portal_type = 'System Preference',
......@@ -108,11 +110,11 @@ class SystemPreferenceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
# XXX this have to be translated in user language.
preference_dict = {}
marker = []
for preference_name in self._getPreferenceNameList():
preference_value = getattr(self, preference_name,
preference.getProperty(preference_name, marker))
if preference_value is not marker:
preference.getProperty(preference_name))
if preference_value is None and activated_preference is not None:
preference_value = activated_preference.getProperty(preference_name)
preference_dict[preference_name] = preference_value
preference.edit(**preference_dict)
......
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