comparison roundup/cgi/form_parser.py @ 3491:0e5f15520e70

fix detection of "missing" existing values in CGI form parser [SF#1414149]
author Richard Jones <richard@users.sourceforge.net>
date Wed, 25 Jan 2006 02:24:28 +0000
parents 9ffea8719af1
children 4b80c330f02b
comparison
equal deleted inserted replaced
3490:976bd292eaa0 3491:0e5f15520e70
461 if isinstance(proptype, hyperdb.Multilink): 461 if isinstance(proptype, hyperdb.Multilink):
462 existing.sort() 462 existing.sort()
463 463
464 # "missing" existing values may not be None 464 # "missing" existing values may not be None
465 if not existing: 465 if not existing:
466 if isinstance(proptype, hyperdb.String) and not existing: 466 if isinstance(proptype, hyperdb.String):
467 # some backends store "missing" Strings as empty strings 467 # some backends store "missing" Strings as empty strings
468 existing = None 468 if existing == self.db.BACKEND_MISSING_STRING:
469 elif isinstance(proptype, hyperdb.Number) and not existing: 469 existing = None
470 elif isinstance(proptype, hyperdb.Number):
470 # some backends store "missing" Numbers as 0 :( 471 # some backends store "missing" Numbers as 0 :(
471 existing = 0 472 if existing == self.db.BACKEND_MISSING_NUMBER:
472 elif isinstance(proptype, hyperdb.Boolean) and not existing: 473 existing = None
474 elif isinstance(proptype, hyperdb.Boolean):
473 # likewise Booleans 475 # likewise Booleans
474 existing = 0 476 if existing == self.db.BACKEND_MISSING_BOOLEAN:
477 existing = None
475 478
476 # if changed, set it 479 # if changed, set it
477 if value != existing: 480 if value != existing:
478 props[propname] = value 481 props[propname] = value
479 else: 482 else:

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