#25862: AttributeError: 'FileSystemStorage' object has no attribute 'location'
------------------------------+--------------------------------------
     Reporter:  codingjoe     |                    Owner:  nobody
         Type:  Bug           |                   Status:  closed
    Component:  Core (Other)  |                  Version:  master
     Severity:  Normal        |               Resolution:  fixed
     Keywords:                |             Triage Stage:  Unreviewed
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+--------------------------------------
Changes (by codingjoe):

 * resolution:  worksforme => fixed


Comment:

 I found the bug. It's the lazy object implementation of the default
 storage. It doesn't work in python 2 using multiprocessing.

 This little snippet allows to produce the error.
 {{{
 def has_location(storage):
         return hasattr(storage, 'location')


 def test_multiprocessing_lazy_objects(image_upload_file):
     SimpleModel.objects.create(image=image_upload_file)
     obj = SimpleModel.objects.last()
     storage = obj.image.storage

     p = Pool(2)
     assert all(p.map(has_location, [default_storage, storage]))
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/25862#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.e9339af8d744804c3584cc189993cc6e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to