spacepaste

  1.  
  2. ###############################################################################
  3. ##
  4. ## see: https://bugs.launchpad.net/zope2/+bug/511294
  5. ## http://dev.plone.org/plone/ticket/9394
  6. ##
  7. ## ZCML:
  8. ##
  9. ## <adapter
  10. ## factory=".patches.UnauthorizedBindingTraverse"
  11. ## name="at_base_edit_view" />
  12. ##
  13. ##############################################################################
  14. from zope.component import adapts
  15. from zope.interface import Interface, implements, classImplements
  16. from zope.traversing.interfaces import ITraversable
  17. from zope.publisher.interfaces.http import IHTTPRequest
  18. from Shared.DC.Scripts.Bindings import UnauthorizedBinding
  19. from AccessControl.unauthorized import Unauthorized
  20. class IUnauthorizedBinding(Interface):
  21. """
  22. Marker interface for UnauthorizedBinding.
  23. """
  24. classImplements(UnauthorizedBinding, IUnauthorizedBinding)
  25. class UnauthorizedBindingTraverse(object):
  26. """
  27. Traversal adapter for the UnauthorizedBinding.
  28. """
  29. implements(ITraversable)
  30. adapts(IUnauthorizedBinding, IHTTPRequest)
  31. def __init__(self, context, request=None):
  32. self.context = context
  33. self.request = request
  34. def __getattr__(self, name, default=None):
  35. raise Unauthorized('Not authorized to access')
  36.