Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 6620:b7093aa16895
issue2551196 - Unset labelprop of a Multilink can lead to Python error when using context/history
Fix history by adding default string value to calls to
link_class.get(). Mark as translatable string. Include originally
identified multilink path and apply same fix to link path.
Also fix a possible issue in the plain() display paths for
link/multilink the same way if the label is missing.
Update translation files.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sat, 05 Mar 2022 18:55:50 -0500 |
| parents | e70e2789bc2c |
| children | e1588ae185dc 408fd477761f |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Tue Feb 22 09:22:43 2022 -0500 +++ b/roundup/cgi/templating.py Sat Mar 05 18:55:50 2022 -0500 @@ -1244,7 +1244,9 @@ try: if labelprop is not None and \ labelprop != 'id': - label = linkcl.get(linkid, labelprop) + label = linkcl.get(linkid, labelprop, + default=self._( + "[label is missing]")) label = html_escape(label) except IndexError: comments['no_link'] = self._( @@ -1271,7 +1273,8 @@ if labelprop is not None and labelprop != 'id': try: label = html_escape(linkcl.get(args[k], - labelprop)) + labelprop, default=self._( + "[label is missing]"))) except IndexError: comments['no_link'] = self._( "<strike>The linked node" @@ -2398,7 +2401,8 @@ k = linkcl.labelprop(1) if num_re.match(self._value): try: - value = str(linkcl.get(self._value, k)) + value = str(linkcl.get(self._value, k, + default=self._("[label is missing]"))) except IndexError: value = self._value else : @@ -2696,7 +2700,8 @@ for v in self._value: if num_re.match(v): try: - label = linkcl.get(v, k) + label = linkcl.get(v, k, + default=self._("[label is missing]")) except IndexError: label = None # fall back to designator if label is None
