comparison roundup/cgi_client.py @ 464:29f5ac8a0d2b

Fixed bugs: . Fixed file creation and retrieval in same transaction in anydbm backend . Cgi interface now renders new issue after issue creation . Could not set issue status to resolved through cgi interface . Mail gateway was changing status back to 'chatting' if status was omitted as an argument
author Roche Compaan <rochecompaan@users.sourceforge.net>
date Tue, 18 Dec 2001 15:30:34 +0000
parents 65a8f4fd5485
children a3548136f7bb
comparison
equal deleted inserted replaced
463:045f7fcc2c0f 464:29f5ac8a0d2b
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 # $Id: cgi_client.py,v 1.83 2001-12-15 23:51:01 richard Exp $ 18 # $Id: cgi_client.py,v 1.84 2001-12-18 15:30:30 rochecompaan Exp $
19 19
20 __doc__ = """ 20 __doc__ = """
21 WWW request handler (also used in the stand-alone server). 21 WWW request handler (also used in the stand-alone server).
22 """ 22 """
23 23
358 try: 358 try:
359 # determine the id of 'unread','resolved' and 'chatting' 359 # determine the id of 'unread','resolved' and 'chatting'
360 unread_id = self.db.status.lookup('unread') 360 unread_id = self.db.status.lookup('unread')
361 resolved_id = self.db.status.lookup('resolved') 361 resolved_id = self.db.status.lookup('resolved')
362 chatting_id = self.db.status.lookup('chatting') 362 chatting_id = self.db.status.lookup('chatting')
363 current_status = cl.get(self.nodeid, 'status')
363 except KeyError: 364 except KeyError:
364 pass 365 pass
365 else: 366 else:
366 if (props['status'] == unread_id or props['status'] == resolved_id): 367 if (props['status'] == unread_id or props['status'] == resolved_id and current_status == resolved_id):
367 props['status'] = chatting_id 368 props['status'] = chatting_id
368 # add assignedto to the nosy list 369 # add assignedto to the nosy list
369 if props.has_key('assignedto'): 370 if props.has_key('assignedto'):
370 assignedto_id = props['assignedto'] 371 assignedto_id = props['assignedto']
371 if assignedto_id not in props['nosy']: 372 if assignedto_id not in props['nosy']:
534 nid = self._createnode() 535 nid = self._createnode()
535 # handle linked nodes 536 # handle linked nodes
536 self._post_editnode(nid) 537 self._post_editnode(nid)
537 # and some nice feedback for the user 538 # and some nice feedback for the user
538 message = _('%(classname)s created ok')%{'classname': cn} 539 message = _('%(classname)s created ok')%{'classname': cn}
540
541 self.db.commit()
542 # render the newly created issue
543 self.nodeid = nid
544 self.pagehead('%s: %s'%(self.classname.capitalize(), nid),
545 message)
546 item = htmltemplate.ItemTemplate(self, self.TEMPLATES,
547 self.classname)
548 item.render(nid)
549 self.pagefoot()
539 except: 550 except:
540 self.db.rollback() 551 self.db.rollback()
541 s = StringIO.StringIO() 552 s = StringIO.StringIO()
542 traceback.print_exc(None, s) 553 traceback.print_exc(None, s)
543 message = '<pre>%s</pre>'%cgi.escape(s.getvalue()) 554 message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
544 self.pagehead(_('New %(classname)s')%{'classname': 555 else:
545 self.classname.capitalize()}, message) 556 self.pagehead(_('New %(classname)s')%{'classname':
546 557 self.classname.capitalize()}, message)
547 # call the template 558
548 newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES, 559 # call the template
549 self.classname) 560 newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES,
550 newitem.render(self.form) 561 self.classname)
551 562 newitem.render(self.form)
552 self.pagefoot() 563
564 self.pagefoot()
553 newissue = newnode 565 newissue = newnode
554 566
555 def newuser(self, message=None): 567 def newuser(self, message=None):
556 ''' Add a new user to the database. 568 ''' Add a new user to the database.
557 569
1148 props[key] = value 1160 props[key] = value
1149 return props, changed 1161 return props, changed
1150 1162
1151 # 1163 #
1152 # $Log: not supported by cvs2svn $ 1164 # $Log: not supported by cvs2svn $
1165 # Revision 1.83 2001/12/15 23:51:01 richard
1166 # Tested the changes and fixed a few problems:
1167 # . files are now attached to the issue as well as the message
1168 # . newuser is a real method now since we don't want to do the message/file
1169 # stuff for it
1170 # . added some documentation
1171 # The really big changes in the diff are a result of me moving some code
1172 # around to keep like methods together a bit better.
1173 #
1153 # Revision 1.82 2001/12/15 19:24:39 rochecompaan 1174 # Revision 1.82 2001/12/15 19:24:39 rochecompaan
1154 # . Modified cgi interface to change properties only once all changes are 1175 # . Modified cgi interface to change properties only once all changes are
1155 # collected, files created and messages generated. 1176 # collected, files created and messages generated.
1156 # . Moved generation of change note to nosyreactors. 1177 # . Moved generation of change note to nosyreactors.
1157 # . We now check for changes to "assignedto" to ensure it's added to the 1178 # . We now check for changes to "assignedto" to ensure it's added to the

Roundup Issue Tracker: http://roundup-tracker.org/