diff -r 40eddcc3d063 -r 3a30d255c235 web/ldt/utils/path.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/ldt/utils/path.py Sun Nov 14 20:25:22 2010 +0100 @@ -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