Skip to content

Commit

Permalink
Fix exception when related items is broken (#32)
Browse files Browse the repository at this point in the history
* Fix exception when item don't have related items

* Fix changelog
  • Loading branch information
rodfersou authored and hvelarde committed Oct 11, 2016
1 parent 0fd0af4 commit b84c4d4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ There's a frood who really knows where his towel is.
1.0a3 (unreleased)
------------------

- Avoid exception when related items relation is broken.
[rodfersou]

- Fix loading order for main AMP script.
[hvelarde]

Expand Down
4 changes: 4 additions & 0 deletions src/collective/behavior/amp/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ def relations2brains(self, relations):
catalog = api.portal.get_tool('portal_catalog')
brains = []
for item in relations:
# Skip broken relations (deleted content)
# https://github.com/plone/plone.app.relationfield/issues/10
if item.isBroken():
continue
path = item.to_path
# the query will return an empty list if the user has no
# permission to see the target object
Expand Down

0 comments on commit b84c4d4

Please sign in to comment.