From 1783e3150ef332c30d9ca35794c99ab1f332a214 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 2 Aug 2001 06:38:17 +0000 Subject: [PATCH] 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). git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@194 57a73879-2fb5-44c3-a270-3262357dd7e2 --- roundup/cgi_client.py | 25 ++++++++++++------- roundup/hyperdb.py | 7 +++++- roundup/roundupdb.py | 16 +++++++++++- roundup/templates/classic/dbinit.py | 6 ++++- roundup/templates/classic/instance_config.py | 8 +++++- roundup/templates/extended/dbinit.py | 9 ++++++- roundup/templates/extended/instance_config.py | 8 +++++- 7 files changed, 64 insertions(+), 15 deletions(-) diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index 3c497c0..7d18ef9 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -1,4 +1,4 @@ -# $Id: cgi_client.py,v 1.16 2001-08-02 05:55:25 richard Exp $ +# $Id: cgi_client.py,v 1.17 2001-08-02 06:38:17 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes @@ -229,7 +229,7 @@ class Client: props[key] = value cl.set(self.nodeid, **props) - self._post_editnode(self.nodeid) + self._post_editnode(self.nodeid, changed) # and some nice feedback for the user message = '%s edited ok'%', '.join(changed) except: @@ -320,7 +320,7 @@ class Client: props[key] = value return cl.create(**props) - def _post_editnode(self, nid): + def _post_editnode(self, nid, changes=None): ''' do the linking and message sending part of the node creation ''' cn = self.classname @@ -374,16 +374,20 @@ class Client: summary = note m = ['%s\n'%note] else: - summary = 'This %s has been created through the web.\n'%cn + summary = 'This %s has been edited through the web.\n'%cn m = [summary] - m.append('\n-------\n') # generate an edit message - nosyreactor will send it + first = 1 for name, prop in props.items(): + if changes is not None and name not in changes: continue + if first: + m.append('\n-------') + first = 0 value = cl.get(nid, name, None) if prop.isLinkType: link = self.db.classes[prop.classname] - key = link.getkey() + key = link.labelprop(default_to_id=1) if value is not None and key: value = link.get(value, key) else: @@ -392,8 +396,8 @@ class Client: if value is None: value = [] l = [] link = self.db.classes[prop.classname] + key = link.labelprop(default_to_id=1) for entry in value: - key = link.getkey() if key: l.append(link.get(entry, link.getkey())) else: @@ -403,9 +407,8 @@ class Client: # now create the message content = '\n'.join(m) - nosy.remove(self.getuid()) message_id = self.db.msg.create(author=self.getuid(), - recipients=nosy, date=date.Date('.'), summary=summary, + recipients=[], date=date.Date('.'), summary=summary, content=content) messages = cl.get(nid, 'messages') messages.append(message_id) @@ -536,6 +539,10 @@ class Client: # # $Log: not supported by cvs2svn $ +# Revision 1.16 2001/08/02 05:55:25 richard +# Web edit messages aren't sent to the person who did the edit any more. No +# message is generated if they are the only person on the nosy list. +# # Revision 1.15 2001/08/02 00:34:10 richard # bleah syntax error # diff --git a/roundup/hyperdb.py b/roundup/hyperdb.py index 3028535..c225e6a 100644 --- a/roundup/hyperdb.py +++ b/roundup/hyperdb.py @@ -395,7 +395,7 @@ class Class: """Return the name of the key property for this class or None.""" return self.key - def labelprop(self): + def labelprop(self, default_to_id=0): ''' Return the property name for a label for the given node. This method attempts to generate a consistent label for the node. @@ -413,6 +413,8 @@ class Class: return 'name' elif props.has_key('title'): return 'title' + if default_to_id: + return 'id' props = props.keys() props.sort() return props[0] @@ -798,6 +800,9 @@ def Choice(name, *options): # # $Log: not supported by cvs2svn $ +# Revision 1.11 2001/08/01 04:24:21 richard +# mailgw was assuming certain properties existed on the issues being created. +# # Revision 1.10 2001/07/30 02:38:31 richard # get() now has a default arg - for migration only. # diff --git a/roundup/roundupdb.py b/roundup/roundupdb.py index 5b33f30..b9749d3 100644 --- a/roundup/roundupdb.py +++ b/roundup/roundupdb.py @@ -1,4 +1,4 @@ -# $Id: roundupdb.py,v 1.7 2001-07-30 02:38:31 richard Exp $ +# $Id: roundupdb.py,v 1.8 2001-08-02 06:38:17 richard Exp $ import re, os, smtplib, socket @@ -243,6 +243,7 @@ class IssueClass(Class): m.append('Reply-To: %s'%self.ISSUE_TRACKER_EMAIL) m.append('') m.append(self.db.msg.get(msgid, 'content')) + m.append(self.email_footer(nodeid, msgid)) # TODO attachments try: smtp = smtplib.SMTP(self.MAILHOST) @@ -252,8 +253,21 @@ class IssueClass(Class): except smtplib.SMTPException, value: return "Couldn't send confirmation email: %s"%value + def email_footer(self, nodeid, msgid): + ''' Add a footer to the e-mail with some useful information + ''' + web = self.ISSUE_TRACKER_WEB + return '''%s +Roundup issue tracker +%s +%s +'''%('_'*len(web), self.ISSUE_TRACKER_EMAIL, web) + # # $Log: not supported by cvs2svn $ +# Revision 1.7 2001/07/30 02:38:31 richard +# get() now has a default arg - for migration only. +# # Revision 1.6 2001/07/30 00:05:54 richard # Fixed IssueClass so that superseders links to its classname rather than # hard-coded to "issue". diff --git a/roundup/templates/classic/dbinit.py b/roundup/templates/classic/dbinit.py index 06f39e4..cd6d380 100644 --- a/roundup/templates/classic/dbinit.py +++ b/roundup/templates/classic/dbinit.py @@ -1,4 +1,4 @@ -# $Id: dbinit.py,v 1.4 2001-07-29 07:01:39 richard Exp $ +# $Id: dbinit.py,v 1.5 2001-08-02 06:38:17 richard Exp $ import os @@ -18,6 +18,7 @@ class Database(roundupdb.Database, select_db.Database): class IssueClass(roundupdb.IssueClass): ''' issues need the email information ''' + ISSUE_TRACKER_WEB = instance_config.ISSUE_TRACKER_WEB ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL ADMIN_EMAIL = instance_config.ADMIN_EMAIL MAILHOST = instance_config.MAILHOST @@ -107,6 +108,9 @@ def init(adminpw): # # $Log: not supported by cvs2svn $ +# Revision 1.4 2001/07/29 07:01:39 richard +# Added vim command to all source so that we don't get no steenkin' tabs :) +# # Revision 1.3 2001/07/24 10:46:22 anthonybaxter # Added templatebuilder module. two functions - one to pack up the html base, # one to unpack it. Packed up the two standard templates into htmlbases. diff --git a/roundup/templates/classic/instance_config.py b/roundup/templates/classic/instance_config.py index cdf3187..eab3e2a 100644 --- a/roundup/templates/classic/instance_config.py +++ b/roundup/templates/classic/instance_config.py @@ -1,4 +1,4 @@ -# $Id: instance_config.py,v 1.2 2001-07-29 07:01:39 richard Exp $ +# $Id: instance_config.py,v 1.3 2001-08-02 06:38:17 richard Exp $ MAIL_DOMAIN=MAILHOST=HTTP_HOST=None HTTP_PORT=0 @@ -36,6 +36,9 @@ TEMPLATES = os.path.join(INSTANCE_HOME, 'html') # The email address that mail to roundup should go to ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN +# The web address that the instance is viewable at +ISSUE_TRACKER_WEB = 'http://www.bizarsoftware.com.au/cgi-bin/roundup.cgi/issues' + # The email address that roundup will complain to if it runs into trouble ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN @@ -44,6 +47,9 @@ LOG = os.path.join(INSTANCE_HOME, 'roundup.log') # # $Log: not supported by cvs2svn $ +# Revision 1.2 2001/07/29 07:01:39 richard +# Added vim command to all source so that we don't get no steenkin' tabs :) +# # Revision 1.1 2001/07/23 23:28:43 richard # Adding the classic template # diff --git a/roundup/templates/extended/dbinit.py b/roundup/templates/extended/dbinit.py index f870b49..4d532ca 100644 --- a/roundup/templates/extended/dbinit.py +++ b/roundup/templates/extended/dbinit.py @@ -1,4 +1,4 @@ -# $Id: dbinit.py,v 1.8 2001-07-30 01:26:59 richard Exp $ +# $Id: dbinit.py,v 1.9 2001-08-02 06:38:17 richard Exp $ import os @@ -17,6 +17,7 @@ class Database(roundupdb.Database, select_db.Database): class IssueClass(roundupdb.IssueClass): ''' issues need the email information ''' + ISSUE_TRACKER_WEB = instance_config.ISSUE_TRACKER_WEB ISSUE_TRACKER_EMAIL = instance_config.ISSUE_TRACKER_EMAIL ADMIN_EMAIL = instance_config.ADMIN_EMAIL MAILHOST = instance_config.MAILHOST @@ -155,6 +156,12 @@ def init(adminpw): # # $Log: not supported by cvs2svn $ +# Revision 1.8 2001/07/30 01:26:59 richard +# Big changes: +# . split off the support priority into its own class +# . added "new support, new user" to the page head +# . fixed the display options for the heading links +# # Revision 1.7 2001/07/29 07:01:39 richard # Added vim command to all source so that we don't get no steenkin' tabs :) # diff --git a/roundup/templates/extended/instance_config.py b/roundup/templates/extended/instance_config.py index e8fc5dd..fb45ee6 100644 --- a/roundup/templates/extended/instance_config.py +++ b/roundup/templates/extended/instance_config.py @@ -1,4 +1,4 @@ -# $Id: instance_config.py,v 1.2 2001-07-29 07:01:39 richard Exp $ +# $Id: instance_config.py,v 1.3 2001-08-02 06:38:17 richard Exp $ MAIL_DOMAIN=MAILHOST=HTTP_HOST=None HTTP_PORT=0 @@ -36,6 +36,9 @@ TEMPLATES = os.path.join(INSTANCE_HOME, 'html') # The email address that mail to roundup should go to ISSUE_TRACKER_EMAIL = 'issue_tracker@%s'%MAIL_DOMAIN +# The web address that the instance is viewable at +ISSUE_TRACKER_WEB = 'http://www.bizarsoftware.com.au/cgi-bin/roundup.cgi/issues' + # The email address that roundup will complain to if it runs into trouble ADMIN_EMAIL = 'roundup-admin@%s'%MAIL_DOMAIN @@ -44,6 +47,9 @@ LOG = os.path.join(INSTANCE_HOME, 'roundup.log') # # $Log: not supported by cvs2svn $ +# Revision 1.2 2001/07/29 07:01:39 richard +# Added vim command to all source so that we don't get no steenkin' tabs :) +# # Revision 1.1 2001/07/23 04:33:21 anthonybaxter # split __init__.py into 2. dbinit and instance_config. # -- 2.30.2