Skip to content

Commit 465939b

Browse files
committed
merge.
2 parents da2733d + 2f6c499 commit 465939b

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

CHANGES.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ Entries are given with the most recent entry first.
33
Each entry has the developer who committed the change in brackets.
44
Entries without name were done by Richard Jones.
55

6+
2012-??-??: 1.4.21
7+
8+
Features:
9+
10+
- ...
11+
12+
Fixed:
13+
14+
- issue2550574: Restore sample detectors removed in roundup 1.4.9
15+
(Thomas Arendsen Hein)
16+
17+
618
2012-05-15: 1.4.20
719

820
Features:

detectors/creator_resolution.py

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

detectors/emailauditor.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
def eml_to_mht(db, cl, nodeid, newvalues):
3+
'''This auditor fires whenever a new file entity is created.
4+
5+
If the file is of type message/rfc822, we tack onthe extension .eml.
6+
7+
The reason for this is that Microsoft Internet Explorer will not open
8+
things with a .eml attachment, as they deem it 'unsafe'. Worse yet,
9+
they'll just give you an incomprehensible error message. For more
10+
information, please see:
11+
12+
http://support.microsoft.com/default.aspx?scid=kb;EN-US;825803
13+
14+
Their suggested work around is (excerpt):
15+
16+
WORKAROUND
17+
18+
To work around this behavior, rename the .EML file that the URL
19+
links to so that it has a .MHT file name extension, and then update
20+
the URL to reflect the change to the file name. To do this:
21+
22+
1. In Windows Explorer, locate and then select the .EML file that
23+
the URL links.
24+
2. Right-click the .EML file, and then click Rename.
25+
3. Change the file name so that the .EML file uses a .MHT file name
26+
extension, and then press ENTER.
27+
4. Updated the URL that links to the file to reflect the new file
28+
name extension.
29+
30+
So... we do that. :)'''
31+
if newvalues.get('type', '').lower() == "message/rfc822":
32+
if not newvalues.has_key('name'):
33+
newvalues['name'] = 'email.mht'
34+
return
35+
name = newvalues['name']
36+
if name.endswith('.eml'):
37+
name = name[:-4]
38+
newvalues['name'] = name + '.mht'
39+
40+
def init(db):
41+
db.file.audit('create', eml_to_mht)
42+

detectors/newissuecopy.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# copied from nosyreaction
2+
3+
from roundup import roundupdb
4+
5+
def newissuecopy(db, cl, nodeid, oldvalues):
6+
''' Copy a message about new issues to a team address.
7+
'''
8+
# so use all the messages in the create
9+
change_note = cl.generateCreateNote(nodeid)
10+
11+
# send a copy to the nosy list
12+
for msgid in cl.get(nodeid, 'messages'):
13+
try:
14+
# note: last arg must be a list
15+
cl.send_message(nodeid, msgid, change_note, ['[email protected]'])
16+
except roundupdb.MessageSendError, message:
17+
raise roundupdb.DetectorError, message
18+
19+
def init(db):
20+
db.issue.react('create', newissuecopy)
21+
22+
# vim: set filetype=python ts=4 sw=4 et si

0 commit comments

Comments
 (0)