Zope Subversion Repository

  Zope

Zope: Zope3/trunk/src/zope/security/checker.py

Diff for /Zope3/trunk/src/zope/security/checker.py between version 39777 and 40886

version 39777, Mon Oct 31 19:08:20 2005 UTC version 40886, Mon Dec 19 17:47:35 2005 UTC
Line 97 
Line 97 
         checker.check_setattr(obj, name)          checker.check_setattr(obj, name)
     except Unauthorized:      except Unauthorized:
         return False          return False
     # if it is Forbidden (or anything else), let it be raised: it probably      except ForbiddenAttribute:
     # indicates a programming or configuration error          # we are going to be a bit DWIM-y here: see
           # http://www.zope.org/Collectors/Zope3-dev/506
   
           # generally, if the check is ForbiddenAttribute we want it to be
           # raised: it probably indicates a programming or configuration error.
           # However, we special case a write ForbiddenAttribute when one can
           # actually read the attribute: this represents a reasonable
           # configuration of a readonly attribute, and returning False (meaning
           # "no, you can't write it") is arguably more useful than raising the
           # exception.
           try:
               checker.check_getattr(obj, name)
               # we'll let *this* ForbiddenAttribute fall through, if any.  It
               # means that both read and write are forbidden.
           except Unauthorized:
               pass
           return False
       # all other exceptions, other than Unauthorized and ForbiddenAttribute,
       # should be passed through uncaught, as they indicate programmer error
     return True      return True
   
 def canAccess(obj, name):  def canAccess(obj, name):


Generate output suitable for use with a patch program
Legend:
Removed from v.39777  
changed lines
  Added in v.40886

webmaster@zope.org

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help