diff --git a/IPython/nbconvert/exporters/exporter.py b/IPython/nbconvert/exporters/exporter.py index 61b5e2d..7629232 100755 --- a/IPython/nbconvert/exporters/exporter.py +++ b/IPython/nbconvert/exporters/exporter.py @@ -170,11 +170,13 @@ class Exporter(LoggingConfigurable): template : str (optional, kw arg) Template to use when exporting. """ + if not config: + config = self.default_config super(Exporter, self).__init__(config=config, **kw) #Init - self._init_template(**kw) + self._init_template() self._init_environment(extra_loaders=extra_loaders) self._init_transformers() self._init_filters() @@ -189,8 +191,9 @@ class Exporter(LoggingConfigurable): c = self.default_config if new: c.merge(new) - if c != new: + if c != old: self.config = c + super(Exporter, self)._config_changed(name, old, c) def _load_template(self): @@ -382,14 +385,12 @@ class Exporter(LoggingConfigurable): raise TypeError('filter') - def _init_template(self, **kw): + def _init_template(self): """ Make sure a template name is specified. If one isn't specified, try to build one from the information we know. """ self._template_file_changed('template_file', self.template_file, self.template_file) - if 'template' in kw: - self.template_file = kw['template'] def _init_environment(self, extra_loaders=None): diff --git a/IPython/nbconvert/exporters/tests/test_exporter.py b/IPython/nbconvert/exporters/tests/test_exporter.py index 64855f8..c65f150 100644 --- a/IPython/nbconvert/exporters/tests/test_exporter.py +++ b/IPython/nbconvert/exporters/tests/test_exporter.py @@ -95,7 +95,7 @@ class TestExporter(ExportersTestsBase): def test_transformer_via_method(self): """ - Can a transformer be added via the Exporter convinience method? + Can a transformer be added via the Exporter convenience method? """ exporter = self._make_exporter() exporter.register_transformer(CheeseTransformer, enabled=True) @@ -108,6 +108,5 @@ class TestExporter(ExportersTestsBase): def _make_exporter(self, config=None): #Create the exporter instance, make sure to set a template name since #the base Exporter doesn't have a template associated with it. - exporter = Exporter(config=config) - exporter.template_file = 'python' + exporter = Exporter(config=config, template_file='python') return exporter \ No newline at end of file diff --git a/IPython/nbconvert/exporters/tests/test_html.py b/IPython/nbconvert/exporters/tests/test_html.py index f5df23c..10c41ba 100644 --- a/IPython/nbconvert/exporters/tests/test_html.py +++ b/IPython/nbconvert/exporters/tests/test_html.py @@ -46,7 +46,7 @@ class TestHTMLExporter(ExportersTestsBase): """ Can a HTMLExporter export using the 'basic' template? """ - (output, resources) = HTMLExporter(template='basic').from_filename(self._get_notebook()) + (output, resources) = HTMLExporter(template_file='basic').from_filename(self._get_notebook()) assert len(output) > 0 @@ -55,5 +55,5 @@ class TestHTMLExporter(ExportersTestsBase): """ Can a HTMLExporter export using the 'full' template? """ - (output, resources) = HTMLExporter(template='full').from_filename(self._get_notebook()) + (output, resources) = HTMLExporter(template_file='full').from_filename(self._get_notebook()) assert len(output) > 0 diff --git a/IPython/nbconvert/exporters/tests/test_latex.py b/IPython/nbconvert/exporters/tests/test_latex.py index b692eb7..72c3efc 100644 --- a/IPython/nbconvert/exporters/tests/test_latex.py +++ b/IPython/nbconvert/exporters/tests/test_latex.py @@ -46,7 +46,7 @@ class TestLatexExporter(ExportersTestsBase): """ Can a LatexExporter export using 'book' template? """ - (output, resources) = LatexExporter(template='book').from_filename(self._get_notebook()) + (output, resources) = LatexExporter(template_file='book').from_filename(self._get_notebook()) assert len(output) > 0 @@ -55,7 +55,7 @@ class TestLatexExporter(ExportersTestsBase): """ Can a LatexExporter export using 'basic' template? """ - (output, resources) = LatexExporter(template='basic').from_filename(self._get_notebook()) + (output, resources) = LatexExporter(template_file='basic').from_filename(self._get_notebook()) assert len(output) > 0 @@ -64,5 +64,5 @@ class TestLatexExporter(ExportersTestsBase): """ Can a LatexExporter export using 'article' template? """ - (output, resources) = LatexExporter(template='article').from_filename(self._get_notebook()) + (output, resources) = LatexExporter(template_file='article').from_filename(self._get_notebook()) assert len(output) > 0 \ No newline at end of file diff --git a/IPython/nbconvert/exporters/tests/test_slides.py b/IPython/nbconvert/exporters/tests/test_slides.py index f034c19..9b2c496 100644 --- a/IPython/nbconvert/exporters/tests/test_slides.py +++ b/IPython/nbconvert/exporters/tests/test_slides.py @@ -46,5 +46,5 @@ class TestSlidesExporter(ExportersTestsBase): """ Can a SlidesExporter export using the 'reveal' template? """ - (output, resources) = SlidesExporter(template='reveal').from_filename(self._get_notebook()) + (output, resources) = SlidesExporter(template_file='reveal').from_filename(self._get_notebook()) assert len(output) > 0