You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2006/12/03 05:36:38 UTC

svn commit: r481717 - in /httpd/mod_python/trunk: Doc/appendixc.tex lib/python/mod_python/__init__.py src/connobject.c src/include/mpversion.h src/requestobject.c src/serverobject.c

Author: grahamd
Date: Sat Dec  2 20:36:37 2006
New Revision: 481717

URL: http://svn.apache.org/viewvc?view=rev&rev=481717
Log:
(MODPYTHON-170) Added req._request_rec, server._server_rec and
conn._conn_rec semi private members for getting accessing to underlying
Apache struct as a Python CObject. These can be used for use in
implementing SWIG bindings for lower level APIs of Apache. These members
should be regarded as experimental and there are no guarantees that they
will remain present in this specific form in the future.


Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/lib/python/mod_python/__init__.py
    httpd/mod_python/trunk/src/connobject.c
    httpd/mod_python/trunk/src/include/mpversion.h
    httpd/mod_python/trunk/src/requestobject.c
    httpd/mod_python/trunk/src/serverobject.c

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/Doc/appendixc.tex?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Sat Dec  2 20:36:37 2006
@@ -136,6 +136,15 @@
       interpreters, thereby allowing other modules to also embed Python
       and for there not to be a conflict with mod_python.
     \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-170]{MODPYTHON-170})
+      Added \code{req._request_rec}, \code{server._server_rec} and
+      \code{conn._conn_rec} semi private members for getting accessing to
+      underlying Apache struct as a Python CObject. These can be used for
+      use in implementing SWIG bindings for lower level APIs of Apache.
+      These members should be regarded as experimental and there are no
+      guarantees that they will remain present in this specific form in the
+      future.
+    \item
       (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-193]{MODPYTHON-193})
       Added new attribute available as \code{req.hlist.location}. For a
       handler executed directly as the result of a handler directive

Modified: httpd/mod_python/trunk/lib/python/mod_python/__init__.py
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/lib/python/mod_python/__init__.py?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/__init__.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/__init__.py Sat Dec  2 20:36:37 2006
@@ -20,5 +20,5 @@
 __all__ = ["apache", "cgihandler", "psp",
            "publisher", "util", "python22"]
 
-version = "3.3.0-dev-20061202"
+version = "3.3.0-dev-20061203"
 

Modified: httpd/mod_python/trunk/src/connobject.c
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/connobject.c?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/src/connobject.c (original)
+++ httpd/mod_python/trunk/src/connobject.c Sat Dec  2 20:36:37 2006
@@ -425,6 +425,9 @@
         Py_INCREF(self->hlo);
         return (PyObject *)self->hlo;
     }
+    else if (strcmp(name, "_conn_rec") == 0) {
+        return PyCObject_FromVoidPtr(self->conn, 0);
+    }
     else
         return PyMember_Get((char *)self->conn, conn_memberlist, name);
 

Modified: httpd/mod_python/trunk/src/include/mpversion.h
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/include/mpversion.h?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/src/include/mpversion.h (original)
+++ httpd/mod_python/trunk/src/include/mpversion.h Sat Dec  2 20:36:37 2006
@@ -1,5 +1,5 @@
 #define MPV_MAJOR 3
 #define MPV_MINOR 3
 #define MPV_PATCH 0
-#define MPV_BUILD 20061202
-#define MPV_STRING "3.3.0-dev-20061202"
+#define MPV_BUILD 20061203
+#define MPV_STRING "3.3.0-dev-20061203"

Modified: httpd/mod_python/trunk/src/requestobject.c
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/requestobject.c?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/src/requestobject.c (original)
+++ httpd/mod_python/trunk/src/requestobject.c Sat Dec  2 20:36:37 2006
@@ -1610,6 +1610,9 @@
             return PyLong_FromLong(l);
         }
     }
+    else if (strcmp(name, "_request_rec") == 0) {
+        return PyCObject_FromVoidPtr(self->request_rec, 0);
+    }
     else
         return PyMember_GetOne((char*)self->request_rec,
                                find_memberdef(request_rec_mbrs, name));
@@ -1938,6 +1941,7 @@
     /* XXX filters and eos */
     {"eos_sent", (getter)getreq_recmbr, NULL, "EOS bucket sent", "eos_sent"},
     {"_bytes_queued", (getter)getreq_recmbr, NULL, "Bytes queued by handler", "_bytes_queued"},
+    {"_request_rec", (getter)getreq_recmbr, NULL, "Actual request_rec struct", "_request_rec"},
     {NULL}  /* Sentinel */
 };
 

Modified: httpd/mod_python/trunk/src/serverobject.c
URL: http://svn.apache.org/viewvc/httpd/mod_python/trunk/src/serverobject.c?view=diff&rev=481717&r1=481716&r2=481717
==============================================================================
--- httpd/mod_python/trunk/src/serverobject.c (original)
+++ httpd/mod_python/trunk/src/serverobject.c Sat Dec  2 20:36:37 2006
@@ -224,6 +224,9 @@
 
 static PyObject *getsrv_recmbr(serverobject *self, void *name) 
 {
+    if (strcmp(name, "_server_rec") == 0) {
+        return PyCObject_FromVoidPtr(self->server, 0);
+    }
     return PyMember_GetOne((char*)self->server,
                            find_memberdef(server_rec_mbrs, name));
 }
@@ -319,6 +322,7 @@
     {"limit_req_fields",    (getter)getsrv_recmbr, NULL, "limit on number of request header fields", "limit_req_fields"},
     {"my_generation",    (getter)my_generation, NULL, "Generation of this child", "my_generation"},
     {"restart_time",    (getter)restart_time, NULL, "Server restart time", "restart_time"},
+    {"_server_rec",    (getter)getsrv_recmbr, NULL, "Actual server_rec struct", "_server_rec"},
     {NULL}  /* Sentinel */
 };