Skip to content

Commit 5eff730

Browse files
author
Richard Jones
committed
fixed edit action / parsePropsFromForm to handle index-page edits better
1 parent c624860 commit 5eff730

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Fixed:
1616
- fix re-enabling queries (sf bug 861940)
1717
- use supplied content-type on file uploads before trying filename)
1818
- fixed roundup-reminder script to use default schema (thanks Klamer Schutte)
19+
- fixed edit action / parsePropsFromForm to handle index-page edits better
1920

2021

2122
2003-12-17 0.6.4

roundup/cgi/client.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.130.2.7 2004-01-21 04:54:27 richard Exp $
1+
# $Id: client.py,v 1.130.2.8 2004-02-13 01:13:25 richard Exp $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -1008,10 +1008,18 @@ def editItemAction(self):
10081008
# commit now that all the tricky stuff is done
10091009
self.db.commit()
10101010

1011-
# redirect to the item's edit page
1012-
raise Redirect, '%s%s%s?@ok_message=%s&@template=%s'%(self.base,
1013-
self.classname, self.nodeid, urllib.quote(message),
1011+
# redirect to finish off
1012+
url = self.base + self.classname
1013+
# note that this action might have been called by an index page, so
1014+
# we will want to include index-page args in this URL too
1015+
if self.nodeid is not None:
1016+
url += self.nodeid
1017+
url += '?@ok_message=%s&@template=%s'%(urllib.quote(message),
10141018
urllib.quote(self.template))
1019+
if self.nodeid is None:
1020+
req = HTMLRequest(self)
1021+
url += '&' + req.indexargs_href('', {})[1:]
1022+
raise Redirect, url
10151023

10161024
def editItemPermission(self, props):
10171025
''' Determine whether the user has permission to edit this item.
@@ -1046,7 +1054,7 @@ def newItemAction(self):
10461054
'''
10471055
# parse the props from the form
10481056
try:
1049-
props, links = self.parsePropsFromForm()
1057+
props, links = self.parsePropsFromForm(create=True)
10501058
except (ValueError, KeyError), message:
10511059
self.error_message.append(_('Error: ') + str(message))
10521060
return
@@ -1455,7 +1463,7 @@ def showAction(self, typere=re.compile('[@:]type'),
14551463
url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n)
14561464
raise Redirect, url
14571465

1458-
def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
1466+
def parsePropsFromForm(self, create=False, num_re=re.compile('^\d+$')):
14591467
''' Item properties and their values are edited with html FORM
14601468
variables and their values. You can:
14611469
@@ -1673,6 +1681,10 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')):
16731681
# the thing this value relates to is...
16741682
this = (cn, nodeid)
16751683

1684+
# skip implicit create if this isn't a create action
1685+
if not create and nodeid is None:
1686+
continue
1687+
16761688
# get more info about the class, and the current set of
16771689
# form props for it
16781690
if not all_propdef.has_key(cn):

0 commit comments

Comments
 (0)