Git Product home page Git Product logo

Comments (8)

respondcreate avatar respondcreate commented on July 17, 2024

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.

fabiocaccamo avatar fabiocaccamo commented on July 17, 2024

@respondcreate thanks for your quick reply, I will investigate it.

from django-versatileimagefield.

Bartvds avatar Bartvds commented on July 17, 2024

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.

respondcreate avatar respondcreate commented on July 17, 2024

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.

Bartvds avatar Bartvds commented on July 17, 2024

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.

respondcreate avatar respondcreate commented on July 17, 2024

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.

Bartvds avatar Bartvds commented on July 17, 2024

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.

Bartvds avatar Bartvds commented on July 17, 2024

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.

https://github.com/Bartvds/django-versatileimagefield/tree/830bd3fa6223cf2fc1ce510ff5d144d20ada3176/tests

from django-versatileimagefield.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.