From 5e028384e80c6deb4e85aec2198325415dd76331 Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 25 Feb 2004 09:40:46 +0000 Subject: [PATCH] forward-port of fix from maint-0-6 git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2118 57a73879-2fb5-44c3-a270-3262357dd7e2 --- CHANGES.txt | 12 +++++++++++- roundup/cgi/templating.py | 17 +++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index 5c8a5fc..60abfcb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -73,13 +73,23 @@ Cleanup: * exceptions.py - all exceptions * form_parser.py - parsePropsFromForm & extractFormList in a FormParser class -2004-??-?? 0.6.6 + +2004-??-?? 0.6.7 +Fixed: +- made error on create consistent with edit when user enters invalid data + for Multilink and Link form fields (sf bug 904072) + + +2004-02-25 0.6.6 Fixed: - don't insert spaces into designators, it just confuses users (sf bug 898087) - Eudora can't handle utf-8 headers. We love Eudora. (sf bug 900046) - fixed bug in args to new DateHTMLProperty in the local() method (sf bug 901444) +- fixed registration (sf bug 903283) +- also changed rego to not use a 302 during confirmation, as this seems to + confuse some email clients or browsers. 2004-02-16 0.6.5 diff --git a/roundup/cgi/templating.py b/roundup/cgi/templating.py index 225563e..de9d096 100644 --- a/roundup/cgi/templating.py +++ b/roundup/cgi/templating.py @@ -276,7 +276,10 @@ class HTMLDatabase: m.append(HTMLClass(self._client, item)) return r -def lookupIds(db, prop, ids, num_re=re.compile('-?\d+')): +def lookupIds(db, prop, ids, fail_ok=False, num_re=re.compile('-?\d+')): + ''' "fail_ok" should be specified if we wish to pass through bad values + (most likely form values that we wish to represent back to the user) + ''' cl = db.getclass(prop.classname) l = [] for entry in ids: @@ -285,9 +288,10 @@ def lookupIds(db, prop, ids, num_re=re.compile('-?\d+')): else: try: l.append(cl.lookup(entry)) - except KeyError: - # ignore invalid keys - pass + except (TypeError, KeyError): + if fail_ok: + # pass through the bad value + l.append(entry) return l class HTMLPermissions: @@ -382,11 +386,12 @@ class HTMLClass(HTMLInputMixin, HTMLPermissions): if form.has_key(item): if isinstance(prop, hyperdb.Multilink): value = lookupIds(self._db, prop, - handleListCGIValue(form[item])) + handleListCGIValue(form[item]), fail_ok=True) elif isinstance(prop, hyperdb.Link): value = form[item].value.strip() if value: - value = lookupIds(self._db, prop, [value])[0] + value = lookupIds(self._db, prop, [value], + fail_ok=True)[0] else: value = None else: -- 2.30.2