diff roundup/cgi/templating.py @ 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 f6719836e521
children 32343bfc3da0
line wrap: on
line diff
--- 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/