diff --git a/.gitignore b/.gitignore index efc9d26..0bcbf6a 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ report.html !.travis.yml !src/collective .*.cfg +.Python diff --git a/.travis.yml b/.travis.yml index 155668e..abf4678 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ env: - PLONE_VERSION=5.0 - PLONE_VERSION=5.1 before_install: - - pip install -r https://raw.githubusercontent.com/plone/buildout.coredev/5.1/requirements.txt + - pip install -r requirements.txt install: - sed -ie "s#test-5.1#test-$PLONE_VERSION#" buildout.cfg - buildout annotate diff --git a/CHANGES.rst b/CHANGES.rst index 278f8d5..431a1cb 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -5,7 +5,8 @@ Changelog 1.4 (unreleased) ---------------- -- Nothing changed yet. +- Wrap tile so it works with newer versions of Mosaic + [tomgross] 1.3 (2018-04-26) diff --git a/buildout.cfg b/buildout.cfg index 238bf72..7a1426d 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -36,3 +36,7 @@ flake8-debugger = 1.4.0 plone.testing = 5.0.0 coverage = 4.0.3 python-coveralls = 2.7.0 +plone.recipe.zope2instance = 4.4.0 +zc.recipe.egg = 2.0.6 +setuptools = 33.1.1 +zc.buildout = 2.12.2 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c16b9b0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +setuptools==33.1.1 +zc.buildout==2.12.2 diff --git a/src/collective/handlebars/browser/views.py b/src/collective/handlebars/browser/views.py index 79e9461..771c278 100644 --- a/src/collective/handlebars/browser/views.py +++ b/src/collective/handlebars/browser/views.py @@ -133,6 +133,8 @@ def translate(self, msgid, domain=None, mapping=None, context=None, target_language=target_language) def _wrap_widget(self, render): + if render and render.startswith(u'
'): + return render return ''.join([u'', render, u'']) @@ -156,7 +158,7 @@ def __call__(self, *args, **kwargs): class HandlebarsTile(Tile, HandlebarsMixin): def __call__(self, *args, **kwargs): - return self.hbs_snippet() + return self._wrap_widget(self.hbs_snippet()) # BBB @@ -166,6 +168,6 @@ def __call__(self, *args, **kwargs): class HandlebarsPersistentTile(PersistentTile, HandlebarsMixin): def __call__(self, *args, **kwargs): - return self.hbs_snippet() + return self._wrap_widget(self.hbs_snippet()) # EOF diff --git a/src/collective/handlebars/tests/data/body_tile.hbs b/src/collective/handlebars/tests/data/body_tile.hbs new file mode 100644 index 0000000..8505b08 --- /dev/null +++ b/src/collective/handlebars/tests/data/body_tile.hbs @@ -0,0 +1 @@ +