Skip to content

Commit 5a900f3

Browse files
author
Richard Jones
committed
Roundupdb now appends "mailing list" information to its messages...
...which include the e-mail address and web interface address. Templates may override this in their db classes to include specific information (support instructions, etc).
1 parent 8f6c7a3 commit 5a900f3

File tree

7 files changed

+64
-15
lines changed

7 files changed

+64
-15
lines changed

roundup/cgi_client.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: cgi_client.py,v 1.16 2001-08-02 05:55:25 richard Exp $
1+
# $Id: cgi_client.py,v 1.17 2001-08-02 06:38:17 richard Exp $
22

33
import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes
44

@@ -229,7 +229,7 @@ def shownode(self, message=None):
229229
props[key] = value
230230
cl.set(self.nodeid, **props)
231231

232-
self._post_editnode(self.nodeid)
232+
self._post_editnode(self.nodeid, changed)
233233
# and some nice feedback for the user
234234
message = '%s edited ok'%', '.join(changed)
235235
except:
@@ -320,7 +320,7 @@ def _createnode(self):
320320
props[key] = value
321321
return cl.create(**props)
322322

323-
def _post_editnode(self, nid):
323+
def _post_editnode(self, nid, changes=None):
324324
''' do the linking and message sending part of the node creation
325325
'''
326326
cn = self.classname
@@ -374,16 +374,20 @@ def _post_editnode(self, nid):
374374
summary = note
375375
m = ['%s\n'%note]
376376
else:
377-
summary = 'This %s has been created through the web.\n'%cn
377+
summary = 'This %s has been edited through the web.\n'%cn
378378
m = [summary]
379-
m.append('\n-------\n')
380379

381380
# generate an edit message - nosyreactor will send it
381+
first = 1
382382
for name, prop in props.items():
383+
if changes is not None and name not in changes: continue
384+
if first:
385+
m.append('\n-------')
386+
first = 0
383387
value = cl.get(nid, name, None)
384388
if prop.isLinkType:
385389
link = self.db.classes[prop.classname]
386-
key = link.getkey()
390+
key = link.labelprop(default_to_id=1)
387391
if value is not None and key:
388392
value = link.get(value, key)
389393
else:
@@ -392,8 +396,8 @@ def _post_editnode(self, nid):
392396
if value is None: value = []
393397
l = []
394398
link = self.db.classes[prop.classname]
399+
key = link.labelprop(default_to_id=1)
395400
for entry in value:
396-
key = link.getkey()
397401
if key:
398402
l.append(link.get(entry, link.getkey()))
399403
else:
@@ -403,9 +407,8 @@ def _post_editnode(self, nid):
403407

404408
# now create the message
405409
content = '\n'.join(m)
406-
nosy.remove(self.getuid())
407410
message_id = self.db.msg.create(author=self.getuid(),
408-
recipients=nosy, date=date.Date('.'), summary=summary,
411+
recipients=[], date=date.Date('.'), summary=summary,
409412
content=content)
410413
messages = cl.get(nid, 'messages')
411414
messages.append(message_id)
@@ -536,6 +539,10 @@ def __del__(self):
536539

537540
#
538541
# $Log: not supported by cvs2svn $
542+
# Revision 1.16 2001/08/02 05:55:25 richard
543+
# Web edit messages aren't sent to the person who did the edit any more. No
544+
# message is generated if they are the only person on the nosy list.
545+
#
539546
# Revision 1.15 2001/08/02 00:34:10 richard
540547
# bleah syntax error
541548
#

roundup/hyperdb.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def getkey(self):
395395
"""Return the name of the key property for this class or None."""
396396
return self.key
397397

