Skip to content

Commit

Permalink
Fix exception related with new version of plone protect related with …
Browse files Browse the repository at this point in the history
…returning empty string in the browser view (#39)

* Fix exception related with new version of plone protect related with returning empty string in the browser view

* Pin Firefox version

* Refactor

* Allow failures under Plone 5.0 as it seems to be a regression

For more information, see: plone/Products.CMFPlone#2126
  • Loading branch information
rodfersou authored and hvelarde committed Aug 23, 2017
1 parent efb2d97 commit 886ab74
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ cache:
- eggs
- parts/node
addons:
firefox: latest-esr
firefox: 45.8.0esr
env:
- PLONE_VERSION=4.3
- PLONE_VERSION=5.0
- PLONE_VERSION=5.1
matrix:
# FIXME: https://github.com/plone/Products.CMFPlone/issues/2126
allow_failures:
- env: PLONE_VERSION=5.0
fast_finish: true
install:
- sed -ie "s#test-4.3#test-$PLONE_VERSION#" buildout.cfg
Expand Down
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changelog
1.2b2 (unreleased)
------------------

- Nothing changed yet.
- Avoid ``AttributeError`` on transform chain caused by invalid output on ``recent-updates`` view when there are no new micro-updates available (refs. `plone.protect#64 <https://github.com/plone/plone.protect/issues/64>`_).
[rodfersou]


1.2b1 (2016-06-21)
Expand Down
6 changes: 6 additions & 0 deletions src/collective/liveblog/browser/recent_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ def __call__(self):
self.request.RESPONSE.setHeader('Cache-Control', 'public')
self.request.RESPONSE.setHeader('Expires', expires)
self.request.RESPONSE.setHeader('Last-Modified', last_modified)

# https://github.com/plone/plone.protect/issues/64
self.latest_microupdates = self.get_latest_microupdates()
if len(self.latest_microupdates) == 0:
return ''

return self.index()

# FIXME: caching this function will speed up the rendering of this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<body tal:omit-tag="">
<section id="micro-updates" tal:omit-tag="">
<article class="microupdate" data-timestamp="" itemprop="comment" itemscope itemtype="http://schema.org/Comment"
tal:repeat="update view/get_latest_microupdates"
tal:repeat="update view/latest_microupdates"
tal:attributes="data-timestamp update/timestamp">
<h2 class="microupdate-title" itemprop="headline"
tal:condition="update/title"
Expand Down

0 comments on commit 886ab74

Please sign in to comment.