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 02:01:08 UTC

svn commit: r383246 - in /httpd/mod_python/trunk: Doc/appendixc.tex lib/python/mod_python/apache.py src/mod_python.c test/htdocs/tests.py test/test.py

Author: grahamd
Date: Sat Mar  4 17:01:07 2006
New Revision: 383246

URL: http://svn.apache.org/viewcvs?rev=383246&view=rev
Log:
Setting PythonDebug to Off, wasn't overriding On setting in parent scope.
(MODPYTHON-134)

Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/lib/python/mod_python/apache.py
    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=383246&r1=383245&r2=383246&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Sat Mar  4 17:01:07 2006
@@ -64,6 +64,10 @@
       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.
+    \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-134]{MODPYTHON-134})
+      Setting \code{PythonDebug} to \code{Off}, wasn't overriding \code{On}
+      setting in parent scope.
   \end{itemize}
 
 \chapter{Changes from Version (3.1.4)\label{app-changes}}

Modified: httpd/mod_python/trunk/lib/python/mod_python/apache.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/lib/python/mod_python/apache.py?rev=383246&r1=383245&r2=383246&view=diff
==============================================================================
--- httpd/mod_python/trunk/lib/python/mod_python/apache.py (original)
+++ httpd/mod_python/trunk/lib/python/mod_python/apache.py Sat Mar  4 17:01:07 2006
@@ -100,7 +100,7 @@
             if object:
 
                 # call the object
-                if config.has_key("PythonEnablePdb"):
+                if int(config.get("PythonEnablePdb", 0)):
                     result = pdb.runcall(object, conn)
                 else:
                     result = object(conn)
@@ -181,7 +181,7 @@
             if object:
 
                 # call the object
-                if config.has_key("PythonEnablePdb"):
+                if int(config.get("PythonEnablePdb", 0)):
                     pdb.runcall(object, filter)
                 else:
                     object(filter)
@@ -293,7 +293,7 @@
                 if object:
 
                     # call the object
-                    if config.has_key("PythonEnablePdb"):
+                    if int(config.get("PythonEnablePdb", 0)):
                         result = pdb.runcall(object, req)
                     else:
                         result = object(req)

Modified: httpd/mod_python/trunk/src/mod_python.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/mod_python.c?rev=383246&r1=383245&r2=383246&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/mod_python.c (original)
+++ httpd/mod_python/trunk/src/mod_python.c Sat Mar  4 17:01:07 2006
@@ -831,8 +831,7 @@
  *
  */
 
-static const char *python_directive_flag(void * mconfig, 
-                                         char *key, int val, int set)
+static const char *python_directive_flag(void * mconfig, char *key, int val)
 {
     py_config *conf;
 
@@ -842,12 +841,7 @@
         apr_table_set(conf->directives, key, "1");
     }
     else {
-        if (set) {
-            apr_table_set(conf->directives, key, "0");
-        }
-        else {
-            apr_table_unset(conf->directives, key);
-        }
+        apr_table_set(conf->directives, key, "0");
     }
 
     return NULL;
