From 7e245e3fbe9fff7e0541580f3a5ea850931cd255 Mon Sep 17 00:00:00 2001 From: mdipierro Date: Tue, 18 Jun 2013 07:23:01 -0500 Subject: [PATCH] partial fix for issue 1531, disable validation in crud search --- VERSION | 2 +- gluon/tools.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 6e3bbb16..cb8c9da8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.5.1-stable+timestamp.2013.06.18.06.29.26 +Version 2.5.1-stable+timestamp.2013.06.18.07.22.19 diff --git a/gluon/tools.py b/gluon/tools.py index 12cd090e..fe00ee70 100644 --- a/gluon/tools.py +++ b/gluon/tools.py @@ -3906,6 +3906,7 @@ class Crud(object): """ table = tables[0] fields = args.get('fields', table.fields) + validate = args.get('validate',True) request = current.request db = self.db if not (isinstance(table, db.Table) or table in db.tables): @@ -3960,13 +3961,15 @@ class Crud(object): if field.type[0:10] == 'reference ': refsearch.append(self.get_query(field, opval, txtval, refsearch=True)) - else: + elif validate: value, error = field.validate(txtval) if not error: ### TODO deal with 'starts with', 'ends with', 'contains' on GAE query &= self.get_query(field, opval, value) else: row[3].append(DIV(error, _class='error')) + else: + query &= self.get_query(field, opval, txtval) selected.append(field) form = FORM(tbl, INPUT(_type="submit")) if selected: