diff options
| author | Christopher Adams <christopher.r.adams@gmail.com> | 2013-09-06 14:23:50 -0400 |
|---|---|---|
| committer | Christopher Adams <christopher.r.adams@gmail.com> | 2013-09-06 14:32:46 -0400 |
| commit | b2f5ac16565605f20a0c4e90acc6beed5a5ac1ce (patch) | |
| tree | 8b40ecb183e8d9a398a195c7a05be88a1064244c /django | |
| parent | 05e14e8eaf577e64dc45e26466ebb6117589e572 (diff) | |
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.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/files/temp.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/django/core/files/temp.py b/django/core/files/temp.py index b607291294..3dcda17a09 100644 --- a/django/core/files/temp.py +++ b/django/core/files/temp.py @@ -46,6 +46,15 @@ if os.name == 'nt': except (OSError): pass + @property + def closed(self): + """ + This attribute needs to be accessible in certain situations, + because this class is supposed to mock the API of the class + tempfile.NamedTemporaryFile in the Python standard library. + """ + return self.file.closed + def __del__(self): self.close() |
