Skip to content

Commit 6795335

Browse files
author
Richard Jones
committed
forward-port of fix from maint-0-6
1 parent fe766e3 commit 6795335

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

CHANGES.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,23 @@ Cleanup:
7373
* exceptions.py - all exceptions
7474
* form_parser.py - parsePropsFromForm & extractFormList in a FormParser class
7575

76-
2004-??-?? 0.6.6
76+
77+
2004-??-?? 0.6.7
78+
Fixed:
79+
- made error on create consistent with edit when user enters invalid data
80+
for Multilink and Link form fields (sf bug 904072)
81+
82+
83+
2004-02-25 0.6.6
7784
Fixed:
7885
- don't insert spaces into designators, it just confuses users (sf bug
7986
898087)
8087
- Eudora can't handle utf-8 headers. We love Eudora. (sf bug 900046)
8188
- fixed bug in args to new DateHTMLProperty in the local() method (sf bug
8289
901444)
90+
- fixed registration (sf bug 903283)
91+
- also changed rego to not use a 302 during confirmation, as this seems to
92+
confuse some email clients or browsers.
8393

8494

8595
2004-02-16 0.6.5

roundup/cgi/templating.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ def classes(self):
276276
m.append(HTMLClass(self._client, item))
277277
return r
278278

279-
def lookupIds(db, prop, ids, num_re=re.compile('-?\d+')):
279+
def lookupIds(db, prop, ids, fail_ok=False, num_re=re.compile('-?\d+')):
280+
''' "fail_ok" should be specified if we wish to pass through bad values
281+
(most likely form values that we wish to represent back to the user)
282+
'''
280283
cl = db.getclass(prop.classname)
281284
l = []
282285
for entry in ids:
@@ -285,9 +288,10 @@ def lookupIds(db, prop, ids, num_re=re.compile('-?\d+')):
285288
else:
286289
try:
287290
l.append(cl.lookup(entry))
288-
except KeyError:
289-
# ignore invalid keys
290-
pass
291+
except (TypeError, KeyError):
292+
if fail_ok:
293+
# pass through the bad value
294+
l.append(entry)
291295
return l
292296

293297
class HTMLPermissions:
@@ -382,11 +386,12 @@ def __getitem__(self, item):
382386
if form.has_key(item):
383387
if isinstance(prop, hyperdb.Multilink):
384388
value = lookupIds(self._db, prop,
385-
handleListCGIValue(form[item]))
389+
handleListCGIValue(form[item]), fail_ok=True)
386390
elif isinstance(prop, hyperdb.Link):
387391
value = form[item].value.strip()
388392
if value:
389-
value = lookupIds(self._db, prop, [value])[0]
393+
value = lookupIds(self._db, prop, [value],
394+
fail_ok=True)[0]
390395
else:
391396
value = None
392397
else:

0 commit comments

Comments
 (0)