fixed problem with lazy tables and self references
This commit is contained in:
@@ -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
@@ -7174,7 +7174,12 @@ def index():
|
|||||||
table = table_class(self, tablename, *fields, **args)
|
table = table_class(self, tablename, *fields, **args)
|
||||||
table._actual = True
|
table._actual = True
|
||||||
self[tablename] = table
|
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)
|
migrate = self._migrate_enabled and args_get('migrate',self._migrate)
|
||||||
if migrate and not self._uri in (None,'None') \
|
if migrate and not self._uri in (None,'None') \
|
||||||
@@ -7591,7 +7596,10 @@ class Table(object):
|
|||||||
db._adapter.maxcharlength < field.length:
|
db._adapter.maxcharlength < field.length:
|
||||||
field.length = db._adapter.maxcharlength
|
field.length = db._adapter.maxcharlength
|
||||||
if field.requires == DEFAULT:
|
if field.requires == DEFAULT:
|
||||||
field.requires = sqlhtml_validators(field)
|
try:
|
||||||
|
field.requires = sqlhtml_validators(field)
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
self.ALL = SQLALL(self)
|
self.ALL = SQLALL(self)
|
||||||
|
|
||||||
if hasattr(self,'_primarykey'):
|
if hasattr(self,'_primarykey'):
|
||||||
|
|||||||
+8
-8
@@ -457,14 +457,14 @@ def wsgibase(environ, responder):
|
|||||||
x_req_with = str(env.http_x_requested_with).lower()
|
x_req_with = str(env.http_x_requested_with).lower()
|
||||||
|
|
||||||
request.update(
|
request.update(
|
||||||
client=client,
|
client = client,
|
||||||
folder=abspath('applications', app) + os.sep,
|
folder = abspath('applications', app) + os.sep,
|
||||||
ajax=x_req_with == 'xmlhttprequest',
|
ajax = x_req_with == 'xmlhttprequest',
|
||||||
cid=env.http_web2py_component_element,
|
cid = env.http_web2py_component_element,
|
||||||
is_local=env.remote_addr in local_hosts,
|
is_local = env.remote_addr in local_hosts,
|
||||||
is_https=env.wsgi_url_scheme in HTTPS_SCHEMES
|
is_https = env.wsgi_url_scheme in HTTPS_SCHEMES or \
|
||||||
or request.env.http_x_forwarded_proto in HTTPS_SCHEMES
|
request.env.http_x_forwarded_proto in HTTPS_SCHEMES \
|
||||||
or env.https == 'on')
|
or env.https == 'on')
|
||||||
request.compute_uuid() # requires client
|
request.compute_uuid() # requires client
|
||||||
request.url = environ['PATH_INFO']
|
request.url = environ['PATH_INFO']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user