Performance: Leverage jinja2's Environment to cache compiled Templates.

This commit is contained in:
dreadpirateshawn 2014-12-12 12:46:07 -08:00
commit 9affa7753d
30 changed files with 228 additions and 235 deletions

View file

@ -1,6 +1,4 @@
from __future__ import unicode_literals
from jinja2 import Template
from moto.core.responses import BaseResponse
from moto.ec2.utils import instance_ids_from_querystring
@ -10,7 +8,7 @@ class General(BaseResponse):
self.instance_ids = instance_ids_from_querystring(self.querystring)
instance_id = self.instance_ids[0]
instance = self.ec2_backend.get_instance(instance_id)
template = Template(GET_CONSOLE_OUTPUT_RESULT)
template = self.response_template(GET_CONSOLE_OUTPUT_RESULT)
return template.render(instance=instance)