Пример #1
0
class InterfaceServer(Server):
    def __init__(self, port=settings.port, plugins=[], debug=False):
        super(InterfaceServer, self).__init__()
        self.plugins = [p() for p in plugins]
        self.port = port

    def start(self):
        from arachne.web import interface
        from arachne.cassandra import Cassandra
        self.datastore = Cassandra()
        self.serve(self.port, interface.app, True)

    def run_method(self, method, **args):
        """Run a method and save its results to the datastore.  Returns either
        a string (on failures) or a dict to be sent to the client."""
        user_id = args.get('site_user_id', args.get('user_id', None))
        result = super(InterfaceServer, self).run_method(method, **args)
        # XXX: is this really enough of a "success" condition?
        if user_id and isinstance(result, (dict, list)):
            uuid = uuid4().hex
            self.datastore.set(user_id, result, uuid)
            return {uuid: result}
        return result
Пример #2
0
class InterfaceServer(Server):
    def __init__(self, port=settings.port, plugins=[], debug=False):
        super(InterfaceServer, self).__init__()
        self.plugins = [p() for p in plugins]
        self.port = port

    def start(self):
        from arachne.web import interface
        from arachne.cassandra import Cassandra

        self.datastore = Cassandra()
        self.serve(self.port, interface.app, True)

    def run_method(self, method, **args):
        """Run a method and save its results to the datastore.  Returns either
        a string (on failures) or a dict to be sent to the client."""
        user_id = args.get("site_user_id", args.get("user_id", None))
        result = super(InterfaceServer, self).run_method(method, **args)
        # XXX: is this really enough of a "success" condition?
        if user_id and isinstance(result, (dict, list)):
            uuid = uuid4().hex
            self.datastore.set(user_id, result, uuid)
            return {uuid: result}
        return result
Пример #3
0
    def start(self):
        from arachne.web import interface
        from arachne.cassandra import Cassandra

        self.datastore = Cassandra()
        self.serve(self.port, interface.app, True)
Пример #4
0
 def start(self):
     from arachne.web import interface
     from arachne.cassandra import Cassandra
     self.datastore = Cassandra()
     self.serve(self.port, interface.app, True)