Show More
@@ -45,7 +45,8 b' class HomeController(BaseController):' | |||
|
45 | 45 | |
|
46 | 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 | 51 | return render('/index.html') |
|
51 | 52 |
@@ -137,8 +137,13 b' def _get_cache_parameters(query):' | |||
|
137 | 137 | |
|
138 | 138 | if cache_key is None: |
|
139 | 139 | # cache key - the value arguments from this query's parameters. |
|
140 | args = _params_from_query(query) | |
|
141 | cache_key = " ".join([str(x) for x in args]) | |
|
140 | args = [str(x) for x in _params_from_query(query)] | |
|
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 | 148 | # get cache |
|
144 | 149 | #cache = query.cache_manager.get_cache_region(namespace, region) |
@@ -275,15 +280,20 b' def _params_from_query(query):' | |||
|
275 | 280 | """ |
|
276 | 281 | v = [] |
|
277 | 282 | def visit_bindparam(bind): |
|
278 | value = query._params.get(bind.key, bind.value) | |
|
279 | 283 | |
|
284 | if bind.key in query._params: | |
|
285 | value = query._params[bind.key] | |
|
286 | elif bind.callable: | |
|
280 | 287 | # lazyloader may dig a callable in here, intended |
|
281 | 288 | # to late-evaluate params after autoflush is called. |
|
282 | 289 | # convert to a scalar value. |
|
283 |
|
|
|
284 | value = value() | |
|
290 | value = bind.callable() | |
|
291 | else: | |
|
292 | value = bind.value | |
|
285 | 293 | |
|
286 | 294 | v.append(value) |
|
287 | 295 | if query._criterion is not None: |
|
288 | 296 | visitors.traverse(query._criterion, {}, {'bindparam':visit_bindparam}) |
|
297 | for f in query._from_obj: | |
|
298 | visitors.traverse(f, {}, {'bindparam':visit_bindparam}) | |
|
289 | 299 | return v |
@@ -573,7 +573,7 b' class Repository(Base, BaseModel):' | |||
|
573 | 573 | """ |
|
574 | 574 | q = Session().query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == |
|
575 | 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 | 577 | return q.one().ui_value |
|
578 | 578 | |
|
579 | 579 | @property |
General Comments 0
You need to be logged in to leave comments.
Login now