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/03/05 01:38:20 UTC

svn commit: r383231 - in /httpd/mod_python/trunk: Doc/appendixc.tex Doc/modpython4.tex lib/python/mod_python/__init__.py src/include/mpversion.h src/mod_python.c test/htdocs/tests.py test/test.py

Author: grahamd
Date: Sat Mar  4 16:38:19 2006
New Revision: 383231

URL: http://svn.apache.org/viewcvs?rev=383231&view=rev
Log:
Contents of table object returned by req.server.get_config() wasn't holding
just the top level server configuration but was also errornously mixing in
some container specific onfiguration. (MODPYTHON-133)

Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/Doc/modpython4.tex
    httpd/mod_python/trunk/lib/python/mod_python/__init__.py
    httpd/mod_python/trunk/src/include/mpversion.h
    httpd/mod_python/trunk/src/mod_python.c
    httpd/mod_python/trunk/test/htdocs/tests.py
    httpd/mod_python/trunk/test/test.py

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/appendixc.tex?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Sat Mar  4 16:38:19 2006
@@ -59,6 +59,11 @@
       Nested \code{__auth__()} functions in mod_python.publisher now execute
       in context of globals from the file the function is in and not that
       of mod_python.publisher itself.
+    \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-133]{MODPYTHON-133})
+      The table object returned by \code{req.server.get_config()} was not
+      being populated correctly to be the state of directives set at global
+      scope for the server.
   \end{itemize}
 
 \chapter{Changes from Version (3.1.4)\label{app-changes}}

Modified: httpd/mod_python/trunk/Doc/modpython4.tex
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/modpython4.tex?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/modpython4.tex (original)
+++ httpd/mod_python/trunk/Doc/modpython4.tex Sat Mar  4 16:38:19 2006
@@ -1468,8 +1468,10 @@
 \subsubsection{Server Methods\label{pyapi-mpsrv-meth}}
 
 \begin{methoddesc}[server]{get_config}{}
-  Similar to \code{req.get_config()}, but returns a config pointed to
-  by \code{server->module_config} Apache config vector. 
+  Similar to \code{req.get_config()}, but returns a table object holding
+  only the mod_python configuration defined at global scope within the
+  Apache configuration. That is, outside of the context of any VirtualHost,
+  Location, Directory or Files directives.
 \end{methoddesc}
 
 \begin{methoddesc}[server]{register_cleanup}{request, callable\optional{, data}}

Modified: httpd/mod_python/trunk/lib/python/mod_python/__init__.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/lib/python/mod_python/__init__.py?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/__init__.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/__init__.py Sat Mar  4 16:38:19 2006
@@ -20,5 +20,5 @@
 __all__ = ["apache", "cgihandler", "psp",
            "publisher", "util", "python22"]
 
-version = "3.3.0-dev-20060226"
+version = "3.3.0-dev-20060305"
 

Modified: httpd/mod_python/trunk/src/include/mpversion.h
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/include/mpversion.h?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/include/mpversion.h (original)
+++ httpd/mod_python/trunk/src/include/mpversion.h Sat Mar  4 16:38:19 2006
@@ -1,5 +1,5 @@
 #define MPV_MAJOR 3
 #define MPV_MINOR 3
 #define MPV_PATCH 0
-#define MPV_BUILD 20060226
-#define MPV_STRING "3.3.0-dev-20060226"
+#define MPV_BUILD 20060305
+#define MPV_STRING "3.3.0-dev-20060305"

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/mod_python.c?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Sat Mar  4 16:38:19 2006
@@ -1513,7 +1513,7 @@
 
     const char *rc = python_directive(cmd, mconfig, "PythonPath", val);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
         return python_directive(cmd, conf, "PythonPath", val);
@@ -1531,7 +1531,7 @@
                                                const char *val) {
     const char *rc = python_directive(cmd, mconfig, "PythonInterpreter", val);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
         return python_directive(cmd, conf, "PythonInterpreter", val);
@@ -1549,7 +1549,7 @@
                                          int val) {
     const char *rc = python_directive_flag(mconfig, "PythonDebug", val, 0);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
 
@@ -1568,7 +1568,7 @@
                                              int val) {
     const char *rc = python_directive_flag(mconfig, "PythonEnablePdb", val, 0);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
         return python_directive_flag(conf, "PythonEnablePdb", val, 0);
@@ -1587,7 +1587,7 @@
                                                       void *mconfig, int val) {
     const char *rc = python_directive_flag(mconfig, "PythonInterpPerDirective", val, 0);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
         return python_directive_flag(conf, "PythonInterpPerDirective", val, 0);
@@ -1618,7 +1618,7 @@
                                               void *mconfig, int val) {
     const char *rc = python_directive_flag(mconfig, "PythonAutoReload", val, 1);
 
-    if (!rc) {
+    if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
         return python_directive_flag(conf, "PythonAutoReload", val, 1);

Modified: httpd/mod_python/trunk/test/htdocs/tests.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/htdocs/tests.py?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/htdocs/tests.py (original)
+++ httpd/mod_python/trunk/test/htdocs/tests.py Sat Mar  4 16:38:19 2006
@@ -777,6 +777,16 @@
         req.write('test failed')
         return apache.OK
 
+def req_server_get_config(req):
+
+    if req.server.get_config().get("PythonDebug","0") != "0" or \
+            req.get_config().get("PythonDebug","0") != "1":
+        req.write('test failed')
+    else:
+        req.write('test ok')
+
+    return apache.OK
+
 def fileupload(req):
     from mod_python import util
     import md5

Modified: httpd/mod_python/trunk/test/test.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?rev=383231&r1=383230&r2=383231&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/test.py (original)
+++ httpd/mod_python/trunk/test/test.py Sat Mar  4 16:38:19 2006
@@ -1008,6 +1008,26 @@
         if (rsp != "test ok"):
             self.fail(`rsp`)
 
+    def test_req_server_get_config_conf(self):
+
+        c = VirtualHost("*",
+                        ServerName("test_req_server_get_config"),
+                        DocumentRoot(DOCUMENT_ROOT),
+                        PythonDebug("Off"),
+                        Directory(DOCUMENT_ROOT,
+                                  SetHandler("mod_python"),
+                                  PythonHandler("tests::req_server_get_config"),
+                                  PythonDebug("On")))
+        return str(c)
+
+    def test_req_server_get_config(self):
+
+        print "\n  * Testing req.server.get_config"
+
+        rsp = self.vhost_get("test_req_server_get_config")
+        if (rsp != "test ok"):
+            self.fail(`rsp`)
+
     def test_fileupload_conf(self):
 
         c = VirtualHost("*",
@@ -2149,6 +2169,7 @@
         perRequestSuite.addTest(PerRequestTestCase("test_req_sendfile2"))
         perRequestSuite.addTest(PerRequestTestCase("test_req_sendfile3"))
         perRequestSuite.addTest(PerRequestTestCase("test_req_handler"))
+        perRequestSuite.addTest(PerRequestTestCase("test_req_server_get_config"))
         perRequestSuite.addTest(PerRequestTestCase("test_fileupload"))
         perRequestSuite.addTest(PerRequestTestCase("test_fileupload_embedded_cr"))
         perRequestSuite.addTest(PerRequestTestCase("test_fileupload_split_boundary"))