1515# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717#
18- # $Id: cgi_client.py,v 1.22 2001-08-17 00:08:10 richard Exp $
18+ # $Id: cgi_client.py,v 1.23 2001-08-29 04:47:18 richard Exp $
1919
2020import os , cgi , pprint , StringIO , urlparse , re , traceback , mimetypes
2121
@@ -199,7 +199,7 @@ def shownode(self, message=None):
199199 num_re = re .compile ('^\d+$' )
200200 if keys :
201201 try :
202- props , changed = parsePropsFromForm (cl , self .form )
202+ props , changed = parsePropsFromForm (cl , self .form , self . nodeid )
203203 cl .set (self .nodeid , ** props )
204204 self ._post_editnode (self .nodeid , changed )
205205 # and some nice feedback for the user
@@ -276,14 +276,10 @@ def _post_editnode(self, nid, changes=None):
276276 link = self .db .classes [link ]
277277 link .set (nodeid , ** {property : nid })
278278
279- # TODO: this should be an auditor
280- # see if we want to send a message to the nosy list...
279+ # generate an edit message - nosyreactor will send it
280+ # don't bother if there's no messages or nosy list
281281 props = cl .getprops ()
282- # don't do the message thing if there's no nosy list
283- nosy = 0
284- if props .has_key ('nosy' ):
285- nosy = cl .get (nid , 'nosy' )
286- nosy = len (nosy )
282+ nosy = len (cl .get (nid , 'nosy' , []))
287283 if (nosy and props .has_key ('messages' ) and
288284 isinstance (props ['messages' ], hyperdb .Multilink ) and
289285 props ['messages' ].classname == 'msg' ):
@@ -303,7 +299,6 @@ def _post_editnode(self, nid, changes=None):
303299 summary = 'This %s has been edited through the web.\n ' % cn
304300 m = [summary ]
305301
306- # generate an edit message - nosyreactor will send it
307302 first = 1
308303 for name , prop in props .items ():
309304 if changes is not None and name not in changes : continue
@@ -333,7 +328,7 @@ def _post_editnode(self, nid, changes=None):
333328
334329 # now create the message
335330 content = '\n ' .join (m )
336- message_id = self .db .msg .create (author = self .getuid (),
331+ message_id = self .db .msg .create (author = 'admin' , # self.getuid(),
337332 recipients = [], date = date .Date ('.' ), summary = summary ,
338333 content = content )
339334 messages = cl .get (nid , 'messages' )
@@ -463,7 +458,7 @@ def main(self, dre=re.compile(r'([^\d]+)(\d+)'), nre=re.compile(r'new(\w+)')):
463458 def __del__ (self ):
464459 self .db .close ()
465460
466- def parsePropsFromForm (cl , form , note_changed = 0 ):
461+ def parsePropsFromForm (cl , form , nodeid = 0 ):
467462 '''Pull properties for the given class out of the form.
468463 '''
469464 props = {}
@@ -511,13 +506,17 @@ def parsePropsFromForm(cl, form, note_changed=0):
511506 value = l
512507 props [key ] = value
513508 # if changed, set it
514- if note_changed and value != cl .get (self . nodeid , key ):
509+ if nodeid and value != cl .get (nodeid , key ):
515510 changed .append (key )
516511 props [key ] = value
517512 return props , changed
518513
519514#
520515# $Log: not supported by cvs2svn $
516+ # Revision 1.22 2001/08/17 00:08:10 richard
517+ # reverted back to sending messages always regardless of who is doing the web
518+ # edit. change notes weren't being saved. bleah. hackish.
519+ #
521520# Revision 1.21 2001/08/15 23:43:18 richard
522521# Fixed some isFooTypes that I missed.
523522# Refactored some code in the CGI code.
0 commit comments