projects
/
chemdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6a1509d
)
Use Django's slugify() to sanitize paths.
author
W. Trevor King
<wking@drexel.edu>
Mon, 2 Apr 2012 17:18:25 +0000
(13:18 -0400)
committer
W. Trevor King
<wking@drexel.edu>
Mon, 2 Apr 2012 17:18:25 +0000
(13:18 -0400)
chemdb/util.py
patch
|
blob
|
history
diff --git
a/chemdb/util.py
b/chemdb/util.py
index 7910dbf965c33e001d1c5b6b62187a4db6bb27b8..2d9f10b2e4ffbeb02a19fa78df0ce998c60437b9 100644
(file)
--- a/
chemdb/util.py
+++ b/
chemdb/util.py
@@
-3,6
+3,8
@@
import os.path as _os_path
import re as _re
+from django.template.defaultfilters import slugify as _slugify
+
from . import LOG as _LOG
@@
-63,9
+65,9
@@
def valid_CASno(cas_string):
return False
def sanitize_path(string):
- for a,b in [('
', '-'), ('
..', '-')]:
+ for a,b in [('..', '-')]:
string = string.replace(a, b)
- return
string
+ return
_slugify(string)
def chemical_upload_to(instance, filename, storage=None):
basename,extension = _os_path.splitext(filename)