@@ -956,7 +950,7 @@
         return s;
     }
     else {
-        if ((s = apr_table_get(conf->directives, "PythonInterpPerDirectory"))) {
+        if ((s = apr_table_get(conf->directives, "PythonInterpPerDirectory")) && (strcmp(s, "1") == 0)) {
             
             /* base interpreter on directory where the file is found */
             if (req && ap_is_directory(req->pool, req->filename)) {
@@ -985,7 +979,7 @@
                     return NULL;
             }
         }
-        else if (apr_table_get(conf->directives, "PythonInterpPerDirective")) {
+        else if ((s = apr_table_get(conf->directives, "PythonInterpPerDirective")) && (strcmp(s, "1") == 0)) {
 
             /* 
              * base interpreter name on directory where the handler directive
@@ -1547,13 +1541,13 @@
  */
 static const char *directive_PythonDebug(cmd_parms *cmd, void *mconfig,
                                          int val) {
-    const char *rc = python_directive_flag(mconfig, "PythonDebug", val, 0);
+    const char *rc = python_directive_flag(mconfig, "PythonDebug", val);
 
     if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
 
-        return python_directive_flag(conf, "PythonDebug", val, 0);
+        return python_directive_flag(conf, "PythonDebug", val);
     }
     return rc;
 }
@@ -1566,12 +1560,12 @@
  */
 static const char *directive_PythonEnablePdb(cmd_parms *cmd, void *mconfig,
                                              int val) {
-    const char *rc = python_directive_flag(mconfig, "PythonEnablePdb", val, 0);
+    const char *rc = python_directive_flag(mconfig, "PythonEnablePdb", val);
 
     if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
-        return python_directive_flag(conf, "PythonEnablePdb", val, 0);
+        return python_directive_flag(conf, "PythonEnablePdb", val);
     }
     return rc;
 }
@@ -1585,12 +1579,12 @@
 
 static const char *directive_PythonInterpPerDirective(cmd_parms *cmd, 
                                                       void *mconfig, int val) {
-    const char *rc = python_directive_flag(mconfig, "PythonInterpPerDirective", val, 0);
+    const char *rc = python_directive_flag(mconfig, "PythonInterpPerDirective", val);
 
     if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
-        return python_directive_flag(conf, "PythonInterpPerDirective", val, 0);
+        return python_directive_flag(conf, "PythonInterpPerDirective", val);
     }
     return rc;
 }
@@ -1604,7 +1598,7 @@
 
 static const char *directive_PythonInterpPerDirectory(cmd_parms *cmd, 
                                                       void *mconfig, int val) {
-    return python_directive_flag(mconfig, "PythonInterpPerDirectory", val, 0);
+    return python_directive_flag(mconfig, "PythonInterpPerDirectory", val);
 }
 
 /**
@@ -1616,12 +1610,12 @@
 
 static const char *directive_PythonAutoReload(cmd_parms *cmd, 
                                               void *mconfig, int val) {
-    const char *rc = python_directive_flag(mconfig, "PythonAutoReload", val, 1);
+    const char *rc = python_directive_flag(mconfig, "PythonAutoReload", val);
 
     if (!cmd->path) {
         py_config *conf = ap_get_module_config(cmd->server->module_config,
                                                &python_module);
-        return python_directive_flag(conf, "PythonAutoReload", val, 1);
+        return python_directive_flag(conf, "PythonAutoReload", val);
     }
     return rc;
 }

Modified: httpd/mod_python/trunk/test/htdocs/tests.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/htdocs/tests.py?rev=383246&r1=383245&r2=383246&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/htdocs/tests.py (original)
+++ httpd/mod_python/trunk/test/htdocs/tests.py Sat Mar  4 17:01:07 2006
@@ -779,8 +779,8 @@
 
 def req_server_get_config(req):
 
-    if req.server.get_config().get("PythonDebug","0") != "0" or \
-            req.get_config().get("PythonDebug","0") != "1":
+    if req.server.get_config().get("PythonDebug","0") != "1" or \
+            req.get_config().get("PythonDebug","0") != "0":
         req.write('test failed')
     else:
         req.write('test ok')

Modified: httpd/mod_python/trunk/test/test.py
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/test/test.py?rev=383246&r1=383245&r2=383246&view=diff
==============================================================================
--- httpd/mod_python/trunk/test/test.py (original)
+++ httpd/mod_python/trunk/test/test.py Sat Mar  4 17:01:07 2006
@@ -1013,16 +1013,16 @@
         c = VirtualHost("*",
                         ServerName("test_req_server_get_config"),
                         DocumentRoot(DOCUMENT_ROOT),
-                        PythonDebug("Off"),
+                        PythonDebug("On"),
                         Directory(DOCUMENT_ROOT,
                                   SetHandler("mod_python"),
                                   PythonHandler("tests::req_server_get_config"),
-                                  PythonDebug("On")))
+                                  PythonDebug("Off")))
         return str(c)
 
     def test_req_server_get_config(self):
 
-        print "\n  * Testing req.server.get_config"
+        print "\n  * Testing req.server.get_config()"
 
         rsp = self.vhost_get("test_req_server_get_config")
         if (rsp != "test ok"):