Пример #1
0
def implements(*ifaces):
    """
    This is a slight hack, it overrides the default zope.interface implements
    function because it to uses the addClassAdvisor functionality to delay its
    work till after the class is created.  So we must as well, and by placing
    our hook in here we avoid the client having to manually add it.
    """
    declarations._implements("implements", ifaces, _classImplements)

    # These are called after the class that
    advice.addClassAdvisor(_register_class)
    advice.addClassAdvisor(_verify_class)
Пример #2
0
def implements(*ifaces):
    """
    This is a slight hack, it overrides the default zope.interface implements
    function because it to uses the addClassAdvisor functionality to delay its
    work till after the class is created.  So we must as well, and by placing
    our hook in here we avoid the client having to manually add it.
    """
    declarations._implements("implements", ifaces, _classImplements)

    # These are called after the class that
    advice.addClassAdvisor(_register_class)
    advice.addClassAdvisor(_verify_class)
Пример #3
0
def implements(*interfaces):
    """
    Can be used in the class definition of `Component` subclasses to
    declare the extension points that are extended.
    """
    frame = sys._getframe(1)
    locals_ = frame.f_locals
    # sanity checks
    assert locals_ is not frame.f_globals and '__module__' in locals_, \
           'implements() can only be used in a class definition'
    locals_.setdefault('_implements', []).extend(interfaces)
    # zope.interfaces compatibility
    _implements("implements", interfaces, classImplements)
Пример #4
0
def implements(*interfaces):
    """
    Can be used in the class definition of `Component` subclasses to
    declare the extension points that are extended.
    """
    frame = sys._getframe(1)
    locals_ = frame.f_locals
    # sanity checks
    assert locals_ is not frame.f_globals and '__module__' in locals_, \
           'implements() can only be used in a class definition'
    locals_.setdefault('_implements', []).extend(interfaces)
    # zope.interfaces compatibility
    _implements("implements", interfaces, classImplements)