| author | ymh <ymh.work@gmail.com> |
| Tue, 26 Oct 2010 16:25:19 +0200 | |
| changeset 7 | 2b0de7414b92 |
| parent 1 | eb9188f2ee4f |
| permissions | -rw-r--r-- |
""" 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(' ','_')