Mercurial > p > roundup > code
annotate detectors/creator_resolution.py @ 2806:845e87d5e3ba
translator objects now have the following search path:
- selected locale messages in the tracker locale dir
- selected locale messages in the system locale dir
- english messages in the tracker locale dir
- english messages in the system locale dir
automatically compile .mo files if needed (found .po file
and .mo is missing or .po mtime is greater that .mo mtime)
removed support for python < 2.0. gettext module is now required.
get_translation: removed 'domain' argument, added 'tracker_home' argument
| author | Alexander Smishlajev <a1s@users.sourceforge.net> |
|---|---|
| date | Sat, 23 Oct 2004 14:03:34 +0000 |
| parents | 43151ac10819 |
| children |
| rev | line source |
|---|---|
|
2194
43151ac10819
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2193
diff
changeset
|
1 # This detector was written by richard@mechanicalcat.net and it's been |
|
43151ac10819
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2193
diff
changeset
|
2 # placed in the Public Domain. Copy and modify to your heart's content. |
|
43151ac10819
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2193
diff
changeset
|
3 |
|
43151ac10819
*** empty log message ***
Richard Jones <richard@users.sourceforge.net>
parents:
2193
diff
changeset
|
4 #$Id: creator_resolution.py,v 1.2 2004-04-07 06:32:54 richard Exp $ |
|
2193
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
5 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
6 from roundup.exceptions import Reject |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
7 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
8 def creator_resolution(db, cl, nodeid, newvalues): |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
9 '''Catch attempts to set the status to "resolved" - if the assignedto |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
10 user isn't the creator, then set the status to "in-progress" (try |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
11 "confirm-done" first though, but "classic" Roundup doesn't have that |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
12 status) |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
13 ''' |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
14 if not newvalues.has_key('status'): |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
15 return |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
16 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
17 # get the resolved state ID |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
18 resolved_id = db.status.lookup('resolved') |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
19 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
20 if newvalues['status'] != resolved_id: |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
21 return |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
22 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
23 # check the assignedto |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
24 assignedto = newvalues.get('assignedto', cl.get(nodeid, 'assignedto')) |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
25 creator = cl.get(nodeid, 'creator') |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
26 if assignedto == creator: |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
27 if db.getuid() != creator: |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
28 name = db.user.get(creator, 'username') |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
29 raise Reject, 'Only the creator (%s) may close this issue'%name |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
30 return |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
31 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
32 # set the assignedto and status |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
33 newvalues['assignedto'] = creator |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
34 try: |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
35 status = db.status.lookup('confirm-done') |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
36 except KeyError: |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
37 status = db.status.lookup('in-progress') |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
38 newvalues['status'] = status |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
39 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
40 def init(db): |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
41 db.issue.audit('set', creator_resolution) |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
42 |
|
b1a29edd6214
added another sample detector
Richard Jones <richard@users.sourceforge.net>
parents:
diff
changeset
|
43 # vim: set filetype=python ts=4 sw=4 et si |
