changeset 4605:edb6cb2cac43

Environment variable MOIN_DEBUGGER=True will enable werkzeug's debugger for the standalone wikiserver
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 22 Feb 2009 22:46:18 +0100
parents 5d94d48eb350
children 619b1dacf4ee
files MoinMoin/wsgiapp.py wiki/server/wikiserverconfig.py wikiserverconfig.py
diffstat 3 files changed, 30 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/wsgiapp.py	Sun Feb 22 20:21:13 2009 +0100
+++ b/MoinMoin/wsgiapp.py	Sun Feb 22 22:46:18 2009 +0100
@@ -246,7 +246,13 @@
         except HTTPException, e:
             response = e
         except error.ConfigurationError, e:
+            # this is stuff the user should see on the web interface:
             response = fatal_response(e)
+        except Exception, e:
+            # have exceptions logged within the moin logging framework:
+            logging.exception("An exception has occurred.")
+            # re-raise exception, so e.g. the debugger middleware gets it
+            raise
 
         return response(environ, start_response)
 
--- a/wiki/server/wikiserverconfig.py	Sun Feb 22 20:21:13 2009 +0100
+++ b/wiki/server/wikiserverconfig.py	Sun Feb 22 22:46:18 2009 +0100
@@ -2,6 +2,7 @@
     Standalone server configuration, you can either use this file or
     commandline options to configure server options.
 """
+import os
 
 from MoinMoin.script.server.standalone import DefaultConfig
 
@@ -24,3 +25,14 @@
     #threadLimit = 10
     #requestQueueSize = 50
 
+    # Use werkzeug's debugging middleware?
+    # debug can be either set to True or False to directly enable/disable
+    # the debugger.
+    # CAUTION: Do not use True for production environments as it might disclose
+    # sensitive informations and even enable doing evil things from the
+    # debugger's web interface!
+    # For convenience, the default behaviour (see below) is to read the
+    # environment variable MOIN_DEBUGGER. Setting it to True will enable the
+    # debugger, anything else (or not setting it) will disable the debugger.
+    debug = os.environ.get('MOIN_DEBUGGER', 'False') == 'True'
+
--- a/wikiserverconfig.py	Sun Feb 22 20:21:13 2009 +0100
+++ b/wikiserverconfig.py	Sun Feb 22 22:46:18 2009 +0100
@@ -2,6 +2,7 @@
     Standalone server configuration, you can either use this file or
     commandline options to configure server options.
 """
+import os
 
 from MoinMoin.script.server.standalone import DefaultConfig
 
@@ -24,3 +25,14 @@
     #threadLimit = 10
     #requestQueueSize = 50
 
+    # Use werkzeug's debugging middleware?
+    # debug can be either set to True or False to directly enable/disable
+    # the debugger.
+    # CAUTION: Do not use True for production environments as it might disclose
+    # sensitive informations and even enable doing evil things from the
+    # debugger's web interface!
+    # For convenience, the default behaviour (see below) is to read the
+    # environment variable MOIN_DEBUGGER. Setting it to True will enable the
+    # debugger, anything else (or not setting it) will disable the debugger.
+    debug = os.environ.get('MOIN_DEBUGGER', 'False') == 'True'
+