Edgewall Software

Changes between Initial Version and Version 1 of Ticket #12156, comment 7


Ignore:
Timestamp:
Jul 10, 2018, 7:50:00 AM (6 years ago)
Author:
Ryan J Ollos

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #12156, comment 7

    initial v1  
    55On the second call, when mutating the milestones field dict, the `field['options']` has already been transformed to `field['optgroups']` and `field['options']` is empty, so the milestone query filter ends up empty: [browser:rjollos.git/trac/ticket/query.py@daa75c74:772-773,777-780#L759].
    66
    7 It looks like we need to refactoring `Query.template_data`.
     7The following change fixes the failure:
     8{{{#!diff
     9diff --git a/trac/ticket/query.py b/trac/ticket/query.py
     10index aba697389..b82fd2ca7 100644
     11--- a/trac/ticket/query.py
     12+++ b/trac/ticket/query.py
     13@@ -769,6 +769,7 @@ class Query(object):
     14                 field['options'].insert(0, {'name': '$USER',
     15                                             'value': '$USER'})
     16             if name == 'milestone' and not field.get('custom'):
     17+                field = field.copy()
     18                 milestones = [Milestone(self.env, opt)
     19                               for opt in field['options']]
     20                 milestones = [m for m in milestones
     21}}}
     22
     23However, it looks like we need to refactoring `Query.template_data`. Isn't the `Query` class more like a model? It seems like it shouldn't be involved in preparing data for the view, rather that should be the responsibility of `QueryModule`.