Ticket #13550: non_ascii_chars_fix.diff
File non_ascii_chars_fix.diff, 1.8 KB (added by , 15 years ago) |
---|
-
django/core/files/storage.py
134 134 self.base_url = base_url 135 135 136 136 def _open(self, name, mode='rb'): 137 return File(open(self.path (name), mode))137 return File(open(self.path_str(name), mode)) 138 138 139 139 def _save(self, name, content): 140 full_path = self.path (name)140 full_path = self.path_str(name) 141 141 142 142 directory = os.path.dirname(full_path) 143 143 if not os.path.exists(directory): … … 174 174 if e.errno == errno.EEXIST: 175 175 # Ooops, the file exists. We need a new file name. 176 176 name = self.get_available_name(name) 177 full_path = self.path (name)177 full_path = self.path_str(name) 178 178 else: 179 179 raise 180 180 else: … … 187 187 return name 188 188 189 189 def delete(self, name): 190 name = self.path (name)190 name = self.path_str(name) 191 191 # If the file exists, delete it from the filesystem. 192 192 if os.path.exists(name): 193 193 os.remove(name) 194 194 195 195 def exists(self, name): 196 return os.path.exists(self.path (name))196 return os.path.exists(self.path_str(name)) 197 197 198 198 def listdir(self, path): 199 199 path = self.path(path) … … 211 211 except ValueError: 212 212 raise SuspiciousOperation("Attempted access to '%s' denied." % name) 213 213 return os.path.normpath(path) 214 215 def path_str(self, name): 216 return self.path(name).encode('utf-8') 214 217 215 218 def size(self, name): 216 return os.path.getsize(self.path (name))219 return os.path.getsize(self.path_str(name)) 217 220 218 221 def url(self, name): 219 222 if self.base_url is None: