From 4b5993b35bcabad42193303ebb33ae9e7c5a6d5d Mon Sep 17 00:00:00 2001 From: Massimo Di Pierro Date: Thu, 12 Jan 2012 14:18:50 -0600 Subject: [PATCH] fixed ignore_common_filters and IS_NOT_IN_DB, thanks Yair --- VERSION | 2 +- gluon/validators.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/VERSION b/VERSION index 66486863..d125550e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 1.99.4 (2012-01-12 14:17:04) stable +Version 1.99.4 (2012-01-12 14:18:47) stable diff --git a/gluon/validators.py b/gluon/validators.py index 29f7b179..36a34ccb 100644 --- a/gluon/validators.py +++ b/gluon/validators.py @@ -513,6 +513,7 @@ class IS_NOT_IN_DB(Validator): field, error_message='value already in database or empty', allowed_override=[], + ignore_common_filters=False, ): from dal import Table @@ -526,7 +527,8 @@ class IS_NOT_IN_DB(Validator): self.error_message = error_message self.record_id = 0 self.allowed_override = allowed_override - + self.ignore_common_filters = ignore_common_filters + def set_self_id(self, id): self.record_id = id @@ -538,7 +540,7 @@ class IS_NOT_IN_DB(Validator): return (value, None) (tablename, fieldname) = str(self.field).split('.') field = self.dbset.db[tablename][fieldname] - rows = self.dbset(field == value).select(limitby=(0, 1)) + rows = self.dbset(field == value, ignore_common_filters = self.ignore_common_filters).select(limitby=(0, 1)) if len(rows) > 0: if isinstance(self.record_id, dict): for f in self.record_id: