Skip to content

Commit

Permalink
don't break if portal_factory is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Nov 15, 2013
1 parent 94efcb4 commit 31f8025
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
2.5a2 (unreleased)
------------------

- Don't break if portal_factory is missing.
[davisagli]

- Don't show the ``New user?`` link in the Login portlet if there isn't
a register URL available from portal_actions.
[davidjb]
Expand Down
4 changes: 2 additions & 2 deletions plone/app/portlets/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def base_url(self):

def can_manage_portlets(self):
context = self._context()
ftool = getToolByName(context, 'portal_factory')
if ftool.isTemporary(context) or \
ftool = getToolByName(context, 'portal_factory', None)
if ftool and ftool.isTemporary(context) or \
not ILocalPortletAssignable.providedBy(context):
return False
mtool = getToolByName(context, 'portal_membership')
Expand Down
8 changes: 0 additions & 8 deletions plone/app/portlets/tests/test_navigation_portlet.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,6 @@ def testMultipleTopLevelWithNavigationRoot(self):
self.assertEqual(len(tree2['children']), 1)
self.assertEqual(len(tree1['children']), 1)

def testTopLevelWithPortalFactory(self):
id=self.portal.generateUniqueId('Document')
typeName='Document'
newObject=self.portal.folder1.restrictedTraverse('portal_factory/' + typeName + '/' + id)
# Will raise a KeyError unless bug is fixed
view = self.renderer(newObject, assignment=navigation.Assignment(topLevel=1))
view.getNavTree()

def testShowAllParentsOverridesBottomLevel(self):
view = self.renderer(self.portal.folder2.file21, assignment=navigation.Assignment(bottomLevel=1, topLevel=0))
tree = view.getNavTree()
Expand Down

1 comment on commit 31f8025

@mister-roboto
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TESTS FAILED
Mr.roboto url : http://jenkins.plone.org/roboto/get_info?push=51c946c1f33f48f48dac4ea0a624c293
kgs-plone.app.portlets-plone-5.0-python-2.7 kgs [FAILURE]

Please sign in to comment.