Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the _marker from CMFCore for MemberDataTool. #18

Merged
merged 2 commits into from
May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ New features:

Bug fixes:

- *add item here*
- Use the _marker from CMFCore for MemberDataTool.getProperty,
this makes sure that we never return the _marker from PlonePAS
but an error.
[pcdummy]

- Don't raise an ValueError if a property doesn't exists for a ZOPE
user.
[pcdummy]


5.0.10 (2016-05-02)
Expand Down
11 changes: 8 additions & 3 deletions src/Products/PlonePAS/tools/memberdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from Acquisition import aq_base
from App.class_init import InitializeClass
from Products.BTreeFolder2.BTreeFolder2 import BTreeFolder2
from Products.CMFCore.MemberDataTool import _marker
from Products.CMFCore.MemberDataTool import MemberData as BaseMemberData
from Products.CMFCore.MemberDataTool import MemberDataTool as BaseTool
from Products.CMFCore.permissions import ManagePortal
Expand All @@ -23,8 +24,6 @@
IRoleAssignerPlugin
from zope.interface import implementer

_marker = object()


class MemberDataTool(BaseTool):
"""PAS-specific implementation of memberdata tool.
Expand Down Expand Up @@ -302,7 +301,13 @@ def getProperty(self, id, default=_marker):
# we won't always have PlonePAS users, due to acquisition,
# nor are guaranteed property sheets
if not sheets:
return BaseMemberData.getProperty(self, id, default)
try:
return BaseMemberData.getProperty(self, id, default)
except ValueError:
# Zope users don't have PropertySheets,
# return an empty string for them if the property
# doesn't exists.
return ''
Copy link
Member

Choose a reason for hiding this comment

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

good catch!


# If we made this far, we found a PAS and some property sheets.
for sheet in sheets:
Expand Down