398-
def labelprop(self):
398+
def labelprop(self, default_to_id=0):
399399
''' Return the property name for a label for the given node.
400400
401401
This method attempts to generate a consistent label for the node.
@@ -413,6 +413,8 @@ def labelprop(self):
413413
return 'name'
414414
elif props.has_key('title'):
415415
return 'title'
416+
if default_to_id:
417+
return 'id'
416418
props = props.keys()
417419
props.sort()
418420
return props[0]
@@ -798,6 +800,9 @@ def Choice(name, *options):
798800

799801
#
800802
# $Log: not supported by cvs2svn $
803+
# Revision 1.11 2001/08/01 04:24:21 richard
804+
# mailgw was assuming certain properties existed on the issues being created.
805+
#
801806
# Revision 1.10 2001/07/30 02:38:31 richard
802807
# get() now has a default arg - for migration only.
803808
#

roundup/roundupdb.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: roundupdb.py,v 1.7 2001-07-30 02:38:31 richard Exp $
1+
# $Id: roundupdb.py,v 1.8 2001-08-02 06:38:17 richard Exp $
22

33
import re, os, smtplib, socket
44

@@ -243,6 +243,7 @@ def sendmessage(self, nodeid, msgid):
243243
m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL)
244244
m.append('')
245245
m.append(self.db.msg.get(msgid, 'content'))
246+
m.append(self.email_footer(nodeid, msgid))
246247
# TODO attachments
247248
try:
248249
smtp = smtplib.SMTP(self.MAILHOST)
@@ -252,8 +253,21 @@ def sendmessage(self, nodeid, msgid):
252253
except smtplib.SMTPException, value:
253254
return "Couldn't send confirmation email: %s"%value
254255

256+
def email_footer(self, nodeid, msgid):
257+
''' Add a footer to the e-mail with some useful information
258+
'''
259+
web = self.ISSUE_TRACKER_WEB
260+
return '''%s
261+
Roundup issue tracker
262+
%s
263+
%s
264+
'''%('_'*len(web), self.ISSUE_TRACKER_EMAIL, web)
265+
255266
#
256267
# $Log: not supported by cvs2svn $
268+
# Revision 1.7 2001/07/30 02:38:31 richard
269+
# get() now has a default arg - for migration only.
270+
#
257271
# Revision 1.6 2001/07/30 00:05:54 richard
258272
# Fixed IssueClass so that superseders links to its classname rather than
259273
# hard-coded to "issue".

roundup/templates/classic/dbinit.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: dbinit.py,v 1.4 2001-07-29 07:01:39 richard Exp $
1+
# $Id: dbinit.py,v 1.5 2001-08-02 06:38:17 richard Exp $
22

33
import os
44

@@ -18,6 +18,7 @@ class Database(roundupdb.Database, select_db.Database):
1818
class IssueClass(roundupdb.IssueClass):
1919
''' issues need the email information
2020
'''
21+
ISSUE_TRACKER_WEB = instance_config.ISSUE_TRACKER_WEB
2122
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
2223
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
2324
MAILHOST = instance_config.MAILHOST
@@ -107,6 +108,9 @@ def init(adminpw):
107108

108109
#
109110
# $Log: not supported by cvs2svn $
111+
# Revision 1.4 2001/07/29 07:01:39 richard
112+
# Added vim command to all source so that we don't get no steenkin' tabs :)
113+
#
110114
# Revision 1.3 2001/07/24 10:46:22 anthonybaxter
111115
# Added templatebuilder module. two functions - one to pack up the html base,
112116
# one to unpack it. Packed up the two standard templates into htmlbases.

roundup/templates/classic/instance_config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: instance_config.py,v 1.2 2001-07-29 07:01:39 richard Exp $
1+
# $Id: instance_config.py,v 1.3 2001-08-02 06:38:17 richard Exp $
22

33
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
44
HTTP_PORT=0
@@ -36,6 +36,9 @@
3636
# The email address that mail to roundup should go to
3737
ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN
3838

39+
# The web address that the instance is viewable at
40+
ISSUE_TRACKER_WEB = 'http://www.bizarsoftware.com.au/cgi-bin/roundup.cgi/issues'
41+
3942
# The email address that roundup will complain to if it runs into trouble
4043
ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN
4144

@@ -44,6 +47,9 @@
4447

4548
#
4649
# $Log: not supported by cvs2svn $
50+
# Revision 1.2 2001/07/29 07:01:39 richard
51+
# Added vim command to all source so that we don't get no steenkin' tabs :)
52+
#
4753
# Revision 1.1 2001/07/23 23:28:43 richard
4854
# Adding the classic template
4955
#

roundup/templates/extended/dbinit.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: dbinit.py,v 1.8 2001-07-30 01:26:59 richard Exp $
1+
# $Id: dbinit.py,v 1.9 2001-08-02 06:38:17 richard Exp $
22

33
import os
44

@@ -17,6 +17,7 @@ class Database(roundupdb.Database, select_db.Database):
1717
class IssueClass(roundupdb.IssueClass):
1818
''' issues need the email information
1919
'''
20+
ISSUE_TRACKER_WEB = instance_config.ISSUE_TRACKER_WEB
2021
ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL
2122
ADMIN_EMAIL = instance_config.ADMIN_EMAIL
2223
MAILHOST = instance_config.MAILHOST
@@ -155,6 +156,12 @@ def init(adminpw):
155156

156157
#
157158
# $Log: not supported by cvs2svn $
159+
# Revision 1.8 2001/07/30 01:26:59 richard
160+
# Big changes:
161+
# . split off the support priority into its own class
162+
# . added "new support, new user" to the page head
163+
# . fixed the display options for the heading links
164+
#
158165
# Revision 1.7 2001/07/29 07:01:39 richard
159166
# Added vim command to all source so that we don't get no steenkin' tabs :)
160167
#

roundup/templates/extended/instance_config.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: instance_config.py,v 1.2 2001-07-29 07:01:39 richard Exp $
1+
# $Id: instance_config.py,v 1.3 2001-08-02 06:38:17 richard Exp $
22

33
MAIL_DOMAIN=MAILHOST=HTTP_HOST=None
44
HTTP_PORT=0
@@ -36,6 +36,9 @@
3636
# The email address that mail to roundup should go to
3737
ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN
3838

39+
# The web address that the instance is viewable at
40+
ISSUE_TRACKER_WEB = 'http://www.bizarsoftware.com.au/cgi-bin/roundup.cgi/issues'
41+
3942
# The email address that roundup will complain to if it runs into trouble
4043
ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN
4144

@@ -44,6 +47,9 @@
4447

4548
#
4649
# $Log: not supported by cvs2svn $
50+
# Revision 1.2 2001/07/29 07:01:39 richard
51+
# Added vim command to all source so that we don't get no steenkin' tabs :)
52+
#
4753
# Revision 1.1 2001/07/23 04:33:21 anthonybaxter
4854
# split __init__.py into 2. dbinit and instance_config.
4955
#

0 commit comments

Comments
 (0)