cache (and compile) parse_template in run_view_in, fix #1474

This commit is contained in:
ilvalle
2016-09-25 10:08:26 +02:00
parent 0e4ff55306
commit 576aaf668d
5 changed files with 33 additions and 68 deletions
+7
View File
@@ -16,6 +16,7 @@ from gluon.storage import Storage, List
from gluon import fileutils
from gluon.dal import DAL, Field, Table
from gluon.http import HTTP
from gluon.fileutils import open_file
DEFAULT_URI = os.getenv('DB', 'sqlite:memory')
@@ -76,12 +77,18 @@ class TestAppAdmin(unittest.TestCase):
def run_view(self):
return run_view_in(self.env)
def run_view_file_stream(self):
view_path = os.path.join(self.env['request'].folder, 'views', 'appadmin.html')
self.env['response'].view = open_file(view_path, 'r')
return run_view_in(self.env)
def _test_index(self):
result = self.run_function()
self.assertTrue('db' in result['databases'])
self.env.update(result)
try:
self.run_view()
self.run_view_file_stream()
except Exception as e:
print(e.message)
self.fail('Could not make the view')