Skip to content

Commit 50cb5ef

Browse files
author
Alexander Smishlajev
committed
fix error in link property lookups with numeric-alike key values
[SF#1424550]
1 parent fcaffea commit 50cb5ef

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Fixed:
66
- failure with browsers not sending "Accept-Language" header (sf bug 1429646)
77
- translate class name in "required property not supplied" error message
88
(sf bug 1429669)
9+
- error in link property lookups with numeric-alike key values (sf bug 1424550)
910

1011

1112
2006-02-10 1.1.0

roundup/cgi/templating.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,13 @@ def lookupIds(db, prop, ids, fail_ok=0, num_re=re.compile('^-?\d+$')):
368368
cl = db.getclass(prop.classname)
369369
l = []
370370
for entry in ids:
371-
if num_re.match(entry):
372-
l.append(entry)
373-
else:
374-
try:
375-
l.append(cl.lookup(entry))
376-
except (TypeError, KeyError):
377-
if fail_ok:
378-
# pass through the bad value
379-
l.append(entry)
371+
try:
372+
l.append(cl.lookup(entry))
373+
except (TypeError, KeyError):
374+
# if fail_ok, ignore lookup error
375+
# otherwise entry must be existing object id rather than key value
376+
if fail_ok or num_re.match(entry):
377+
l.append(entry)
380378
return l
381379

382380
def lookupKeys(linkcl, key, ids, num_re=re.compile('^-?\d+$')):

0 commit comments

Comments
 (0)