From ebb559587f8909a81723961f60763bb36e15c086 Mon Sep 17 00:00:00 2001 From: richard Date: Thu, 18 Mar 2004 02:33:15 +0000 Subject: [PATCH] handle bad multilink input at item creation time better (sf bug 917834) git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2152 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 1 + roundup/cgi/templating.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index f0c79f6..a217160 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -79,6 +79,7 @@ Fixed: - existing trackers (ie. live ones) may be used as templates for new trackers - the TEMPLATE-INFO.txt name entry has the tracker's dir name appended (so the demo tracker's template name is "classic-demo") +- handle bad multilink input at item creation time better (sf bug 917834) 2004-03-01 0.6.7 diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index c2635bb..f3789f0 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -294,6 +294,18 @@ def lookupIds(db, prop, ids, fail_ok=False, num_re=re.compile('-?\d+')): l.append(entry) return l +def lookupKeys(linkcl, key, ids, num_re=re.compile('-?\d+')): + ''' Look up the "key" values for "ids" list - though some may already + be key values, not ids. + ''' + l = [] + for entry in ids: + if num_re.match(entry): + l.append(cl.get(entry, key)) + else: + l.append(entry) + return l + class HTMLPermissions: ''' Helpers that provide answers to commonly asked Permission questions. ''' @@ -1538,7 +1550,7 @@ class MultilinkHTMLProperty(HTMLProperty): showid=1 if not showid: k = linkcl.labelprop(1) - value = [linkcl.get(v, k) for v in value] + value = lookupKeys(linkcl, k, value) value = cgi.escape(','.join(value)) return self.input(name=self._formname,size=size,value=value) -- 2.30.2