##// END OF EJS Templates
cache: keep caching_query cacke_key in unicode ... and always include limit and offset to avoid any ambiguity
Mads Kiilerich -
r7907:38749d42 default
parent child Browse files
Show More
@@ -24,7 +24,7 b' from sqlalchemy.orm.interfaces import Ma'
24 from sqlalchemy.orm.query import Query
24 from sqlalchemy.orm.query import Query
25 from sqlalchemy.sql import visitors
25 from sqlalchemy.sql import visitors
26
26
27 from kallithea.lib.utils2 import safe_str
27 from kallithea.lib.utils2 import safe_str, safe_unicode
28
28
29
29
30 class CachingQuery(Query):
30 class CachingQuery(Query):
@@ -138,10 +138,10 b' def _get_cache_parameters(query):'
138
138
139 if cache_key is None:
139 if cache_key is None:
140 # cache key - the value arguments from this query's parameters.
140 # cache key - the value arguments from this query's parameters.
141 args = [safe_str(x) for x in _params_from_query(query)]
141 args = _params_from_query(query)
142 args.extend([k for k in [str(query._limit), str(query._offset)] if k not in ['None', None, u'None']])
142 args.append(query._limit)
143
143 args.append(query._offset)
144 cache_key = " ".join(args)
144 cache_key = " ".join(safe_unicode(x) for x in args)
145
145
146 if cache_key is None:
146 if cache_key is None:
147 raise Exception('Cache key cannot be None')
147 raise Exception('Cache key cannot be None')
General Comments 0
You need to be logged in to leave comments. Login now