Example #1
0
class JsTemplates(BaseEngine):
    def __init__(self, params):
        params = params.copy()
        options = params.pop('OPTIONS').copy()
        super(JsTemplates, self).__init__(params)
        self.engine = JsEngine(self.dirs, self.app_dirs, **options)

    def get_template(self, template_name, dirs=_dirs_undefined):
        return JsTemplate(self.engine.get_template(template_name))
Example #2
0
 def test_get_template(self):
     engine = JsEngine(dirs=[settings.TEMPLATE_DIR])
     template = engine.get_template('test-component.js')
     self.assertIsNotNone(template)
Example #3
0
 def test_get_template_including_appdirs(self):
     engine = JsEngine(dirs=[settings.TEMPLATE_DIR], app_dirs=True)
     template = engine.get_template('test-component.js')
     self.assertIsNotNone(template)
Example #4
0
 def test_load_missing_template(self):
     engine = JsEngine(dirs=[settings.TEMPLATE_DIR])
     loader = JsLoader(engine)
     with self.assertRaises(TemplateDoesNotExist):
         loader.load_template_source('foo.js')
Example #5
0
 def test_empty_template_dir_config(self):
     engine = JsEngine()
     loader = JsLoader(engine)
     with self.assertRaises(TemplateDoesNotExist):
         loader.load_template_source('foo.js')
Example #6
0
 def __init__(self, params):
     params = params.copy()
     options = params.pop('OPTIONS').copy()
     super(JsTemplates, self).__init__(params)
     self.engine = JsEngine(self.dirs, self.app_dirs, **options)