Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 6404:e29d5f4e0af4
issue2551132 - Setting form value in query string --- issues
Code now uses value in query string even if there is a default_value
set. Also handle the exception caused by an invalid value specified
in the query string.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Mon, 10 May 2021 16:47:51 -0400 |
| parents | 26e5c42f148c |
| children | 3dbf1bc5e567 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Mon May 10 16:19:37 2021 +0200 +++ b/roundup/cgi/templating.py Mon May 10 16:47:51 2021 -0400 @@ -733,9 +733,8 @@ for klass, htmlklass in propclasses: if not isinstance(prop, klass): continue - value = prop.get_default_value() return htmlklass(self._client, self._classname, None, prop, item, - value, self._anonymous) + None, self._anonymous) # no good raise KeyError(item) @@ -1516,6 +1515,10 @@ value = form.getfirst(self._formname).strip() or None self._value = value + # if self._value is None see if we have a default value + if self._value is None: + self._value = prop.get_default_value() + HTMLInputMixin.__init__(self) def __repr__(self): @@ -2507,7 +2510,14 @@ for optionid in options: # get the option value, and if it's None use an empty string - option = linkcl.get(optionid, k) or '' + try: + option = linkcl.get(optionid, k) or '' + except IndexError: + # optionid does not exist. E.G. + # IndexError: no such queue z + # can be set using ?queue=z in URL for + # a new issue + continue # figure if this option is selected s = ''
