Esempio n. 1
0
    def __init__(self, ob):

        self.subject = ob

        # Declare this instance as a per-instance adaptation for the
        # given protocols

        provides = list(self.attachForProtocols)

        from protocols.api import declareAdapter
        declareAdapter(lambda s: self, provides, forObjects=[ob])
Esempio n. 2
0
    def __init__(self, ob):

        self.subject = ob

        # Declare this instance as a per-instance adaptation for the
        # given protocols

        provides = list(self.attachForProtocols)

        from protocols.api import declareAdapter

        declareAdapter(lambda s: self, provides, forObjects=[ob])
Esempio n. 3
0
    def __init__ ( self, ob, proto ):
        self.subject = ob
        self.protocol = proto

        # Declare this instance as a per-instance adaptation for the
        # given protocol

        provides = list( self.attachForProtocols )
        if proto is not None and proto not in provides:
            provides.append( proto )

        from protocols.api import declareAdapter
        declareAdapter( lambda s: self, provides, forObjects = [ ob ] )