Example #1
0
 def dispatch(self, urlpath, bot, event):
     logging.warn("dispatching %s" % urlpath)
     urlpath = urllib.parse.unquote_plus(urlpath.strip())
     urlpath = urlpath.split('#')[0]
     urlpath = urlpath.split('?')[0] 
     for path, cb in self.cbs.items():
         if urlpath.startswith(path): apirunner.put(5, urlpath, cb, bot, event) ; return      
Example #2
0
def handle_task(bot, event):
    try:
        """ this is where the task gets dispatched. """
        path = self.request.path
        if path.endswith('/'): path = path[:-1]
        taskname = path.split('/')[-1].strip()
        logging.warn("using taskname: %s" % taskname)
        inputdict = {}
        for name, value in self.request.environ.iteritems():
            if not 'wsgi' in name:
                inputdict[name] = value
        apirunner.put(5, taskname, taskmanager.dispatch, taskname, inputdict, self.request, self.response)

    except Exception as ex: 
        handle_exception()
        self.response.set_status(500)