comparison roundup/cgi/form_parser.py @ 5248:198b6e810c67

Use Python-3-compatible 'as' syntax for except statements Many raise statements near these are also fixed. So are two ivorrect file encoding marks ('utf8'->'utf-8').
author Eric S. Raymond <esr@thyrsus.com>
date Thu, 24 Aug 2017 22:21:37 -0400
parents 270003714e5f
children 0942fe89e82e
comparison
equal deleted inserted replaced
5247:7f00a47b3559 5248:198b6e810c67
397 raise FormError (self._('Password and confirmation text ' 397 raise FormError (self._('Password and confirmation text '
398 'do not match')) 398 'do not match'))
399 try: 399 try:
400 value = password.Password(value, scheme = proptype.scheme, 400 value = password.Password(value, scheme = proptype.scheme,
401 config=self.db.config) 401 config=self.db.config)
402 except hyperdb.HyperdbValueError, msg: 402 except hyperdb.HyperdbValueError as msg:
403 raise FormError (msg) 403 raise FormError (msg)
404 elif d['file']: 404 elif d['file']:
405 # This needs to be a Multilink and is checked above 405 # This needs to be a Multilink and is checked above
406 fcn = 'file' 406 fcn = 'file'
407 fcl = self.db.classes[fcn] 407 fcl = self.db.classes[fcn]
430 elif isinstance(proptype, hyperdb.Multilink): 430 elif isinstance(proptype, hyperdb.Multilink):
431 # convert input to list of ids 431 # convert input to list of ids
432 try: 432 try:
433 l = hyperdb.rawToHyperdb(self.db, cl, nodeid, 433 l = hyperdb.rawToHyperdb(self.db, cl, nodeid,
434 propname, value) 434 propname, value)
435 except hyperdb.HyperdbValueError, msg: 435 except hyperdb.HyperdbValueError as msg:
436 raise FormError (msg) 436 raise FormError (msg)
437 437
438 # now use that list of ids to modify the multilink 438 # now use that list of ids to modify the multilink
439 if mlaction == 'set': 439 if mlaction == 'set':
440 value = l 440 value = l
481 value.filename is not None): 481 value.filename is not None):
482 value = self.parse_file(propdef, props, value) 482 value = self.parse_file(propdef, props, value)
483 else: 483 else:
484 value = hyperdb.rawToHyperdb(self.db, cl, nodeid, 484 value = hyperdb.rawToHyperdb(self.db, cl, nodeid,
485 propname, value) 485 propname, value)
486 except hyperdb.HyperdbValueError, msg: 486 except hyperdb.HyperdbValueError as msg:
487 raise FormError (msg) 487 raise FormError (msg)
488 488
489 # register that we got this property 489 # register that we got this property
490 if isinstance(proptype, hyperdb.Multilink): 490 if isinstance(proptype, hyperdb.Multilink):
491 if value != []: 491 if value != []:
500 except KeyError: 500 except KeyError:
501 # this might be a new property for which there is 501 # this might be a new property for which there is
502 # no existing value 502 # no existing value
503 if not propdef.has_key(propname): 503 if not propdef.has_key(propname):
504 raise 504 raise
505 except IndexError, message: 505 except IndexError as message:
506 raise FormError(str(message)) 506 raise FormError(str(message))
507 507
508 # make sure the existing multilink is sorted. We must 508 # make sure the existing multilink is sorted. We must
509 # be sure to use the same sort order in all places, 509 # be sure to use the same sort order in all places,
510 # since we want to compare values with "=" or "!=". 510 # since we want to compare values with "=" or "!=".

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