@defer.deferredGenerator
    def execute(self, request):
        """interface method to special droned actions"""
        result = None
        contentType = 'application/droned-pickle' #set the default
        try:
            request.content.seek(0, 0)

            BufferedMessage = request.content.read()
            contentType = request.getHeader('content-type')
            host = request.getClientIP()

            if not bool(contentType in blaster.MIMESerialize):
                raise AssertionError("Can't support this content encoding")
            _dict = blaster.Deserialize().execute(contentType,
                    urllib.unquote(BufferedMessage))
            digest = DIGEST_INIT()
            keyID = _dict["key"]
            action = _dict["action"]
            argstr = _dict["argstr"]
            magicStr = _dict["magic"]
            magicNumber = abs(unpackify(magicStr))
            timestamp = _dict["time"]
            signature = _dict["signature"]
            if argstr != "":
                payload = str(magicStr) + str(timestamp) + "%s %s" % \
                    (action,argstr)
            else:
                payload = str(magicStr) + str(timestamp) + "%s" % (action,)
            digest.update(payload)
            assumed = digest.hexdigest()
            trusted = drone.keyRing.publicDecrypt(keyID, signature)
            #check the magic string
            d = drone.validateMessage(magicNumber)
            wfd = defer.waitForDeferred(d)
            yield wfd
            if not wfd.getResult():
                raise AssertionError("Invalid Magic String")
            if magicNumber == 0:
                raise AssertionError("Attempted Zero-Attack, dropping request")
            if trusted != assumed:
                raise AssertionError("Invalid signature: %s != %s" % \
                        (assumed, trusted))
            func = drone.get_action(action)
            if not func:
                raise AssertionError("Action %s, Not actionable" % (action,))
            if argstr != "": #no args hack
                server_log('Executing "%s %s" for %s@%s' % (action, argstr, keyID, host))
            else:
                server_log('Executing "%s" for %s@%s' % (action, keyID, host))
            #get the result of the request as a deferred
            d = defer.maybeDeferred(func, argstr)
            #Format the result of the action
            wfd = defer.waitForDeferred(d)
            yield wfd
            result = wfd.getResult()
        except:
            result = Failure()
        yield (result, contentType)
dataset/ETHPy150Open OrbitzWorldwide/droned/droned/services/drone.py/Control.execute/original