Ticket #8455: issue-8455.errno2.diff
File issue-8455.errno2.diff, 1005 bytes (added by , 16 years ago) |
---|
-
django/core/files/storage.py
1 1 import os 2 import errno 2 3 import urlparse 3 4 4 5 from django.conf import settings … … 161 162 finally: 162 163 locks.unlock(fd) 163 164 os.close(fd) 164 except OSError: 165 # Ooops, we need a new file name. 166 name = self.get_available_name(name) 167 full_path = self.path(name) 165 except OSError, e: 166 if e.errno == errno.EEXIST: 167 # Ooops, we need a new file name. 168 name = self.get_available_name(name) 169 full_path = self.path(name) 170 else: 171 raise 168 172 else: 169 173 # OK, the file save worked. Break out of the loop. 170 174 break