f = open(file_to_read, 'r')
read_data = f.read()
f.close()
- except Exception,e:
+ except Exception as e:
return (False, str(e))
return (True, read_data)
f = open(file_to_write, 'w')
f.write(text)
f.close()
- except Exception,e:
+ except Exception as e:
return (False, str(e))
return (True, None)
js_v(client_data, schema)
#print "Input data: ", str(client_data)
return True, client_data
- except js_e.ValidationError, exc:
+ except js_e.ValidationError as exc:
print "validate_in error, jsonschema exception ", exc.message, "at", exc.path
return False, ("validate_in error, jsonschema exception ", exc.message, "at", exc.path)
def check_valid_uuid(uuid):
id_schema = {"type" : "string", "pattern": "^[a-fA-F0-9]{8}(-[a-fA-F0-9]{4}){3}-[a-fA-F0-9]{12}$"}
+ id_schema2 = {"type" : "string", "pattern": "^[a-fA-F0-9]{32}$"}
try:
js_v(uuid, id_schema)
return True
except js_e.ValidationError:
- return False
+ try:
+ js_v(uuid, id_schema2)
+ return True
+ except js_e.ValidationError:
+ return False
+ return False