From 352c93bc86347646d8190049fef9ba63f9c0dc0e Mon Sep 17 00:00:00 2001 From: ilvalle Date: Fri, 16 Sep 2016 19:33:07 +0200 Subject: [PATCH] added getcfs for run_view_in --- gluon/compileapp.py | 2 +- gluon/tests/test_appadmin.py | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/gluon/compileapp.py b/gluon/compileapp.py index 70f924b1..42794bac 100644 --- a/gluon/compileapp.py +++ b/gluon/compileapp.py @@ -707,7 +707,7 @@ def run_view_in(environment): for f in files: compiled = pjoin(path, f) if os.path.exists(compiled): - code = read_pyc(compiled) + code = getcfs(compiled, compiled, lambda: read_pyc(compiled)) restricted(code, environment, layer=compiled) return if not os.path.exists(filename) and allow_generic: diff --git a/gluon/tests/test_appadmin.py b/gluon/tests/test_appadmin.py index 9d7e0493..77bb36d6 100644 --- a/gluon/tests/test_appadmin.py +++ b/gluon/tests/test_appadmin.py @@ -10,7 +10,7 @@ import sys import unittest -from gluon.compileapp import run_controller_in, run_view_in +from gluon.compileapp import run_controller_in, run_view_in, compile_application, remove_compiled_application from gluon.languages import translator from gluon.storage import Storage, List from gluon import fileutils @@ -76,7 +76,7 @@ class TestAppAdmin(unittest.TestCase): def run_view(self): return run_view_in(self.env) - def test_index(self): + def _test_index(self): result = self.run_function() self.assertTrue('db' in result['databases']) self.env.update(result) @@ -86,6 +86,15 @@ class TestAppAdmin(unittest.TestCase): print(e.message) self.fail('Could not make the view') + def test_index(self): + self._test_index() + + def test_index_compiled(self): + appname_path = os.path.join(os.getcwd(), 'applications', 'welcome') + compile_application(appname_path) + self._test_index() + remove_compiled_application(appname_path) + def test_select(self): request = self.env['request'] request.args = List(['db'])