re-added uwsgi.route()

This commit is contained in:
Unbit
2013-02-26 06:38:34 +01:00
parent c73490fc80
commit b20fbf5fe8
7 changed files with 104 additions and 14 deletions
+19
View File
@@ -704,6 +704,21 @@ PyObject *py_uwsgi_send(PyObject * self, PyObject * args) {
}
#ifdef UWSGI_ROUTING
static PyObject *py_uwsgi_route(PyObject * self, PyObject * args) {
struct wsgi_request *wsgi_req = py_current_wsgi_req();
char *router_name = NULL;
char *router_args = NULL;
if (!PyArg_ParseTuple(args, "ss:route", &router_name, &router_args)) {
return NULL;
}
int ret = uwsgi_route_api_func(wsgi_req, uwsgi_str(router_name), uwsgi_str(router_args));
return PyInt_FromLong(ret);
}
#endif
PyObject *py_uwsgi_offload(PyObject * self, PyObject * args) {
/*
size_t len = 0;
@@ -2437,6 +2452,10 @@ static PyMethodDef uwsgi_advanced_methods[] = {
{"add_rb_timer", py_uwsgi_add_rb_timer, METH_VARARGS, ""},
{"add_cron", py_uwsgi_add_cron, METH_VARARGS, ""},
#ifdef UWSGI_ROUTING
{"route", py_uwsgi_route, METH_VARARGS, ""},
#endif
{"register_rpc", py_uwsgi_register_rpc, METH_VARARGS, ""},
{"rpc", py_uwsgi_rpc, METH_VARARGS, ""},
{"rpc_list", py_uwsgi_rpc_list, METH_VARARGS, ""},