From: rochecompaan Date: Tue, 18 Dec 2001 15:30:34 +0000 (+0000) Subject: Fixed bugs: X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=52c4073ff97774929896dfc1c347c42c78f46dbb;p=roundup.git 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 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@476 57a73879-2fb5-44c3-a270-3262357dd7e2 --- diff --git a/roundup/backends/back_anydbm.py b/roundup/backends/back_anydbm.py index 0d52750..b6226aa 100644 --- a/roundup/backends/back_anydbm.py +++ b/roundup/backends/back_anydbm.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: back_anydbm.py,v 1.19 2001-12-17 03:52:48 richard Exp $ +#$Id: back_anydbm.py,v 1.20 2001-12-18 15:30:34 rochecompaan Exp $ ''' This module defines a backend that saves the hyperdatabase in a database chosen by anydbm. It is guaranteed to always be available in python @@ -272,7 +272,11 @@ class Database(hyperdb.Database): def getfile(self, classname, nodeid, property): '''Store the content of the file in the database. ''' - return open(self.filename(classname, nodeid, property), 'rb').read() + filename = self.filename(classname, nodeid, property) + try: + return open(filename, 'rb').read() + except: + return open(filename+'.tmp', 'rb').read() # @@ -398,6 +402,13 @@ class Database(hyperdb.Database): # #$Log: not supported by cvs2svn $ +#Revision 1.19 2001/12/17 03:52:48 richard +#Implemented file store rollback. As a bonus, the hyperdb is now capable of +#storing more than one file per node - if a property name is supplied, +#the file is called designator.property. +#I decided not to migrate the existing files stored over to the new naming +#scheme - the FileClass just doesn't specify the property name. +# #Revision 1.18 2001/12/16 10:53:38 richard #take a copy of the node dict so that the subsequent set #operation doesn't modify the oldvalues structure diff --git a/roundup/cgi_client.py b/roundup/cgi_client.py index f47da62..e3dee1c 100644 --- a/roundup/cgi_client.py +++ b/roundup/cgi_client.py @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: cgi_client.py,v 1.83 2001-12-15 23:51:01 richard Exp $ +# $Id: cgi_client.py,v 1.84 2001-12-18 15:30:30 rochecompaan Exp $ __doc__ = """ WWW request handler (also used in the stand-alone server). @@ -360,10 +360,11 @@ class Client: unread_id = self.db.status.lookup('unread') resolved_id = self.db.status.lookup('resolved') chatting_id = self.db.status.lookup('chatting') + current_status = cl.get(self.nodeid, 'status') except KeyError: pass else: - if (props['status'] == unread_id or props['status'] == resolved_id): + if (props['status'] == unread_id or props['status'] == resolved_id and current_status == resolved_id): props['status'] = chatting_id # add assignedto to the nosy list if props.has_key('assignedto'): @@ -536,20 +537,31 @@ class Client: self._post_editnode(nid) # and some nice feedback for the user message = _('%(classname)s created ok')%{'classname': cn} + + self.db.commit() + # render the newly created issue + self.nodeid = nid + self.pagehead('%s: %s'%(self.classname.capitalize(), nid), + message) + item = htmltemplate.ItemTemplate(self, self.TEMPLATES, + self.classname) + item.render(nid) + self.pagefoot() except: self.db.rollback() s = StringIO.StringIO() traceback.print_exc(None, s) message = '
%s
'%cgi.escape(s.getvalue()) - self.pagehead(_('New %(classname)s')%{'classname': - self.classname.capitalize()}, message) + else: + self.pagehead(_('New %(classname)s')%{'classname': + self.classname.capitalize()}, message) - # call the template - newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES, - self.classname) - newitem.render(self.form) + # call the template + newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES, + self.classname) + newitem.render(self.form) - self.pagefoot() + self.pagefoot() newissue = newnode def newuser(self, message=None): @@ -1150,6 +1162,15 @@ def parsePropsFromForm(db, cl, form, nodeid=0): # # $Log: not supported by cvs2svn $ +# Revision 1.83 2001/12/15 23:51:01 richard +# Tested the changes and fixed a few problems: +# . files are now attached to the issue as well as the message +# . newuser is a real method now since we don't want to do the message/file +# stuff for it +# . added some documentation +# The really big changes in the diff are a result of me moving some code +# around to keep like methods together a bit better. +# # Revision 1.82 2001/12/15 19:24:39 rochecompaan # . Modified cgi interface to change properties only once all changes are # collected, files created and messages generated. diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 22dc1f9..f533c75 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -73,7 +73,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.43 2001-12-15 19:39:01 rochecompaan Exp $ +$Id: mailgw.py,v 1.44 2001-12-18 15:30:34 rochecompaan Exp $ ''' @@ -488,9 +488,9 @@ not find a text/plain part to use. except KeyError: pass else: - if (not props.has_key('status') or - props['status'] == unread_id or - props['status'] == resolved_id): + if (not props.has_key('status') and + properties['status'] == unread_id or + properties['status'] == resolved_id): props['status'] = chatting_id # add nosy in arguments to issue's nosy list @@ -638,6 +638,9 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'), # # $Log: not supported by cvs2svn $ +# Revision 1.43 2001/12/15 19:39:01 rochecompaan +# Oops. +# # Revision 1.42 2001/12/15 19:24:39 rochecompaan # . Modified cgi interface to change properties only once all changes are # collected, files created and messages generated.