[CMF-checkins] CVS: Products/CMFCore - MemberDataTool.py:1.8
Tres Seaver
tseaver@zope.com
Thu, 15 Nov 2001 18:20:46 -0500
Update of /cvs-repository/Products/CMFCore
In directory cvs.zope.org:/tmp/cvs-serv19195/CMFCore
Modified Files:
MemberDataTool.py
Log Message:
- Allowed property lookup to reach the underlying user, in cases where
the member wrapper does not have a value and where the tool has no
value, or an empty string.
=== Products/CMFCore/MemberDataTool.py 1.7 => 1.8 ===
security.declarePublic('getProperty')
def getProperty(self, id, default=_marker):
+
tool = self.getTool()
- if tool.hasProperty(id):
- return getattr(self, id)
- else:
- if default is _marker:
- raise 'Property not found', id
- else:
- return default
+ base = aq_base( self )
+
+ # First, check the wrapper (w/o acquisition).
+ # XXX: s.b., tool.getPropertyForMember( self, id, default )?
+ value = getattr( base, id, _marker )
+ if value is not _marker:
+ return value
+
+ # Then, check the tool for a value other than ''
+ value = tool.getProperty( id, _marker )
+ if value is not _marker and value != '':
+ return value
+
+ # Finally, try the user object.
+ value = getattr( self.getUser(), id, default )
+ if value is _marker:
+ raise 'Property not found', id
+
+ return value
security.declarePrivate('getPassword')
def getPassword(self):