#596: pagination on /dashboard confused
------------------------+--------------------------
Reporter: tim | Owner: matevzb
Type: defect | Status: review
Priority: major | Milestone:
Component: dashboard | Version: 0.6.0
Resolution: | Keywords: ticket query
------------------------+--------------------------
Comment (by matevzb):
Replying to [comment:15 olemis]:
> Replying to [comment:14 matevzb]:
> [...]
> >
> > Please check if r1513085 solves the above issues. At least the first
one should be resolved, I'm not sure about the latter (still can't
reproduce the errors).
>
> It's working now . Nevertheless I'd like to propose this tiny patch for
your consideration ...
>
> {{{#!diff
>
> diff -r 53b8c8a20bdb
bloodhound_multiproduct/multiproduct/ticket/batch.py
> --- a/bloodhound_multiproduct/multiproduct/ticket/batch.py Tue Aug 13
03:48:27 2013 +0000
> +++ b/bloodhound_multiproduct/multiproduct/ticket/batch.py Tue Aug 13
11:20:27 2013 -0500
> @@ -38,11 +38,13 @@
>
> data['action_controls'] = []
> global_env = ProductEnvironment.lookup_global_env(self.env)
> - tmpenv = self.env
> + cache = {}
> for k,v in tickets_by_product.iteritems():
> - self.env = ProductEnvironment(global_env, k) if k else
global_env
> - data['action_controls'] += self._get_action_controls(req,
v)
> - self.env = tmpenv
> + batchmdl = cache.get(k or '')
> + if batchmdl is None:
> + env = ProductEnvironment(global_env, k) if k else
global_env
> + cache[k] = batchmdl = ProductBatchModifyModule(env)
> + data['action_controls'] +=
batchmdl._get_action_controls(req, v)
> batch_list_modes = [
> {'name': _("add"), 'value': "+"},
> {'name': _("remove"), 'value': "-"},
> }}}
Looks good, I'll commit this after re-running all the tests. Thanks!
--
Ticket URL: <https://issues.apache.org/bloodhound/ticket/596#comment:16>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker