diff options
| author | Adam Groszer <agroszer@gmail.com> | 2014-01-06 14:18:13 +0100 |
|---|---|---|
| committer | Adam Groszer <agroszer@gmail.com> | 2014-01-06 14:18:13 +0100 |
| commit | 3cd600d1c45a110a962ed92126f5ab9e34a3df50 (patch) | |
| tree | 18bff30c228aca9b97737265c70c0096f9a0e566 /src | |
| parent | 9708737e426495e8061e4d6f01558ca1e448984b (diff) | |
| download | zope-schema-3cd600d1c45a110a962ed92126f5ab9e34a3df50.tar.gz | |
It was a pain that ``ConstraintNotSatisfied`` did not tell the field name.
Diffstat (limited to 'src')
| -rw-r--r-- | src/zope/schema/_bootstrapfields.py | 2 | ||||
| -rw-r--r-- | src/zope/schema/_field.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/zope/schema/_bootstrapfields.py b/src/zope/schema/_bootstrapfields.py index 2ed76ce..4109e8f 100644 --- a/src/zope/schema/_bootstrapfields.py +++ b/src/zope/schema/_bootstrapfields.py @@ -210,7 +210,7 @@ class Field(Attribute): raise WrongType(value, self._type, self.__name__) if not self.constraint(value): - raise ConstraintNotSatisfied(value) + raise ConstraintNotSatisfied(value, self.__name__) def get(self, object): return getattr(object, self.__name__) diff --git a/src/zope/schema/_field.py b/src/zope/schema/_field.py index bb5918e..75c8d43 100644 --- a/src/zope/schema/_field.py +++ b/src/zope/schema/_field.py @@ -335,7 +335,7 @@ class Choice(Field): except VocabularyRegistryError: raise ValueError("Can't validate value without vocabulary") if value not in vocabulary: - raise ConstraintNotSatisfied(value) + raise ConstraintNotSatisfied(value, self.__name__) _isuri = r"[a-zA-z0-9+.-]+:" # scheme |
