def get_valid_filename(s): """ like the regular get_valid_filename, but also slugifies away umlauts and stuff. """ s = get_valid_filename_django(s) filename, ext = os.path.splitext(s) filename = slugify(filename) ext = slugify(ext) if ext: return u"%s.%s" % (filename, ext) else: return u"%s" % (filename,)
def get_valid_filename(s): """ like the regular get_valid_filename, but also slugifies away umlauts and stuff. Copied from django-filer """ s = get_valid_filename_django(s) filename, ext = splitext(s) filename = slugify(filename) ext = slugify(ext) if ext: return "%s.%s" % (filename, ext) else: return "%s" % (filename, )