From 9c41f487866ead142ba9e2328be84e0fe628f1bf Mon Sep 17 00:00:00 2001 From: mdipierro Date: Wed, 5 Dec 2012 14:18:00 -0600 Subject: [PATCH] lazy sqlhtml_validators, fixed issue 931 --- VERSION | 2 +- gluon/dal.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index b6baff7c..ce1f4466 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -Version 2.3.0 (2012-12-05 13:52:46) rc1 +Version 2.3.0 (2012-12-05 14:17:12) rc1 diff --git a/gluon/dal.py b/gluon/dal.py index cfc736b4..093c7004 100644 --- a/gluon/dal.py +++ b/gluon/dal.py @@ -7200,11 +7200,14 @@ def index(): fields = list(fields) + list(common_fields) table_class = args_get('table_class',Table) - table = table_class(self, tablename, *fields, **args) + table = table_class(self, tablename, *fields, **args) table._actual = True self[tablename] = table # must follow above line to handle self references table._create_references() + for field in table: + if field.requires == DEFAULT: + field.requires = sqlhtml_validators(field) migrate = self._migrate_enabled and args_get('migrate',self._migrate) if migrate and not self._uri in (None,'None') \ @@ -7623,8 +7626,6 @@ class Table(object): if db and not field.type in ('text','blob') and \ db._adapter.maxcharlength < field.length: field.length = db._adapter.maxcharlength - if field.requires == DEFAULT: - field.requires = sqlhtml_validators(field) self.ALL = SQLALL(self) if hasattr(self,'_primarykey'):