Guest User

Untitled

a guest
Jun 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. diff -r 5851127a6882 dc/stdimage/fields.py
  2. --- a/dc/stdimage/fields.py Tue May 26 14:36:55 2009 +0300
  3. +++ b/dc/stdimage/fields.py Wed May 27 17:44:15 2009 +0300
  4. @@ -90,7 +90,10 @@
  5. dst = self.generate_filename(instance, '%s_%s%s' % (self.name, instance._get_pk_val(), ext))
  6. dst_fullpath = os.path.join(settings.MEDIA_ROOT, dst)
  7. if os.path.abspath(filename) != os.path.abspath(dst_fullpath):
  8. - os.rename(filename, dst_fullpath)
  9. + if filename == os.path.join(settings.MEDIA_ROOT, self.default):
  10. + shutil.copyfile(filename, dst_fullpath)
  11. + else:
  12. + os.rename(filename, dst_fullpath)
  13. if self.size:
  14. self._resize_image(dst_fullpath, self.size)
  15. if self.thumbnail_size:
Add Comment
Please, Sign In to add comment