diff -r 85b071fb75b2 -r eb9188f2ee4f web/ldt/utils/path.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/ldt/utils/path.py Fri Oct 22 18:14:30 2010 +0200 @@ -0,0 +1,14 @@ +""" +Some small file related utilities +""" + +import unicodedata +import string + +validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits) + + +def sanitize_filename(filename): + cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore').lower() + return ''.join(c for c in cleanedFilename if c in validFilenameChars).replace(' ','_') + \ No newline at end of file