summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Waldon <bcwaldon@gmail.com>2012-12-22 15:28:21 -0800
committerBrian Waldon <bcwaldon@gmail.com>2013-01-21 09:27:49 -0800
commit455fe617d9ff09963806aa020c11a907c8253727 (patch)
treef7a27b96c6400e65eb54d0ad94623b6d5ebd21c2
parentc0e7fba643b69d078ea16ead675432449e4b3185 (diff)
downloadwarlock-455fe617d9ff09963806aa020c11a907c8253727.tar.gz
Rename Model method validator to validate
-rw-r--r--warlock/model.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/warlock/model.py b/warlock/model.py
index 251bd63..15228f7 100644
--- a/warlock/model.py
+++ b/warlock/model.py
@@ -14,7 +14,7 @@ class Model(dict):
d = dict(*args, **kwargs)
try:
- self.validator(d)
+ self.validate(d)
except exceptions.ValidationError as exc:
raise ValueError(str(exc))
else:
@@ -27,7 +27,7 @@ class Model(dict):
mutation = dict(self.items())
mutation[key] = value
try:
- self.validator(mutation)
+ self.validate(mutation)
except exceptions.ValidationError:
msg = "Unable to set '%s' to '%s'" % (key, value)
raise exceptions.InvalidOperation(msg)
@@ -40,7 +40,7 @@ class Model(dict):
mutation = dict(self.items())
del mutation[key]
try:
- self.validator(mutation)
+ self.validate(mutation)
except exceptions.ValidationError:
msg = "Unable to delete attribute '%s'" % (key)
raise exceptions.InvalidOperation(msg)
@@ -77,7 +77,7 @@ class Model(dict):
mutation = dict(self.items())
mutation.update(other)
try:
- self.validator(mutation)
+ self.validate(mutation)
except exceptions.ValidationError as exc:
raise exceptions.InvalidOperation(str(exc))
dict.update(self, other)
@@ -107,7 +107,7 @@ class Model(dict):
"""Dumber version of 'patch' method - this should be deprecated"""
return copy.deepcopy(self.__dict__['changes'])
- def validator(self, obj):
+ def validate(self, obj):
"""Apply a JSON schema to an object"""
try:
jsonschema.validate(obj, self.schema)