mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-18 00:00:00 +00:00
Added cache to char2pinyin tag
This commit is contained in:
@@ -206,7 +206,13 @@ cc.spliter = ''
|
||||
@register.filter(name='char2pinyin')
|
||||
def char2pinyin(value):
|
||||
"""Convert Chinese character to pinyin."""
|
||||
return cc.convert(value)
|
||||
|
||||
py = cache.get('CHAR2PINYIN_'+value)
|
||||
if not py:
|
||||
py = cc.convert(value)
|
||||
cache.set('CHAR2PINYIN_'+value, py, 365 * 24 * 60 * 60)
|
||||
|
||||
return py
|
||||
|
||||
@register.filter(name='translate_permission')
|
||||
def translate_permission(value):
|
||||
|
Reference in New Issue
Block a user