Mercurial > p > roundup > code
diff roundup/cgi_client.py @ 186:61355a9483f4
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.
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 02 Aug 2001 05:55:25 +0000 |
| parents | 817750ead8d5 |
| children | 1536be43d2fa |
line wrap: on
line diff
--- a/roundup/cgi_client.py Thu Aug 02 01:01:12 2001 +0000 +++ b/roundup/cgi_client.py Thu Aug 02 05:55:25 2001 +0000 @@ -1,4 +1,4 @@ -# $Id: cgi_client.py,v 1.15 2001-08-02 00:34:10 richard Exp $ +# $Id: cgi_client.py,v 1.16 2001-08-02 05:55:25 richard Exp $ import os, cgi, pprint, StringIO, urlparse, re, traceback, mimetypes @@ -21,6 +21,9 @@ self.headers_done = 0 self.debug = 0 + def getuid(self): + return self.db.user.lookup(self.user) + def header(self, headers={'Content-Type':'text/html'}): if not headers.has_key('Content-Type'): headers['Content-Type'] = 'text/html' @@ -344,10 +347,21 @@ link = self.db.classes[link] link.set(nodeid, **{property: nid}) - # if this item has messages, - if (cl.getprops().has_key('messages') and - cl.getprops()['messages'].isMultilinkType and - cl.getprops()['messages'].classname == 'msg'): + # see if we want to send a message to the nosy list... + props = cl.getprops() + # don't do the message thing if there's no nosy list, or the editor + # of the node is the only person on the nosy list - they're already + # aware of the change. + nosy = 0 + if props.has_key('nosy'): + nosy = cl.get(nid, 'nosy') + uid = self.getuid() + if len(nosy) == 1 and uid in nosy: + nosy = 0 + if (nosy and props.has_key('messages') and + props['messages'].isMultilinkType and + props['messages'].classname == 'msg'): + # handle the note note = None if self.form.has_key('__note'): @@ -365,8 +379,8 @@ m.append('\n-------\n') # generate an edit message - nosyreactor will send it - for name, prop in cl.getprops().items(): - value = cl.get(nid, name) + for name, prop in props.items(): + value = cl.get(nid, name, None) if prop.isLinkType: link = self.db.classes[prop.classname] key = link.getkey() @@ -375,6 +389,7 @@ else: value = '-' elif prop.isMultilinkType: + if value is None: value = [] l = [] link = self.db.classes[prop.classname] for entry in value: @@ -388,8 +403,10 @@ # now create the message content = '\n'.join(m) - message_id = self.db.msg.create(author='1', recipients=[], - date=date.Date('.'), summary=summary, content=content) + nosy.remove(self.getuid()) + message_id = self.db.msg.create(author=self.getuid(), + recipients=nosy, date=date.Date('.'), summary=summary, + content=content) messages = cl.get(nid, 'messages') messages.append(message_id) props = {'messages': messages} @@ -519,6 +536,9 @@ # # $Log: not supported by cvs2svn $ +# Revision 1.15 2001/08/02 00:34:10 richard +# bleah syntax error +# # Revision 1.14 2001/08/02 00:26:16 richard # Changed the order of the information in the message generated by web edits. #
