On Sun, Jan 29, 2006 at 08:05:52PM +0100, Christian Boos wrote:
> Same remark as above.
> I'm thinking about a Query.get_column_order(), that would for now return
> a sequence of the fields (starting with 'id', ending with  'reporter' 
> 'keywords', 'cc').
> The get_cols() fields will then be reorganized to match the sequence above.
> Later, if/when we have an UI, the get_column_order() would give back the 
> user defined order.

Excellent idea.

> Not strictly related to the above, there's also the issue of the 
> 'Status' field in the query:
> if one adds new statuses in the config, they don't show up in the list, 
> because
> there, the available statuses are still read from the db (enum table).

Indeed. I encountered this exact issue with my initial workflow plugin.
My solution at the time was to require an env upgrade and add them to
the DB:

    
http://trac-hacks.org/browser/workflowpatch/trunk/tracnewworkflow/tracnewworkflow/tracnewworkflow.py#L31


> So there are two possibilities: either read the statuses from the .ini, 
> if possible,
> or extend the trac-admin with a command to manipulate status (as I did for
> the resolutions in r2846).
> 
> Using the first solution, the status are not sorted:
> 
>  Status |_| resolved |_| assigned |_| verified |_| closed |_| new |_| 
> reopened
> 
> Using the second one, well, this is a bit inconvenient as there would be
> the need to configure the workflow at two different places.

A third solution might be to have the ITicketWorkflow extension point
return a list of states that it supports:
    
    def get_ticket_states(self):
        return ['new', 'assigned', 'reopened', 'closed']

All of these solutions except the DB one would require changes to the
query module, as it appears to do a join on the enum table. This could
be removed I guess.

> 
> -- Christian
> 
> Patch for the first solution:
> 
> Index: trac/ticket/model.py
> ===================================================================
> --- trac/ticket/model.py        (revision 2845)
> +++ trac/ticket/model.py        (working copy)
> @@ -402,7 +402,20 @@
> class Status(AbstractEnum):
>     type = 'status'
> 
> +    def select(cls, env, db=None):
> +        if 'ticket-status' in env.config:
> +            statuses = []
> +            for name, _ in env.config.options('ticket-status'):
> +                s = Status(env)
> +                s.name = s._old_name = name
> +                s.value = s._old_value = len(statuses)
> +                statuses.append(s)
> +            return statuses
> +        else:
> +            return AbstractEnum.select(env, db)
> +    select = classmethod(select)
> 
> +
> class Resolution(AbstractEnum):
>     type = 'resolution'
> 
> _______________________________________________
> Trac-dev mailing list
> [email protected]
> http://lists.edgewall.com/mailman/listinfo/trac-dev
> 

-- 
Evolution: Taking care of those too stupid to take care of themselves.
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to