reborking how shares are shown in manager

This commit is contained in:
Ville Rantanen
2018-03-02 14:08:40 +02:00
parent 464a5cc9bb
commit 9e4b2892d5
3 changed files with 75 additions and 26 deletions

View File

@@ -46,3 +46,13 @@ def get_or_none(key,d,none = None):
return d[key]
else:
return none
def safe_name(s):
return safe_string(s, "-_")
def safe_path(s):
return safe_string(s, "-_/")
def safe_string(s, valid):
""" return a safe string, replace non alnum characters with _ . all characters in valid are considered valid. """
return "".join([c if c.isalnum() or c in valid else "_" for c in s])