Function
zope.app.pluggableauth.PluggableAuthenticationAddSubscriber

Signature

PluggableAuthenticationAddSubscriber(self, event)

Documentation String

Generates an earmark if one is not provided.

Define a stub for PluggableAuthentication

>>> from zope.traversing.interfaces import IPhysicallyLocatable
>>> class PluggableAuthStub(object):
...     implements(IPhysicallyLocatable)
...     def __init__(self, earmark=None):
...         self.earmark = earmark
...     def getName(self):
...         return 'PluggableAuthName'

The subscriber generates an earmark for the auth utility if one is not set in the init.

>>> stub = PluggableAuthStub()
>>> event = ''
>>> PluggableAuthenticationAddSubscriber(stub, event)
>>> stub.earmark is not None
True

The subscriber does not modify an earmark for the auth utility if one exists already.

>>> earmark = 'my sample earmark'
>>> stub = PluggableAuthStub(earmark=earmark)
>>> event = ''
>>> PluggableAuthenticationAddSubscriber(stub, event)
>>> stub.earmark == earmark
True