Commit 6f66bae9 authored by Romain Courteaud's avatar Romain Courteaud

PreferenceTool: do not return the default _marker

parent db834045
...@@ -130,6 +130,8 @@ class PreferenceTool(BaseTool): ...@@ -130,6 +130,8 @@ class PreferenceTool(BaseTool):
method = getattr(self, 'get%s' % convertToUpperCase(pref_name), None) method = getattr(self, 'get%s' % convertToUpperCase(pref_name), None)
if method is not None: if method is not None:
return method(default) return method(default)
if default is _marker:
return None
return default return default
security.declareProtected(Permissions.ModifyPortalContent, "setPreference") security.declareProtected(Permissions.ModifyPortalContent, "setPreference")
......
...@@ -225,6 +225,7 @@ class TestPreferences(PropertySheetTestCase): ...@@ -225,6 +225,7 @@ class TestPreferences(PropertySheetTestCase):
'preferred_accounting_transaction_simulation_state_list')), 'preferred_accounting_transaction_simulation_state_list')),
list(group.getPreferredAccountingTransactionSimulationStateList())) list(group.getPreferredAccountingTransactionSimulationStateList()))
self.assertEqual(None, pref_tool.getPreference('this_does_not_exists'))
self.assertEqual('default', pref_tool.getPreference( self.assertEqual('default', pref_tool.getPreference(
'this_does_not_exists', 'default')) 'this_does_not_exists', 'default'))
......
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