-
Notifications
You must be signed in to change notification settings - Fork 33
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
Fix Upload Field Condition #96
base: master
Are you sure you want to change the base?
Conversation
- Added condition to check for `file` attribute from FieldStorage object for `ckanapi` support.
We've seen situations before where the FileStorage object exists but is blank, and it's necessary to further check that it has a truthy |
@ThrawnCA reckon I should add the |
Offhand I'm not sure whether testing |
- Added condition to check for `filename` attribute from FieldStorage object for `ckanapi` support.
@ThrawnCA good enough for me! haha, I have added the |
@@ -226,7 +226,8 @@ def before_update(self, context, current_resource, updated_resource): | |||
if (( | |||
# New file uploaded | |||
(updated_resource.get(u'upload') or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be an and
. We want to check that the object exists and contains a non-blank file
fix(dev): FieldStorage support;
file
attribute from FieldStorage object forckanapi
support.CKANAPI uses cgi.FieldStorage (https://github.com/ckan/ckanapi/blob/master/ckanapi/localckan.py#L67) as to not require a lot of dependencies. Related issue on cgi.FieldStorage: https://bugs.python.org/issue19097
To support all py versions and cgi dependency versions, just checking for the
file
attribute might be good enough?