Skip to content

Commit b1a0038

Browse files
author
Roche Compaan
committed
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
1 parent 012c1ba commit b1a0038

File tree

3 files changed

+50
-15
lines changed

3 files changed

+50
-15
lines changed

roundup/backends/back_anydbm.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
#$Id: back_anydbm.py,v 1.19 2001-12-17 03:52:48 richard Exp $
18+
#$Id: back_anydbm.py,v 1.20 2001-12-18 15:30:34 rochecompaan Exp $
1919
'''
2020
This module defines a backend that saves the hyperdatabase in a database
2121
chosen by anydbm. It is guaranteed to always be available in python
@@ -272,7 +272,11 @@ def storefile(self, classname, nodeid, property, content):
272272
def getfile(self, classname, nodeid, property):
273273
'''Store the content of the file in the database.
274274
'''
275-
return open(self.filename(classname, nodeid, property), 'rb').read()
275+
filename = self.filename(classname, nodeid, property)
276+
try:
277+
return open(filename, 'rb').read()
278+
except:
279+
return open(filename+'.tmp', 'rb').read()
276280

277281

278282
#
@@ -398,6 +402,13 @@ def rollback(self):
398402

399403
#
400404
#$Log: not supported by cvs2svn $
405+
#Revision 1.19 2001/12/17 03:52:48 richard
406+
#Implemented file store rollback. As a bonus, the hyperdb is now capable of
407+
#storing more than one file per node - if a property name is supplied,
408+
#the file is called designator.property.
409+
#I decided not to migrate the existing files stored over to the new naming
410+
#scheme - the FileClass just doesn't specify the property name.
411+
#
401412
#Revision 1.18 2001/12/16 10:53:38 richard
402413
#take a copy of the node dict so that the subsequent set
403414
#operation doesn't modify the oldvalues structure

roundup/cgi_client.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
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.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 $
1919

2020
__doc__ = """
2121
WWW request handler (also used in the stand-alone server).
@@ -360,10 +360,11 @@ def _changenode(self, props):
360360
unread_id = self.db.status.lookup('unread')
361361
resolved_id = self.db.status.lookup('resolved')
362362
chatting_id = self.db.status.lookup('chatting')
363+
current_status = cl.get(self.nodeid, 'status')
363364
except KeyError:
364365
pass
365366
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):
367368
props['status'] = chatting_id
368369
# add assignedto to the nosy list
369370
if props.has_key('assignedto'):
@@ -536,20 +537,31 @@ def newnode(self, message=None):
536537
self._post_editnode(nid)
537538
# and some nice feedback for the user
538539
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()
539550
except:
540551
self.db.rollback()
541552
s = StringIO.StringIO()
542553
traceback.print_exc(None, s)
543554
message = '<pre>%s</pre>'%cgi.escape(s.getvalue())
544-
self.pagehead(_('New %(classname)s')%{'classname':
545-
self.classname.capitalize()}, message)
555+
else:
556+
self.pagehead(_('New %(classname)s')%{'classname':
557+
self.classname.capitalize()}, message)
546558

547-
# call the template
548-
newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES,
549-
self.classname)
550-
newitem.render(self.form)
559+
# call the template
560+
newitem = htmltemplate.NewItemTemplate(self, self.TEMPLATES,
561+
self.classname)
562+
newitem.render(self.form)
551563

552-
self.pagefoot()
564+
self.pagefoot()
553565
newissue = newnode
554566

555567
def newuser(self, message=None):
@@ -1150,6 +1162,15 @@ def parsePropsFromForm(db, cl, form, nodeid=0):
11501162

11511163
#
11521164
# $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+
#
11531174
# Revision 1.82 2001/12/15 19:24:39 rochecompaan
11541175
# . Modified cgi interface to change properties only once all changes are
11551176
# collected, files created and messages generated.

roundup/mailgw.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373
an exception, the original message is bounced back to the sender with the
7474
explanatory message given in the exception.
7575
76-
$Id: mailgw.py,v 1.43 2001-12-15 19:39:01 rochecompaan Exp $
76+
$Id: mailgw.py,v 1.44 2001-12-18 15:30:34 rochecompaan Exp $
7777
'''
7878

7979

@@ -488,9 +488,9 @@ def handle_message(self, message):
488488
except KeyError:
489489
pass
490490
else:
491-
if (not props.has_key('status') or
492-
props['status'] == unread_id or
493-
props['status'] == resolved_id):
491+
if (not props.has_key('status') and
492+
properties['status'] == unread_id or
493+
properties['status'] == resolved_id):
494494
props['status'] = chatting_id
495495

496496
# 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]+'),
638638

639639
#
640640
# $Log: not supported by cvs2svn $
641+
# Revision 1.43 2001/12/15 19:39:01 rochecompaan
642+
# Oops.
643+
#
641644
# Revision 1.42 2001/12/15 19:24:39 rochecompaan
642645
# . Modified cgi interface to change properties only once all changes are
643646
# collected, files created and messages generated.

0 commit comments

Comments
 (0)