Author: jacob
Date: 2008-10-10 15:14:52 -0500 (Fri, 10 Oct 2008)
New Revision: 9223
Modified:
django/branches/releases/1.0.X/
django/branches/releases/1.0.X/tests/modeltests/files/models.py
Log:
[1.0.X] Be nice to buildbots: switched `modeltests/files` to use a proper
isolated directory for file storage
Backport of r9222 from trunk.
Property changes on: django/branches/releases/1.0.X
___________________________________________________________________
Name: svnmerge-integrated
-
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9211
+
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9211,9222
Modified: django/branches/releases/1.0.X/tests/modeltests/files/models.py
===================================================================
--- django/branches/releases/1.0.X/tests/modeltests/files/models.py
2008-10-10 20:09:51 UTC (rev 9222)
+++ django/branches/releases/1.0.X/tests/modeltests/files/models.py
2008-10-10 20:14:52 UTC (rev 9223)
@@ -5,14 +5,15 @@
and where files should be stored.
"""
+import shutil
import tempfile
-
from django.db import models
from django.core.files.base import ContentFile
from django.core.files.storage import FileSystemStorage
from django.core.cache import cache
-temp_storage = FileSystemStorage(location=tempfile.gettempdir())
+temp_storage_location = tempfile.mkdtemp()
+temp_storage = FileSystemStorage(location=temp_storage_location)
# Write out a file to be used as default content
temp_storage.save('tests/default.txt', ContentFile('default content'))
@@ -109,10 +110,10 @@
>>> obj4.random
<FieldFile: .../random_file>
-# Clean up the temporary files.
-
+# Clean up the temporary files and dir.
>>> obj1.normal.delete()
>>> obj2.normal.delete()
>>> obj3.default.delete()
>>> obj4.random.delete()
+>>> shutil.rmtree(temp_storage_location)
"""}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---