Mercurial > kallithea
changeset 8027:38749d420fbd
cache: keep caching_query cacke_key in unicode ... and always include limit and offset to avoid any ambiguity
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Mon, 16 Dec 2019 01:51:47 +0100 |
parents | d4ea298c3ec4 |
children | fd0998635e83 |
files | kallithea/lib/caching_query.py |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/caching_query.py Mon Dec 16 01:35:41 2019 +0100 +++ b/kallithea/lib/caching_query.py Mon Dec 16 01:51:47 2019 +0100 @@ -24,7 +24,7 @@ from sqlalchemy.orm.query import Query from sqlalchemy.sql import visitors -from kallithea.lib.utils2 import safe_str +from kallithea.lib.utils2 import safe_str, safe_unicode class CachingQuery(Query): @@ -138,10 +138,10 @@ if cache_key is None: # cache key - the value arguments from this query's parameters. - args = [safe_str(x) for x in _params_from_query(query)] - args.extend([k for k in [str(query._limit), str(query._offset)] if k not in ['None', None, u'None']]) - - cache_key = " ".join(args) + args = _params_from_query(query) + args.append(query._limit) + args.append(query._offset) + cache_key = " ".join(safe_unicode(x) for x in args) if cache_key is None: raise Exception('Cache key cannot be None')