Skip to content

Commit f31c5f0

Browse files
author
Richard Jones
committed
added another sample detector
1 parent c5138f5 commit f31c5f0

File tree

3 files changed

+57
-23
lines changed

3 files changed

+57
-23
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Feature:
99
- database export now exports full journals too
1010
- tracker name at end of page title (sf rfe 926840)
1111
- roundup-server now uses the ForkingMixin
12+
- added another sample detector "creator_resolution"
1213

1314
Fixed:
1415
- web CSV export was busted (as was any action returning a result)

detectors/creator_resolution.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#$Id: creator_resolution.py,v 1.1 2004-04-07 06:31:47 richard Exp $
2+
3+
from roundup.exceptions import Reject
4+
5+
def creator_resolution(db, cl, nodeid, newvalues):
6+
'''Catch attempts to set the status to "resolved" - if the assignedto
7+
user isn't the creator, then set the status to "in-progress" (try
8+
"confirm-done" first though, but "classic" Roundup doesn't have that
9+
status)
10+
'''
11+
if not newvalues.has_key('status'):
12+
return
13+
14+
# get the resolved state ID
15+
resolved_id = db.status.lookup('resolved')
16+
17+
if newvalues['status'] != resolved_id:
18+
return
19+
20+
# check the assignedto
21+
assignedto = newvalues.get('assignedto', cl.get(nodeid, 'assignedto'))
22+
creator = cl.get(nodeid, 'creator')
23+
if assignedto == creator:
24+
if db.getuid() != creator:
25+
name = db.user.get(creator, 'username')
26+
raise Reject, 'Only the creator (%s) may close this issue'%name
27+
return
28+
29+
# set the assignedto and status
30+
newvalues['assignedto'] = creator
31+
try:
32+
status = db.status.lookup('confirm-done')
33+
except KeyError:
34+
status = db.status.lookup('in-progress')
35+
newvalues['status'] = status
36+
37+
def init(db):
38+
db.issue.audit('set', creator_resolution)
39+
40+
# vim: set filetype=python ts=4 sw=4 et si

doc/customizing.txt

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Customising Roundup
33
===================
44

5-
:Version: $Revision: 1.132 $
5+
:Version: $Revision: 1.133 $
66

77
.. This document borrows from the ZopeBook section on ZPT. The original is at:
88
http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
@@ -585,6 +585,9 @@ interface for detectors.
585585

586586
__ design.html
587587

588+
Additional Detectors Ready For Use
589+
----------------------------------
590+
588591
Sample additional detectors that have been found useful will appear in
589592
the ``'detectors'`` directory of the Roundup distribution. If you want
590593
to use one, copy it to the ``'detectors'`` of your tracker instance:
@@ -594,28 +597,18 @@ to use one, copy it to the ``'detectors'`` of your tracker instance:
594597
created. The address is hard-coded into the detector, so edit it
595598
before you use it (look for the text '[email protected]') or you'll get
596599
email errors!
597-
598-
The detector code::
599-
600-
from roundup import roundupdb
601-
602-
def newissuecopy(db, cl, nodeid, oldvalues):
603-
''' Copy a message about new issues to a team address.
604-
'''
605-
# so use all the messages in the create
606-
change_note = cl.generateCreateNote(nodeid)
607-
608-
# send a copy to the nosy list
609-
for msgid in cl.get(nodeid, 'messages'):
610-
try:
611-
# note: last arg must be a list
612-
cl.send_message(nodeid, msgid, change_note,
613-
614-
except roundupdb.MessageSendError, message:
615-
raise roundupdb.DetectorError, message
616-
617-
def init(db):
618-
db.issue.react('create', newissuecopy)
600+
**creator_resolution.py**
601+
Catch attempts to set the status to "resolved" - if the assignedto
602+
user isn't the creator, then set the status to "confirm-done". Note that
603+
"classic" Roundup doesn't have that status, so you'll have to add it. If
604+
you don't want to though, it'll just use "in-progress" instead.
605+
**email_auditor.py**
606+
If a file added to an issue is of type message/rfc822, we tack on the
607+
extension .eml.
608+
The reason for this is that Microsoft Internet Explorer will not open
609+
things with a .eml attachment, as they deem it 'unsafe'. Worse yet,
610+
they'll just give you an incomprehensible error message. For more
611+
information, see the detector code - it has a length explanation.
619612

620613

621614
Auditor or Reactor?

0 commit comments

Comments
 (0)