Ticket #1339 (closed enhancement: fixed)
Issues / question re navl and data conversion
Reported by: | rgrp | Owned by: | kindly |
---|---|---|---|
Priority: | awaiting triage | Milestone: | ckan-backlog |
Component: | ckan | Keywords: | |
Cc: | rgrp | Repository: | ckan |
Theme: | none |
Description (last modified by rgrp) (diff)
I ran into a bug with the size field on resources.
- It would not accept an empty value from form (IMO this clearly equates to null/None)
- This could be fixed via using ignore_empty instead of ignore_missing
- However using this means there was no way to empty the field (e.g. i may just want to set the size field back to null not just change to another value)
- similar issues could arise around other fields (such as last_modified ...)
- cf cset:645031d07b60
To solve this (cset:58acdcfe6d4e) i created an int_converter temporarily in logic/schema.py (this is almost certainly the wrong place). But I think it raises a bigger issue about the conversion layer and how it works.
Change History
comment:2 Changed 3 years ago by kindly
- Cc rgrp added
I have fixed the isodata and made a slightly modified int_converter for this case. In the correct place and raises invalids on not being an int. cset:a4af115116bb
The thinking was that the input of these fields would be through the api so the empty string case did not arise. These should clearly be converted to None (Null).
What issues in general? Having done this lots of times before you always end up needing to write your own little validators as the standard ones never do what you want. Thats the point of them. Look in ckan/lib/validators if you need examples.
So what you did was correct...