diff -r 674a65969a14 -r 97b12f5f2c7a web/ldt/utils/path.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/ldt/utils/path.py Wed Sep 29 10:10:07 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