|
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 $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -1008,10 +1008,18 @@ def editItemAction(self): |
1008 | 1008 | # commit now that all the tricky stuff is done |
1009 | 1009 | self.db.commit() |
1010 | 1010 |
|
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), |
1014 | 1018 | urllib.quote(self.template)) |
| 1019 | + if self.nodeid is None: |
| 1020 | + req = HTMLRequest(self) |
| 1021 | + url += '&' + req.indexargs_href('', {})[1:] |
| 1022 | + raise Redirect, url |
1015 | 1023 |
|
1016 | 1024 | def editItemPermission(self, props): |
1017 | 1025 | ''' Determine whether the user has permission to edit this item. |
@@ -1046,7 +1054,7 @@ def newItemAction(self): |
1046 | 1054 | ''' |
1047 | 1055 | # parse the props from the form |
1048 | 1056 | try: |
1049 | | - props, links = self.parsePropsFromForm() |
| 1057 | + props, links = self.parsePropsFromForm(create=True) |
1050 | 1058 | except (ValueError, KeyError), message: |
1051 | 1059 | self.error_message.append(_('Error: ') + str(message)) |
1052 | 1060 | return |
@@ -1455,7 +1463,7 @@ def showAction(self, typere=re.compile('[@:]type'), |
1455 | 1463 | url = '%s%s%s'%(self.db.config.TRACKER_WEB, t, n) |
1456 | 1464 | raise Redirect, url |
1457 | 1465 |
|
1458 | | - def parsePropsFromForm(self, num_re=re.compile('^\d+$')): |
| 1466 | + def parsePropsFromForm(self, create=False, num_re=re.compile('^\d+$')): |
1459 | 1467 | ''' Item properties and their values are edited with html FORM |
1460 | 1468 | variables and their values. You can: |
1461 | 1469 |
|
@@ -1673,6 +1681,10 @@ def parsePropsFromForm(self, num_re=re.compile('^\d+$')): |
1673 | 1681 | # the thing this value relates to is... |
1674 | 1682 | this = (cn, nodeid) |
1675 | 1683 |
|
| 1684 | + # skip implicit create if this isn't a create action |
| 1685 | + if not create and nodeid is None: |
| 1686 | + continue |
| 1687 | + |
1676 | 1688 | # get more info about the class, and the current set of |
1677 | 1689 | # form props for it |
1678 | 1690 | if not all_propdef.has_key(cn): |
|
0 commit comments