Re: .isset() behaviour change on StringHTMLProperty

"John P. Rouillard" <[email protected]>
Newsgroups gmane.comp.bug-tracking.roundup.user
Message-ID <[email protected]>
Hi Nagy:

In message <20210801020640.73ac1729@Dell>,
Nagy Gabor writes:
>In Roundup 2.1.0, the isset method of StringHTMLProperty of
>cgi/templating.py reports True for empty strings. IIRC, Roundup 2.0.0
>reported False in this case. (Anyway, if I replace templating.py to the
>2.0.0 version, it reports False.)
>
>Is this an intended change?

Nope. That code hasn't changed since 2004-05-10 0.7.1.  But the test
is:

  return self._value is not None

I wonder if something in 2.1.0 changed the representation of an unset
string from None to ""?

One change in 2.1.0 added support for property default_values. At the
end of the HTMLProperty::__init__ I added:

        # if self._value is None see if we have a default value
        if self._value is None:
            self._value = prop.get_default_value()

Can you restore the 2.1.0 copy of templating.py and comment out these
lines.  See if that restores the 2.0.0 behavior.

The default value for default_value is None. Do you define the
property using default_value='' in your schema?

Have a great day.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.