source: timingandestimationplugin/branches/trac0.12-Permissions/timingandestimationplugin/statuses.py

Last change on this file was 8141, checked in by Russ Tyndall, 13 years ago

Converting to use new trac12 DB convensions. version 0.9.8b

File size: 842 bytes
Line 
1import dbhelper
2from trac.ticket.default_workflow import get_workflow_config
3try: 
4    set 
5except NameError: 
6    from sets import Set as set     # Python 2.3 fallback
7
8def status_variables(statuses):
9    return ', '.join(['$'+i.upper().replace("_","").replace(" ","") for i in list(statuses)])
10
11def get_statuses(env):
12    config = env.config
13    stats = get_statuses_from_workflow(config)
14    status_sql = """
15    SELECT DISTINCT status FROM ticket WHERE status <> '' ;
16    """
17    stats |= set(dbhelper.get_column_as_list(env, status_sql))
18    stats.difference_update(['', None])
19    return stats
20
21def get_statuses_from_workflow(config):
22    wf = get_workflow_config(config)
23    x = set()
24    for key, value in wf.items():
25        x.add(value['newstate'])
26        x |= set(value['oldstates'])
27    x.difference_update([u'*'])
28    return x
Note: See TracBrowser for help on using the repository browser.