Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#621] Move extras_validation into __before #722

Merged
merged 5 commits into from
Apr 16, 2013

Conversation

seanh
Copy link
Contributor

@seanh seanh commented Apr 1, 2013

@kindly this is a resubmit of #685 as requested

This fixes an issue where creating a new resource would crash in
validation if there was a custom field (using convert_to/from_extras)
with a name that sorted after extras validation alphabetically. Fixes #621.
Sean Hammond added 3 commits April 10, 2013 16:12
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.
This code path was not covered by the tests.
@seanh
Copy link
Contributor Author

seanh commented Apr 10, 2013

@kindly I see what went wrong. The code path that generates the duplicate extras key error was not covered by the core tests, not the example idatasetform plugin. I've fixed it now and added tests so if the tests pass on travis you can review again

errors[key].append(_('Duplicate key "%s"') % extras_keys[0])
key_ = ('extras_validation',)
assert key_ not in errors
errors[key_] = _('Duplicate key "%s"') % extras_keys[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The errors normally come back as a list I thought. so [_('Duplicate key "%s"') % extras_keys[0]]

This makes it consistent with other errors that CKAN returns.
@ghost ghost assigned kindly Apr 10, 2013
@seanh
Copy link
Contributor Author

seanh commented Apr 10, 2013

Done

@kindly kindly merged commit bcff15a into master Apr 16, 2013
@smotornyuk smotornyuk deleted the 621-bug-move-extras_validation_into___before branch December 19, 2018 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants