Comments (8)
Hey @fabiocaccamo !
What else can you tell me about this issue? I'm using Amazon S3 on many projects with django-versatileimagefield
and I haven't been able to reproduce this issue.
Could you fork the repo and provide a test case that is able to reproduce this error?
from django-versatileimagefield.
@respondcreate thanks for your quick reply, I will investigate it.
from django-versatileimagefield.
I have this with VersatileImageField's with height/width/ppoi fields which are uploaded from an InlineAdmin. Same models work fine when edited from a regular form, and this error doesn't happen with local file storage.
I have the AlwaysChangedModelForm
fix from #44 and use django-s3-storage==0.9.8 on Django 1.9.2 and python 3.5
The error happens in the VersatileImageFormField
's to_python() override. If I put a try-except around it I get another error 'ValueError: I/O operation on closed file.'
Looks like something is fishy with the Inline forms.
from django-versatileimagefield.
Hey @Bartvds –
Any chance you could write a test case that fails (i.e. raises ValueError
) so I can start drafting up the fix?
from django-versatileimagefield.
Sure, I'll setup a case mirroring my situation. I'm not very experienced in providing cases but I'll put something together in a branch in my fork.
from django-versatileimagefield.
Hey @Bartvds –
Thanks! To run tests you'll need to create a new virtualenv, activate it and then run these commands to install test dependencies so you can actually run the test suite locally (now that I think about it, I should probably add this info to the docs, too!):
$ pip install -e .
$ pip install -q Django==1.9.5 djangorestframework==3.3.1 coverage
Now that you have a test virtualenv setup you can run the test suite by running this command in the django-versatileimagefield
folder:
$ coverage run --source=versatileimagefield/ run_tests.py
If that passes with no errors then you can start writing your test case! WOOHOO! Here's how to do that:
For your test case just add a method on this class with a name that starts with 'test_', example:
class VersatileImageFieldTestCase(VersatileImageFieldBaseTestCase):
def test_inline_valueerror(self):
"""Ensure VersatileImageField fields in inlines don't raise ValueError."""
# code that raises ValueError here
Your test should fail by raising ValueError
(so I can write the code to fix the error and therefore get the test to pass). Don't hesitate to reach out if you need any help, I'd be happy to answer any questions you have!
from django-versatileimagefield.
Cool, thanks for the info: I was fighting the test_req.txt
but it is for older versions of everything.
I have the existing cases running with your info so next step it to get this reproducible; it'll involve doing a quick bootcamp on testing the django admin so may take a while.
from django-versatileimagefield.
I'm still struggling with making a test case but at least I have the issue reproducable when using a manual ./manage.py runserver
(after makemigrations/migrate/createsuperuser etc).
I tested this with django-s3-storage==0.9.8
on python 3.5.1
If you check the models you'll see one Parent and a Child model, both have a VersatileImageField with width/height/ppoi, and the Child has a ForeignKey to the Parent. In the admin the Parent has an InlineAdmin for the Child models.
Weird thing is how earlier the parent model didn't have an image and then it works fine. Only when both have an image field, and the child is in an inline and it uses remote storage does it break like this.
from django-versatileimagefield.
Related Issues (20)
- Unclear docs on using VersatileImageFieldWarmer with rendition sets HOT 1
- python-magic 0.4.20 incompatible
- Fails to work with django-cacheops HOT 2
- How to store filename returned by storage for sized images? HOT 1
- Test with Python3.9
- Test with Django 3.1 and 3.2
- Add Django 3.2 Compatibility HOT 1
- Test with djangorestframework 3.11 and 3.12
- error to upload images using django-rest and angular HOT 1
- versatileimagefield How to use Django Graphql
- Deleting all created images for the image without extension fails
- VersatileImageFieldWarmer regenerate images for delete rendition key set
- Question: is it possible to use this app with static files?
- AttributeError: module 'magic' has no attribute 'from_buffer' HOT 1
- Django 4 HOT 3
- Question: Crop as circle
- Extra queries when warming with VersatileImageFieldWarmer
- django-versatileimagefield doesn't work on Pillow >= 10.0.0 released 1 July HOT 5
- Created images not deleted when using image_key_post_processor
- Configurable exception handling
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-versatileimagefield.