Skip to content

Commit

Permalink
Adding template as a parameter of kwargs for plugin renders to be abl…
Browse files Browse the repository at this point in the history
…e to overwrite if needed
  • Loading branch information
PonteIneptique committed May 14, 2016
1 parent b82ead4 commit 9765311
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion flask_nemo/__init__.py
Expand Up @@ -676,11 +676,12 @@ def render(self, template, **kwargs):
kwargs["texts"] = self.get_texts(kwargs["url"]["collection"], kwargs["url"]["textgroup"])

kwargs["assets"] = self.assets
kwargs["template"] = template

for plugin in self.__plugins_render_views__:
kwargs.update(plugin.render(**kwargs))

return render_template(template, **kwargs)
return render_template(kwargs["template"], **kwargs)

def route(self, fn, **kwargs):
""" Route helper : apply fn function but keep the calling object, *ie* kwargs, for other functions
Expand Down
3 changes: 3 additions & 0 deletions tests/test_routes.py
Expand Up @@ -233,6 +233,7 @@ def test_render_normal(self):
collections={'latinLit', 'greekLit'},
test="123",
value="value",
template="main::index.html",
lang="eng",
assets=self.nemo.assets,
url={},
Expand All @@ -256,6 +257,7 @@ def test_render_textgroups(self):
"index.html",
collections={'latinLit', 'greekLit'},
test="123",
template="index.html",
value="value",
lang="eng",
assets=self.nemo.assets,
Expand Down Expand Up @@ -288,6 +290,7 @@ def test_render_text(self):
})
patched.assert_called_once_with(
"index.html",
template="index.html",
collections={'latinLit', 'greekLit'},
test="123",
value="value",
Expand Down

0 comments on commit 9765311

Please sign in to comment.