Exemplo n.º 1
0
    def respondWithPost(self, PostFingerprint):
        d = Mercury.getPost(PostFingerprint)
        d.addCallback(Mercury.toJson)

        def processAndReturn(postAsJson):
            reply = {'Post': postAsJson}
            return reply

        d.addCallback(processAndReturn)\
         .addErrback(self.closeConnection, 'INBOUND', self.respondWithPost.__name__)
        return d
Exemplo n.º 2
0
    def respondWithPost(self, PostFingerprint):
        d = Mercury.getPost(PostFingerprint)
        d.addCallback(Mercury.toJson)

        def processAndReturn(postAsJson):
            reply = { 'Post': postAsJson }
            return reply

        d.addCallback(processAndReturn)\
         .addErrback(self.closeConnection, 'INBOUND', self.respondWithPost.__name__)
        return d
Exemplo n.º 3
0
    def respondWithPost(self, PostFingerprint):
        if not self.connectedNode:
            self.abortConnection(Exception("AetherError: Illegal request from remote."), "L<-R", "respondWithPost")
        print("L->R: Post reply. Post: ", PostFingerprint, " N:", self.connectedNode["NodeId"])
        d = Mercury.getPost(PostFingerprint)
        d.addCallback(Mercury.toJson)

        def processAndReturn(postAsJson):
            reply = {"Post": postAsJson}
            return reply

        d.addCallback(processAndReturn).addErrback(self.abortConnection, "L<-R", self.respondWithPost.__name__)
        return d
Exemplo n.º 4
0
    def respondWithPost(self, PostFingerprint):
        if not self.connectedNode:
            self.abortConnection(Exception('AetherError: Illegal request from remote.'), 'L<-R', 'respondWithPost')
        print('L->R: Post reply. Post: ', PostFingerprint, ' N:', self.connectedNode['NodeId'])
        d = Mercury.getPost(PostFingerprint)
        d.addCallback(Mercury.toJson)

        def processAndReturn(postAsJson):
            reply = { 'Post': postAsJson }
            return reply

        d.addCallback(processAndReturn)\
         .addErrback(self.abortConnection, 'L<-R', self.respondWithPost.__name__)
        return d
Exemplo n.º 5
0
    def respondWithPost(self, PostFingerprint):
        if not self.connectedNode:
            self.abortConnection(
                Exception('AetherError: Illegal request from remote.'), 'L<-R',
                'respondWithPost')
        print('L->R: Post reply. Post: ', PostFingerprint, ' N:',
              self.connectedNode['NodeId'])
        d = Mercury.getPost(PostFingerprint)
        d.addCallback(Mercury.toJson)

        def processAndReturn(postAsJson):
            reply = {'Post': postAsJson}
            return reply

        d.addCallback(processAndReturn)\
         .addErrback(self.abortConnection, 'L<-R', self.respondWithPost.__name__)
        return d