Show More
@@ -45,7 +45,8 b' class HomeController(BaseController):' | |||||
45 |
|
45 | |||
46 | c.repos_list = self.scm_model.get_repos() |
|
46 | c.repos_list = self.scm_model.get_repos() | |
47 |
|
47 | |||
48 | c.groups = RepoGroup.query().filter(RepoGroup.group_parent_id == None).all() |
|
48 | c.groups = RepoGroup.query()\ | |
|
49 | .filter(RepoGroup.group_parent_id == None).all() | |||
49 |
|
50 | |||
50 | return render('/index.html') |
|
51 | return render('/index.html') | |
51 |
|
52 |
@@ -137,8 +137,13 b' def _get_cache_parameters(query):' | |||||
137 |
|
137 | |||
138 | if cache_key is None: |
|
138 | if cache_key is None: | |
139 | # cache key - the value arguments from this query's parameters. |
|
139 | # cache key - the value arguments from this query's parameters. | |
140 | args = _params_from_query(query) |
|
140 | args = [str(x) for x in _params_from_query(query)] | |
141 | cache_key = " ".join([str(x) for x in args]) |
|
141 | args.extend(filter(lambda k:k not in ['None', None, u'None'], | |
|
142 | [str(query._limit), str(query._offset)])) | |||
|
143 | cache_key = " ".join(args) | |||
|
144 | ||||
|
145 | if cache_key is None: | |||
|
146 | raise Exception('Cache key cannot be None') | |||
142 |
|
147 | |||
143 | # get cache |
|
148 | # get cache | |
144 | #cache = query.cache_manager.get_cache_region(namespace, region) |
|
149 | #cache = query.cache_manager.get_cache_region(namespace, region) | |
@@ -275,15 +280,20 b' def _params_from_query(query):' | |||||
275 | """ |
|
280 | """ | |
276 | v = [] |
|
281 | v = [] | |
277 | def visit_bindparam(bind): |
|
282 | def visit_bindparam(bind): | |
278 | value = query._params.get(bind.key, bind.value) |
|
|||
279 |
|
283 | |||
280 | # lazyloader may dig a callable in here, intended |
|
284 | if bind.key in query._params: | |
281 | # to late-evaluate params after autoflush is called. |
|
285 | value = query._params[bind.key] | |
282 | # convert to a scalar value. |
|
286 | elif bind.callable: | |
283 | if callable(value): |
|
287 | # lazyloader may dig a callable in here, intended | |
284 | value = value() |
|
288 | # to late-evaluate params after autoflush is called. | |
|
289 | # convert to a scalar value. | |||
|
290 | value = bind.callable() | |||
|
291 | else: | |||
|
292 | value = bind.value | |||
285 |
|
293 | |||
286 | v.append(value) |
|
294 | v.append(value) | |
287 | if query._criterion is not None: |
|
295 | if query._criterion is not None: | |
288 | visitors.traverse(query._criterion, {}, {'bindparam':visit_bindparam}) |
|
296 | visitors.traverse(query._criterion, {}, {'bindparam':visit_bindparam}) | |
|
297 | for f in query._from_obj: | |||
|
298 | visitors.traverse(f, {}, {'bindparam':visit_bindparam}) | |||
289 | return v |
|
299 | return v |
@@ -573,7 +573,7 b' class Repository(Base, BaseModel):' | |||||
573 | """ |
|
573 | """ | |
574 | q = Session().query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == |
|
574 | q = Session().query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == | |
575 | Repository.url_sep()) |
|
575 | Repository.url_sep()) | |
576 | q.options(FromCache("sql_cache_short", "repository_repo_path")) |
|
576 | q = q.options(FromCache("sql_cache_short", "repository_repo_path")) | |
577 | return q.one().ui_value |
|
577 | return q.one().ui_value | |
578 |
|
578 | |||
579 | @property |
|
579 | @property |
General Comments 0
You need to be logged in to leave comments.
Login now