|
@ -45,6 +45,16 @@ def slugify(value): |
|
|
value = str(re.sub('[-\s]+', '-', value)) |
|
|
value = str(re.sub('[-\s]+', '-', value)) |
|
|
return value |
|
|
return value |
|
|
|
|
|
|
|
|
|
|
|
def check_name(name): |
|
|
|
|
|
tmp_dir = tempfile.mkdtemp() |
|
|
|
|
|
try: |
|
|
|
|
|
open(os.path.join(tmp_dir, name), 'a').close() |
|
|
|
|
|
except IOError: |
|
|
|
|
|
return False |
|
|
|
|
|
finally: |
|
|
|
|
|
shutil.rmtree(tmp_dir) |
|
|
|
|
|
return True |
|
|
|
|
|
|
|
|
def compute_name(name, suffix, escape_suffix): |
|
|
def compute_name(name, suffix, escape_suffix): |
|
|
if escape_suffix: |
|
|
if escape_suffix: |
|
|
name, extension = os.path.splitext(name) |
|
|
name, extension = os.path.splitext(name) |
|
|