Export to GitHub

jsonschema - issue #4

Python 2.4 problems


Posted on Nov 24, 2008 by Happy Horse

If these lines will be changed:

# We need to know if the field exists or if it's just Null
fieldexists = True
try:
  value = x[fieldname]
except KeyError:
  fieldexists = False
finally:
  value = x.get(fieldname)

to

# We need to know if the field exists or if it's just Null
fieldexists = fieldname in x
value = x.get(fieldname)

Then jsonschema will work in Python 2.4

Cheers Petr Kobalíček

Comment #1

Posted on Mar 1, 2011 by Happy Camel

I believe this would be better as:

fieldexists = False if x.has_key(fieldname): fieldexists = True value = x[fieldname]

Status: New

Labels:
Type-Defect Priority-Medium