|
Revision 5816, 1.0 KB
(checked in by cboos, 2 years ago)
|
|
Set svn:eol-style property to native on a bunch of .py files
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
|
| Line | |
|---|
| 1 | #!/usr/bin/python |
|---|
| 2 | import sys |
|---|
| 3 | |
|---|
| 4 | import trac.env |
|---|
| 5 | from trac.ticket.default_workflow import load_workflow_config_snippet |
|---|
| 6 | |
|---|
| 7 | def main(): |
|---|
| 8 | """Rewrite the ticket-workflow section of the config; and change all |
|---|
| 9 | 'assigned' tickets to 'accepted'. |
|---|
| 10 | """ |
|---|
| 11 | if len(sys.argv) != 2: |
|---|
| 12 | print "Usage: %s path_to_trac_environment" % sys.argv[0] |
|---|
| 13 | sys.exit(1) |
|---|
| 14 | tracdir = sys.argv[1] |
|---|
| 15 | trac_env = trac.env.open_environment(tracdir) |
|---|
| 16 | |
|---|
| 17 | # Update the config... |
|---|
| 18 | old_workflow = trac_env.config.options('ticket-workflow') |
|---|
| 19 | for name, value in old_workflow: |
|---|
| 20 | trac_env.config.remove('ticket-workflow', name) |
|---|
| 21 | load_workflow_config_snippet(trac_env.config, 'basic-workflow.ini') |
|---|
| 22 | trac_env.config.save() |
|---|
| 23 | |
|---|
| 24 | # Update the ticket statuses... |
|---|
| 25 | db = trac_env.get_db_cnx() |
|---|
| 26 | cursor = db.cursor() |
|---|
| 27 | cursor.execute("UPDATE ticket SET status = 'accepted' " |
|---|
| 28 | "WHERE status = 'assigned'") |
|---|
| 29 | db.commit() |
|---|
| 30 | |
|---|
| 31 | if __name__ == '__main__': |
|---|
| 32 | main() |
|---|