use regexp for url_replacer
This commit is contained in:
parent
d2a1812a38
commit
73e1b58923
@ -19,7 +19,7 @@ def fromunixtime(value):
|
|||||||
return datetime.fromtimestamp(value).strftime('%Y-%m-%d %H:%M:%S')
|
return datetime.fromtimestamp(value).strftime('%Y-%m-%d %H:%M:%S')
|
||||||
|
|
||||||
def url_replacer(value):
|
def url_replacer(value):
|
||||||
return value.replace('/', '_').replace(' ', '_').replace('?', '').replace('<', '').replace('>', '')
|
return re.sub('[^a-zA-Z0-9\n\.]', '_', value)
|
||||||
|
|
||||||
def user_replacer(match):
|
def user_replacer(match):
|
||||||
return '[url=../../user/' + url_replacer(match.group(2)) + '.html]' + match.group(2) + '[/url]'
|
return '[url=../../user/' + url_replacer(match.group(2)) + '.html]' + match.group(2) + '[/url]'
|
||||||
|
Loading…
Reference in New Issue
Block a user