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] Do 'extras_validation' before other validation #685
Conversation
@kindly I think you might want to review this. @wardi reported an issue (#621) that if you're using This validator tries to unflatten the dict, and it's I find the validation code extremely difficult to follow, but I think the problem may have something to do with attempting to unflatten a dict that has already been partially unflattened (or had unflattened lists added to it) by I'm not sure if the solution in this pr is the best one, wardi has an alternative solution in #621. Maybe a better solution than either is possible:
I don't really understand what the flattening is for anyway. When a fix for this gets accepted we should add a test before merging it. |
Does this also fix this other seemingly related issue #621 (comment) |
@wardi Yes, I've tested Fabian's plugin (well, I copied his custom fields into ckanext/example_idatasetform, since we've completely changed IDatasetForm since he wrote that example) it still crashes on master with the same traceback as your case gets, and on this branch it succeeds. |
I've put this into 2.0, if we can get it in in time that would be great since we know at least two users who are stuck with this issue |
@seanh Great, then it's already better than my fix. |
@kindly I can fix this issue using
On testing manually this gets rid of the bug (which does not have an automatic test), and all the core and example_idatasetform tests still pass too. But as you said it would (and despite the tests passing) this breaks some error messages, because
The ones that look like they might matter are
and the
In both cases I guess I could make it look for the My solution of adding an |
I think special casing an __extras_validation is worse then us special casing what message we show. There is a better solution. Put extras_validation in __before, but when inserting the error into the error dict just use extras_validation key as before. So: On this line
This means that you will not have to change any of the summary code at all. I think this is ok as this validator is hardly going to be reusable anyway except for this case. |
Resubmitted as #722 |
Fixes #621.