* ui_ux: => 0
* version: SVN =>
* easy: => 0
Comment:
Bug still present! Django 1.3
{{{
File "C:\Python26\lib\site-packages\django\forms\forms.py" in full_clean
269. self._post_clean()
File "C:\Python26\lib\site-packages\django\forms\models.py" in _post_clean
308. self.instance = construct_instance(self, self.instance,
opts.fields, opts.exclude)
File "C:\Python26\lib\site-packages\django\forms\models.py" in
construct_instance
53. f.save_form_data(instance, cleaned_data[f.name])
File "C:\Python26\lib\site-packages\django\db\models\fields\files.py" in
save_form_data
281. setattr(instance, self.name, data)
File "C:\Python26\lib\site-packages\django\db\models\fields\files.py" in
__set__
314. self.field.update_dimension_fields(instance,
force=True)
File "C:\Python26\lib\site-packages\django\db\models\fields\files.py" in
update_dimension_fields
382. width = file.width
File "C:\Python26\lib\site-packages\django\core\files\images.py" in
_get_width
15. return self._get_image_dimensions()[0]
File "C:\Python26\lib\site-packages\django\core\files\images.py" in
_get_image_dimensions
24. close = self.closed
File "C:\Python26\lib\site-packages\django\db\models\fields\files.py" in
_get_closed
127. return file is None or file.closed
File "C:\Python26\lib\site-packages\django\core\files\base.py" in
_get_closed
51. return not self.file or self.file.closed
Exception Type: AttributeError at /photo/upload/
Exception Value: 'TemporaryFile' object has no attribute 'closed'
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by kmtracey):
Note it's is not necessary or or particularly helpful to post that still-
open bugs are still recreatable. This bug is open, there is no indication
anywhere in it that I can see that it has been fixed, so it's expected
that it's still present. If you find an open bug that can no longer be
recreated, that would be something to post (and possibly close the
ticket), but posting that open bugs are still there is just noise.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:7>
* needs_better_patch: 1 => 0
* easy: 0 => 1
Comment:
Replying to [comment:4 danostrowski]:
> This issue is still present, as I've had the same problem.
>
> However, the patch attached will not work if inserted as presented.
'temp.py' has had a lot of it's contents moved into 'tempfile.py' and
there's apparently different classes now for temporary files based on
whether you're using 'nt' or not. I am developing on Windows so this is of
concern to me.
The patch works fine for me, and I don't see why it wouldn't for you.
What issues are you having with it? Also, tempfile is not part of Django,
it is imported from the Python Standard Library.
temp.py just tells Django what class to use for temporary files. If you
are using a Windows NT OS, temp.py will define a custom TemporaryFile
class for Django to use. If you are not using a Windows NT OS, temp.py
will tell Django to just use the tempfile.NamedTemporaryFile class. The
reason for this is that NamedTemporaryFile cannot be reopened with a
Windows NT OS.
This bug is caused because the custom TemporaryFile object Django defines
for NT does not have a closed property, but self.closed is accessed when
using the inherited open method. If you are not using NT, this bug won't
affect you.
The patch seems to add the property with the expected behavior. In
addition to the changes made by the patch, it seems like it would be
cleaner to only use the custom TemporaryFile object regardless of OS.
It's a pretty simple class and I don't see any platform specific notes for
the Standard Library functionality used by it.
Either way, just applying the patch should work. It just needs a test.
I'll try to get to it if I have time, but I'm pretty busy at the moment.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:8>
Comment (by anonymous):
The patch works fine for me.
Environment - Windows 2008 server, Apache + mod_wsgi, Django 1.3
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:9>
Comment (by anentropic):
Patch worked for me: Windows 7 64 bit, Django 1.3 dev server
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:10>
* keywords: TemporaryFile closed => TemporaryFile closed windows
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:11>
Comment (by anonymous):
Patch doesn't work on Win 8
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:12>
Comment (by anonymous):
Sorry it does work on win8 django 1.3.1 devserver
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:13>
* owner: petar =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:14>
* owner: => susan
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:15>
* cc: jdunck@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:16>
Comment (by pombredanne):
I experienced the same issue on win7 and django 1.5.1.
Susan, do you want a patch?
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:17>
* cc: pombredanne@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:18>
Comment (by susan):
Sure, I'll appreciate. Since Im running macOS, and the bug appears only on
windowsOS, I think I may have difficulty replicating this bug.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:19>
Comment (by pombredanne@…):
susan, let me craft that and reference a pull request here.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:20>
* owner: susan => pombredanne
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:21>
Comment (by pombredanne):
Since Python 2.6, `tempfile.NamedTemporaryFile` has a new attribute:
`delete=True/False` which likely removes the needs entirely to have a
`django.core.temp.NamedTemporaryFile` wrapper specifically for 'nt'. I
will investigate this since 2.6 is a requirement for 1.5.x. The lack of a
closed attribute is something that happens only in some contexts and is
something that is injected elsewhere and I am still trying to understand
where/when exactly.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:22>
* owner: pombredanne =>
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:23>
Comment (by pombredanne):
I am unassigning this ticket from me, as I am not able to work on it in
the short term ... but this is still on my radar
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:24>
* owner: => anonymous
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:25>
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:26>
Comment (by adamsc64):
Submitted a pull request that should solve this at
https://github.com/django/django/pull/1566. This could probably easily be
made into a bug fix for previous versions of Django, as it's just a few
lines of code and the issue seems to be very old.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:27>
Comment (by Christopher Adams <christopher.r.adams@…>):
- TemporaryFile now minimally mocks the API of the Python standard library
class tempfile.NamedTemporaryFile to avoid AttributeError exceptions.
- The symbol django.core.files.NamedTemporaryFile is actually assigned as
a different class on different operating systems.
- The bug only occurred if Django is running on Windows, hence why it was
hard to diagnose.
- All tests pass with ./runtests.py --settings=test_sqlite
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:28>
* status: assigned => new
* owner: anonymous =>
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:29>
* status: new => closed
* resolution: => fixed
* stage: Accepted => Unreviewed
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:30>
* status: closed => new
* resolution: fixed =>
* stage: Unreviewed => Accepted
Comment:
Please don't close a ticket until the fix has been committed to master.
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:31>
* cc: christopher.r.adams@… (added)
Comment:
Gotcha. Sorry about that - I'm a n00b!
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:32>
* status: new => closed
* owner: => Christopher Adams <christopher.r.adams@…>
* resolution: => fixed
Comment:
In [changeset:"b2f5ac16565605f20a0c4e90acc6beed5a5ac1ce"]:
{{{
#!CommitTicketReference repository=""
revision="b2f5ac16565605f20a0c4e90acc6beed5a5ac1ce"
Fixed #11857 -- Added missing 'closed' property on TemporaryFile class.
- TemporaryFile now minimally mocks the API of the Python standard
library class tempfile.NamedTemporaryFile to avoid AttributeError
exceptions.
- The symbol django.core.files.NamedTemporaryFile is actually assigned
as a different class on different operating systems.
- The bug only occurred if Django is running on Windows, hence why it
was hard to diagnose.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:33>
Comment (by Russell Keith-Magee <russell@…>):
In [changeset:"926bc421d9bcf04a79f0026a60d3d4b0570b7fe2"]:
{{{
#!CommitTicketReference repository=""
revision="926bc421d9bcf04a79f0026a60d3d4b0570b7fe2"
Merge pull request #1566 from adamsc64/ticket_11857
Fixed #11857 -- Added missing 'closed' property on TemporaryFile class.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:34>
Comment (by Russell Keith-Magee <russell@…>):
In [changeset:"2a2ac5c1400c67f25388621a39749c918a4efe98"]:
{{{
#!CommitTicketReference repository=""
revision="2a2ac5c1400c67f25388621a39749c918a4efe98"
Merge pull request #1566 from adamsc64/ticket_11857
Fixed #11857 -- Added missing 'closed' property on TemporaryFile class.
Backport of 926bc42 from trunk.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/11857#comment:35>