##// END OF EJS Templates
don't allow 'template' to specify 'template_file'...
MinRK -
Show More
@@ -170,11 +170,13 b' class Exporter(LoggingConfigurable):'
170 170 template : str (optional, kw arg)
171 171 Template to use when exporting.
172 172 """
173 if not config:
174 config = self.default_config
173 175
174 176 super(Exporter, self).__init__(config=config, **kw)
175 177
176 178 #Init
177 self._init_template(**kw)
179 self._init_template()
178 180 self._init_environment(extra_loaders=extra_loaders)
179 181 self._init_transformers()
180 182 self._init_filters()
@@ -189,8 +191,9 b' class Exporter(LoggingConfigurable):'
189 191 c = self.default_config
190 192 if new:
191 193 c.merge(new)
192 if c != new:
194 if c != old:
193 195 self.config = c
196 super(Exporter, self)._config_changed(name, old, c)
194 197
195 198
196 199 def _load_template(self):
@@ -382,14 +385,12 b' class Exporter(LoggingConfigurable):'
382 385 raise TypeError('filter')
383 386
384 387
385 def _init_template(self, **kw):
388 def _init_template(self):
386 389 """
387 390 Make sure a template name is specified. If one isn't specified, try to
388 391 build one from the information we know.
389 392 """
390 393 self._template_file_changed('template_file', self.template_file, self.template_file)
391 if 'template' in kw:
392 self.template_file = kw['template']
393 394
394 395
395 396 def _init_environment(self, extra_loaders=None):
@@ -95,7 +95,7 b' class TestExporter(ExportersTestsBase):'
95 95
96 96 def test_transformer_via_method(self):
97 97 """
98 Can a transformer be added via the Exporter convinience method?
98 Can a transformer be added via the Exporter convenience method?
99 99 """
100 100 exporter = self._make_exporter()
101 101 exporter.register_transformer(CheeseTransformer, enabled=True)
@@ -108,6 +108,5 b' class TestExporter(ExportersTestsBase):'
108 108 def _make_exporter(self, config=None):
109 109 #Create the exporter instance, make sure to set a template name since
110 110 #the base Exporter doesn't have a template associated with it.
111 exporter = Exporter(config=config)
112 exporter.template_file = 'python'
111 exporter = Exporter(config=config, template_file='python')
113 112 return exporter No newline at end of file
@@ -46,7 +46,7 b' class TestHTMLExporter(ExportersTestsBase):'
46 46 """
47 47 Can a HTMLExporter export using the 'basic' template?
48 48 """
49 (output, resources) = HTMLExporter(template='basic').from_filename(self._get_notebook())
49 (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook())
50 50 assert len(output) > 0
51 51
52 52
@@ -55,5 +55,5 b' class TestHTMLExporter(ExportersTestsBase):'
55 55 """
56 56 Can a HTMLExporter export using the 'full' template?
57 57 """
58 (output, resources) = HTMLExporter(template='full').from_filename(self._get_notebook())
58 (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook())
59 59 assert len(output) > 0
@@ -46,7 +46,7 b' class TestLatexExporter(ExportersTestsBase):'
46 46 """
47 47 Can a LatexExporter export using 'book' template?
48 48 """
49 (output, resources) = LatexExporter(template='book').from_filename(self._get_notebook())
49 (output, resources) = LatexExporter(template_file='book').from_filename(self._get_notebook())
50 50 assert len(output) > 0
51 51
52 52
@@ -55,7 +55,7 b' class TestLatexExporter(ExportersTestsBase):'
55 55 """
56 56 Can a LatexExporter export using 'basic' template?
57 57 """
58 (output, resources) = LatexExporter(template='basic').from_filename(self._get_notebook())
58 (output, resources) = LatexExporter(template_file='basic').from_filename(self._get_notebook())
59 59 assert len(output) > 0
60 60
61 61
@@ -64,5 +64,5 b' class TestLatexExporter(ExportersTestsBase):'
64 64 """
65 65 Can a LatexExporter export using 'article' template?
66 66 """
67 (output, resources) = LatexExporter(template='article').from_filename(self._get_notebook())
67 (output, resources) = LatexExporter(template_file='article').from_filename(self._get_notebook())
68 68 assert len(output) > 0 No newline at end of file
@@ -46,5 +46,5 b' class TestSlidesExporter(ExportersTestsBase):'
46 46 """
47 47 Can a SlidesExporter export using the 'reveal' template?
48 48 """
49 (output, resources) = SlidesExporter(template='reveal').from_filename(self._get_notebook())
49 (output, resources) = SlidesExporter(template_file='reveal').from_filename(self._get_notebook())
50 50 assert len(output) > 0
General Comments 0
You need to be logged in to leave comments. Login now