Roundup Tracker - Issues


Author r.david.murray
Recipients r.david.murray
Date 2014-03-05.20:21:14
Message-id <>
I ran across this fixing the classic query.edit.html template.  There is
a snippet that does:

  query.private_for == None

This is never true, even if the _value of private_for is None.  The
reason is that because the HTMLProperty classes are old style classes,
python looks for an __eq__ method and, when it doesn't find one (because
neither LinkHTMLProperty nor any of its superclasses define one)
LinkHTMLProperty's __getattr__ is called.  That method does:

    if not self._value:
        <construct MissingValue object and look up attr on it)

This is obviously never going to equal None.

I can fix the template by doing 'not query.private_for', since
__nonzero__ is defined by a subclass, but it seems to me that this is a
bug in LinkHTMLProperty.

This could be fixed by making LinkHTMLProperty a new-style class, but I
don't know if that would have any unexpected consequences.
Date User Action Args
2014-03-05 20:21:15r.david.murraysetrecipients: + r.david.murray
2014-03-05 20:21:15r.david.murraysetmessageid: <>
2014-03-05 20:21:15r.david.murraylinkissue2550830 messages
2014-03-05 20:21:14r.david.murraycreate