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
+1 -1
View File
@@ -1 +1 @@
Version 2.2.1 (2012-11-29 22:34:41) stable
Version 2.2.1 (2012-11-29 23:53:48) stable
+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'):
+8 -8
View File
@@ -457,14 +457,14 @@ def wsgibase(environ, responder):
x_req_with = str(env.http_x_requested_with).lower()
request.update(
client=client,
folder=abspath('applications', app) + os.sep,
ajax=x_req_with == 'xmlhttprequest',
cid=env.http_web2py_component_element,
is_local=env.remote_addr in local_hosts,
is_https=env.wsgi_url_scheme in HTTPS_SCHEMES
or request.env.http_x_forwarded_proto in HTTPS_SCHEMES
or env.https == 'on')
client = client,
folder = abspath('applications', app) + os.sep,
ajax = x_req_with == 'xmlhttprequest',
cid = env.http_web2py_component_element,
is_local = env.remote_addr in local_hosts,
is_https = env.wsgi_url_scheme in HTTPS_SCHEMES or \
request.env.http_x_forwarded_proto in HTTPS_SCHEMES \
or env.https == 'on')
request.compute_uuid() # requires client
request.url = environ['PATH_INFO']