You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by Apache Bloodhound <de...@bloodhound.apache.org> on 2013/11/01 19:07:36 UTC

Re: [Apache Bloodhound] #654: Rows in ticket query result set not sorted by column

#654: Rows in ticket query result set not sorted by column
---------------------------+-----------------------------------
  Reporter:  olemis        |      Owner:  gjm
      Type:  defect        |     Status:  accepted
  Priority:  blocker       |  Milestone:  Release 8
 Component:  multiproduct  |    Version:
Resolution:                |   Keywords:  ticket query, sorting
---------------------------+-----------------------------------

Comment (by gjm):

 I've been considering this one for a while now. The immediate problem is
 that lists of enums (Type, Status, Resolution, Priority and Severity for
 example) are not available as the query to select them is restricted to
 the product that they are performed in. This makes a bit less sense at the
 top level where there are none.

 There are a number of ways to deal with this, one of which includes
 providing an extra variable on the env object to determine whether to
 force a db_direct_query and decorate the !AbstractEnum.select method to
 choose when no product is selected. This would look something like:
 {{{
 #!python
 import copy
 from trac.ticket import model

 from functools import wraps

 def direct_query_override(f):
     @classmethod
     @wraps(f)
     def decorator(cls, env, *args, **kwargs):
         kwargs.pop('db', None)
         denv = copy.copy(env)
         if not getattr(denv, 'product', None):
             denv._db_direct_override = True
         return f.__get__(True).im_func(cls, denv, *args, **kwargs)
     return decorator

 model.AbstractEnum.select =
 direct_query_override(model.AbstractEnum.select)
 }}}

 That still leaves a bit to do about including:
  * duplicate removal
  * restricting returned values based on permissions
  * decide whether we care that enums may end up with different priorities
 in different products

-- 
Ticket URL: <https://issues.apache.org/bloodhound/ticket/654#comment:8>
Apache Bloodhound <https://issues.apache.org/bloodhound/>
The Apache Bloodhound issue tracker