Skip to content

Commit

Permalink
Do eval to store "normalized" dict
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeulette committed Nov 13, 2015
1 parent b0c7094 commit 61473c3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/dexterity/localroles/browser/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def convert_to_dict(value):
value_dict = {}
for row in value:
state, roles, principal = row['state'], row['roles'], row['value']
related = row['related'] is not None and row['related'].strip() or ''
related = row['related'] is not None and row['related'].strip() and str(eval(row['related'])) or ''
if state not in value_dict:
value_dict[state] = {}
value_dict[state][principal] = {'roles': roles, 'rel': related}
Expand Down
2 changes: 1 addition & 1 deletion src/dexterity/localroles/browser/tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ def __init__(self, fti):
dict_values = {'private': {'raptor': {'roles': ('Reader', 'Contributor'), 'rel': ''},
'caveman': {'roles': ('Reader', ), 'rel': ''}},
'pending': {'caveman': {'roles': ('Contributor', ), 'rel': ''}}}
self.assertEqual(dict_values, cls.convert_to_dict(values))
self.assertDictEqual(dict_values, cls.convert_to_dict(values))
self.assertItemsEqual(values, cls.convert_to_list(dict_values))

0 comments on commit 61473c3

Please sign in to comment.