changeset 3562:a27124aceb69

fix error in link property lookups with numeric-alike key values [SF#1424550]
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Sun, 12 Feb 2006 13:11:14 +0000
parents d5661a933cbe
children 7000070fe600
files CHANGES.txt roundup/cgi/templating.py
diffstat 2 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES.txt	Sun Feb 12 11:56:33 2006 +0000
+++ b/CHANGES.txt	Sun Feb 12 13:11:14 2006 +0000
@@ -6,6 +6,7 @@
 - failure with browsers not sending "Accept-Language" header (sf bug 1429646)
 - translate class name in "required property not supplied" error message
   (sf bug 1429669)
+- error in link property lookups with numeric-alike key values (sf bug 1424550)
 
 
 2006-02-10 1.1.0
--- a/roundup/cgi/templating.py	Sun Feb 12 11:56:33 2006 +0000
+++ b/roundup/cgi/templating.py	Sun Feb 12 13:11:14 2006 +0000
@@ -368,15 +368,13 @@
     cl = db.getclass(prop.classname)
     l = []
     for entry in ids:
-        if num_re.match(entry):
-            l.append(entry)
-        else:
-            try:
-                l.append(cl.lookup(entry))
-            except (TypeError, KeyError):
-                if fail_ok:
-                    # pass through the bad value
-                    l.append(entry)
+        try:
+            l.append(cl.lookup(entry))
+        except (TypeError, KeyError):
+            # if fail_ok, ignore lookup error
+            # otherwise entry must be existing object id rather than key value
+            if fail_ok or num_re.match(entry):
+                l.append(entry)
     return l
 
 def lookupKeys(linkcl, key, ids, num_re=re.compile('^-?\d+$')):

Roundup Issue Tracker: http://roundup-tracker.org/