Author: jacob
Date: 2008-08-27 16:44:14 -0500 (Wed, 27 Aug 2008)
New Revision: 8639
Modified:
django/trunk/django/core/files/storage.py
Log:
Fixed #8455: a lack of permissions in `MEDIA_ROOT` no longer causes an infinite
loop when saving files. Thanks, carljm.
Modified: django/trunk/django/core/files/storage.py
===================================================================
--- django/trunk/django/core/files/storage.py 2008-08-27 21:30:47 UTC (rev
8638)
+++ django/trunk/django/core/files/storage.py 2008-08-27 21:44:14 UTC (rev
8639)
@@ -1,4 +1,5 @@
import os
+import errno
import urlparse
from django.conf import settings
@@ -161,10 +162,13 @@
finally:
locks.unlock(fd)
os.close(fd)
- except OSError:
- # Ooops, we need a new file name.
- name = self.get_available_name(name)
- full_path = self.path(name)
+ except OSError, e:
+ if e.errno == errno.EEXIST:
+ # Ooops, the file exists. We need a new file name.
+ name = self.get_available_name(name)
+ full_path = self.path(name)
+ else:
+ raise
else:
# OK, the file save worked. Break out of the loop.
break
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---