From e196e229cde21089ea6b4456e0e6926c22661728 Mon Sep 17 00:00:00 2001 From: Florian Schlachter Date: Sat, 17 Apr 2010 01:36:45 +0200 Subject: [PATCH] Accepting a tuple for validation argument. --- mongoengine/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mongoengine/base.py b/mongoengine/base.py index c5f0b554..43a54eea 100644 --- a/mongoengine/base.py +++ b/mongoengine/base.py @@ -85,7 +85,7 @@ class BaseField(object): """Perform validation on a value. """ if self.validation is not None: - if isinstance(self.validation, list) and value not in self.validation: + if (isinstance(self.validation, list) or isinstance(self.validation, tuple)) and value not in self.validation: raise ValidationError('Value not in validation list.') elif callable(self.validation) and not self.validation(value): raise ValidationError('Value does not match custom validation method.')