Open GoogleCodeExporter opened 8 years ago
290->289
291->290
Original comment by pipp...@gmail.com
on 13 Jun 2009 at 8:05
I have the same error.
Also, in admin models.py:
Before:
293 size = getattr(size, 'name', size)
294 base, ext = os.path.splitext(self.image_filename())
After:
293 size = getattr(size, 'name', size)
294 base, ext = os.path.decode('utf8').splitext(self.image_filename())
Original comment by dreg...@gmail.com
on 21 Jul 2009 at 1:58
Original comment by justin.d...@gmail.com
on 22 Jul 2009 at 12:26
[deleted comment]
@Report by pippejd
Works for me. I'm using Python 2.5, django 1.1 SVN-11368
@Comment 2 by dreglad:
Did not work. AttributeError: 'module' object has no attribute 'decode'
Original comment by mikaelmo...@gmail.com
on 11 Aug 2009 at 12:44
I had problem where thumbnails were missing from certain files due to either
latin characters and spaces. To work around this I've used this code:
utils.py:
========
import unicodedata
def get_ascii_safe_path(test, filename):
return unicodedata.normalize('NFKD', unicode(filename.replace(' ', '_'))).encode('ascii', 'ignore')
settings.py
===========
PHOTOLOGUE_PATH = 'utils.get_ascii_safe_path'
It resolves all encoding related issues with file names, but it would be nice
to have photologue to do the sanitizing part out of the box..
Original comment by hainea...@gmail.com
on 8 Feb 2011 at 7:02
Just an update for the comment I left above. Here's an updated function that
takes into account the storage path:
def get_ascii_safe_path(test, filename):
folder = getattr(settings, 'PHOTOLOGUE_DIR', 'photologue')
name = unicodedata.normalize('NFKD', unicode(filename.replace(' ', '_'))).encode('ascii', 'ignore')
return os.path.join(folder, 'photos', name)
This is not the end of the story thought, when deleting a photo the file and
thumbnails are not deleted from the filesystem as it should anymore. This
problem is getting messy...
Original comment by hainea...@gmail.com
on 8 Feb 2011 at 8:20
Original issue reported on code.google.com by
pipp...@gmail.com
on 13 Jun 2009 at 7:52