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

Cannot specify no mimetypes #22

Open
btbonval opened this issue Jan 31, 2014 · 1 comment
Open

Cannot specify no mimetypes #22

btbonval opened this issue Jan 31, 2014 · 1 comment

Comments

@btbonval
Copy link
Contributor

I'm working with a codebase which specifies data-fp-extensions.

FilepickerException: Error: Cannot pass in both mimetype and extension parameters to the pick function

I have specified FPFileField.mimetypes to be nothing, None, '', (,), and always it comes back */*. So then I read the code and figured out why:
https://github.com/Ink/django-filepicker/blob/0671c4315b61f897358367a757b6ef8444aa183b/django_filepicker/forms.py#L33

Please specify at least one condition in which mimetypes may be left blank.

On the one hand, you could explicitly check to see if 'data-fp-extensions' in additional_params, in which case mimetypes should not be included.

On the other hand, there might be other instances where mimetypes cause a problem. It might be hard to find all those edge cases. Perhaps add a constant NoMimetypes = object() singleton into forms.py, and do not include mimetypes if mimetypes == NoMimetypes.

@btbonval
Copy link
Contributor Author

My workaround is to drop this into the code prior to calling FPFileField:

django_filepicker.forms.FPFieldMixin.default_mimetypes = ''

Since I don't know what of the possible solutions would be preferred by devs, I'm not going to submit a pull request on this. The workaround is here in case anyone else has the problem.

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

No branches or pull requests

1 participant