|
Last change
on this file was
8140,
checked in by Russ Tyndall, 13 years ago
|
|
Working on converting DB access to trac12 standards. version 0.9.8
|
|
File size:
842 bytes
|
| Line | |
|---|
| 1 | import dbhelper |
|---|
| 2 | from trac.ticket.default_workflow import get_workflow_config |
|---|
| 3 | try: |
|---|
| 4 | set |
|---|
| 5 | except NameError: |
|---|
| 6 | from sets import Set as set # Python 2.3 fallback |
|---|
| 7 | |
|---|
| 8 | def status_variables(statuses): |
|---|
| 9 | return ', '.join(['$'+i.upper().replace("_","").replace(" ","") for i in list(statuses)]) |
|---|
| 10 | |
|---|
| 11 | def 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 | |
|---|
| 21 | def 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.