コード例 #1
0
 def __call__(self, other, default=_notag):
     """ XXX use TypedInterfaceConfigurable as a fallback if this interface doesn't
     work for some reason
     """
     result = InterfaceClass.__call__(self, other, _notag)
     if result is not _notag:
         return result
     from formless.annotate import TypedInterface
     if TypedInterface.providedBy(other):
         from formless.configurable import TypedInterfaceConfigurable
         return TypedInterfaceConfigurable(other)
     if default is _notag:
         raise TypeError('Could not adapt', other, self)
     return default
コード例 #2
0
ファイル: iformless.py プロジェクト: perkinslr/nevow-py3
    def __call__(self, other, default=_notag):
        """ XXX use TypedInterfaceConfigurable as a fallback if this interface doesn't
        work for some reason
        """

        result = InterfaceClass.__call__(self, other, _notag)
        if result is not _notag:
            return result

        from formless.annotate import TypedInterface
        if TypedInterface.providedBy(other):
            from formless.configurable import TypedInterfaceConfigurable
            return TypedInterfaceConfigurable(other)
        if default is _notag:
            raise TypeError('Could not adapt', other, self)
        return default