fixed problem with lazy tables and self references

This commit is contained in:
mdipierro
2012-11-29 23:54:29 -06:00
parent 792b313891
commit b6947c5f25
3 changed files with 19 additions and 11 deletions
+10 -2
View File
@@ -7174,7 +7174,12 @@ def index():
table = table_class(self, tablename, *fields, **args)
table._actual = True
self[tablename] = table
table._create_references() # must follow above line to handle self references
# fix self refrences
for field in table:
if field.requires == DEFAULT:
field.requires = sqlhtml_validators(field)
# must follow above line to handle self references
table._create_references()
migrate = self._migrate_enabled and args_get('migrate',self._migrate)
if migrate and not self._uri in (None,'None') \
@@ -7591,7 +7596,10 @@ class Table(object):
db._adapter.maxcharlength < field.length:
field.length = db._adapter.maxcharlength
if field.requires == DEFAULT:
field.requires = sqlhtml_validators(field)
try:
field.requires = sqlhtml_validators(field)
except AttributeError:
pass
self.ALL = SQLALL(self)
if hasattr(self,'_primarykey'):