Skip to content

Commit

Permalink
Merge pull request #18 from plone/marker_fix
Browse files Browse the repository at this point in the history
Use the _marker from CMFCore for MemberDataTool.
  • Loading branch information
thet committed May 17, 2016
2 parents c863af0 + 34d2c86 commit 089fca6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
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 ''

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

0 comments on commit 089fca6

Please sign in to comment.