Message7547
On Mon, May 30, 2022 at 09:27:02PM +0000, John Rouillard wrote:
>
> John Rouillard added the comment:
>
> Ralf, is this a case I missed in issue2551120?
The Traceback is the same but the code-path is different. The relevant
code is in the 'list' method of HTMLClass in cgi/templating.py:
def list(self, sort_on=None):
""" List all items in this class.
"""
# get the list and sort it nicely
l = self._klass.list()
keyfunc = make_key_function(self._db, self._classname, sort_on)
l.sort(key=keyfunc)
The make_key_function:
def make_key_function(db, classname, sort_on=None):
[...]
linkcl = db.getclass(classname)
if sort_on is None:
sort_on = linkcl.orderprop()
def keyfunc(a):
if num_re.match(a):
a = linkcl.get(a, sort_on)
# In Python3 we may not compare strings and None
if a is None :
return ''
return a
The 'if a is None' part is new. [Oops the spacing is wrong.]
What it does is look up the order attribute (or whatever was given as a
sort_on parameter) of the numeric ID (the parameter 'a').
So this is a different code-path with the same bug (one could argue that
the bug is in python3 refusing to compare different types).
Ralf
--
Dr. Ralf Schlatterbeck Tel: +43/2243/26465-16
Open Source Consulting www: www.runtux.com
Reichergasse 131, A-3411 Weidling email: office@runtux.com |
|
Date |
User |
Action |
Args |
2022-05-31 07:24:56 | schlatterbeck | set | recipients:
+ schlatterbeck, rouilj |
2022-05-31 07:24:56 | schlatterbeck | link | issue2551207 messages |
2022-05-31 07:24:56 | schlatterbeck | create | |
|