/usr/share/pyshared/grokcore/component/tests/adapter/conflict.py is in python-grokcore.component 2.5-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | """
Registering two adapters for the same target interface should provoke
a conflict, even if the interface is guessed (instead of being
explicitly declared with grok.provides):
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
ConfigurationConflictError: Conflicting configuration actions
For: ('adapter', <InterfaceClass grokcore.component.tests.adapter.conflict.ICave>, <InterfaceClass grokcore.component.tests.adapter.conflict.IDecoration>, u'')
"""
import grokcore.component as grok
from zope.interface import Interface
class ICave(Interface):
pass
class IDecoration(Interface):
pass
class ICaveCleaning(Interface):
pass
class Cave(object):
grok.implements(ICave)
class ImplicitProvides(grok.Adapter):
"""Here the provided interface is guessed because the class only
implements one interface."""
grok.context(ICave)
grok.implements(IDecoration)
class ExplicitProvides(grok.Adapter):
"""Here the provided interface is specific explicitly."""
grok.context(ICave)
grok.implements(IDecoration, ICaveCleaning)
grok.provides(IDecoration)
|