Roundup Tracker - Issues

Message7453

Author ngaba
Recipients ngaba
Date 2022-02-17.22:38:12
Message-id <1645137493.03.0.798059019041.issue2551196@roundup.psfhosted.org>
In-reply-to
When the history renderer of the web interface wants to print the change of a multilink property in the form
"propname: + added_item",
e.g.
"documents: + mydocument.docx",
it will crash, if the label property of the newly linked item is None. And in this case we get a cryptic error message in the browser (see the attached file error.log), which requires some time to debug.

I agree that no item should have empty labelprop, but users can do strange things... (In my scenario, the user made a filename empty.)

The problem is in the history() method of _HTMLItem class in cgi/templating.py (lines 1241-1248):
                                # if we have a label property, try to use it
                                # TODO: test for node existence even when
                                # there's no labelprop!
                                try:
                                    if labelprop is not None and \
                                            labelprop != 'id':
                                        label = linkcl.get(linkid, labelprop)
                                        label = html_escape(label)

Here html_escape(None) leads to an unhandled exception. I've added an
if label is None:
    label = "[empty]"
block before calling html_escape() as a workaround, and it is fixed my issue. I note that setting a default_value for the multilinked Class in schema.py does not help either, because the above code ignores default_value...
History
Date User Action Args
2022-02-17 22:38:13ngabasetrecipients: + ngaba
2022-02-17 22:38:13ngabasetmessageid: <1645137493.03.0.798059019041.issue2551196@roundup.psfhosted.org>
2022-02-17 22:38:12ngabalinkissue2551196 messages
2022-02-17 22:38:12ngabacreate