Skip to content

Commit

Permalink
[#621] Fix crash on duplicate extras key error
Browse files Browse the repository at this point in the history
Fix a crash when generating a 'duplicate extras key' error. To trigger
the crash, post a dataset dict to package_create() containing two extras
dicts with the same key. There is no test for this yet.
  • Loading branch information
Sean Hammond committed Apr 10, 2013
1 parent c76c351 commit 938a346
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ckan/logic/validators.py
Expand Up @@ -313,7 +313,9 @@ def duplicate_extras_key(key, data, errors, context):
for extra_key in set(extras_keys):
extras_keys.remove(extra_key)
if extras_keys:
errors['extras_validation'].append(_('Duplicate key "%s"') % extras_keys[0])
key_ = ('extras_validation',)
assert key_ not in errors
errors[key_] = _('Duplicate key "%s"') % extras_keys[0]

def group_name_validator(key, data, errors, context):
model = context['model']
Expand Down

0 comments on commit 938a346

Please sign in to comment.