caching read_pyc for controllers and models
This commit is contained in:
+3
-2
@@ -581,7 +581,7 @@ def run_models_in(environment):
|
|||||||
if not regex.search(fname) and c != 'appadmin':
|
if not regex.search(fname) and c != 'appadmin':
|
||||||
continue
|
continue
|
||||||
elif compiled:
|
elif compiled:
|
||||||
code = read_pyc(model)
|
code = getcfs(model, model, lambda: read_pyc(model))
|
||||||
elif is_gae:
|
elif is_gae:
|
||||||
code = getcfs(model, model,
|
code = getcfs(model, model,
|
||||||
lambda: compile2(read_file(model), model))
|
lambda: compile2(read_file(model), model))
|
||||||
@@ -614,7 +614,8 @@ def run_controller_in(controller, function, environment):
|
|||||||
raise HTTP(404,
|
raise HTTP(404,
|
||||||
rewrite.THREAD_LOCAL.routes.error_message % badf,
|
rewrite.THREAD_LOCAL.routes.error_message % badf,
|
||||||
web2py_error=badf)
|
web2py_error=badf)
|
||||||
restricted(read_pyc(filename), environment, layer=filename)
|
code = getcfs(filename, filename, lambda: read_pyc(filename))
|
||||||
|
restricted(code, environment, layer=filename)
|
||||||
elif function == '_TEST':
|
elif function == '_TEST':
|
||||||
# TESTING: adjust the path to include site packages
|
# TESTING: adjust the path to include site packages
|
||||||
from settings import global_settings
|
from settings import global_settings
|
||||||
|
|||||||
+1
-1
@@ -199,7 +199,7 @@ class RestrictedError(Exception):
|
|||||||
|
|
||||||
|
|
||||||
def compile2(code, layer):
|
def compile2(code, layer):
|
||||||
return compile(code.rstrip(), layer, 'exec')
|
return compile(code, layer, 'exec')
|
||||||
|
|
||||||
|
|
||||||
def restricted(code, environment=None, layer='Unknown'):
|
def restricted(code, environment=None, layer='Unknown'):
|
||||||
|
|||||||
Reference in New Issue
Block a user