Permalink
Browse files

[svn] config file option 'debug' now defaults to false when undefined

--HG--
branch : trunk
  • Loading branch information...
1 parent 6fb461e commit a2579c1d703d41cebedf738c625a8095285e7b78 pjenvey committed Jul 27, 2006
View
@@ -2,6 +2,7 @@ Pylons Changelog
=================
0.9 (**dev**)
+* config file option 'debug' now defaults to false when undefined
* Removed the components directory from the template
* Updated paste.errordocuments support
* Fix for multi-word controller names such that front_page /
@@ -68,7 +68,7 @@ Or the name of the package like this::
Or the debug status like this::
from paste.deploy.converters import asbool
- debug = asbool(config.get('debug', 'true'))
+ debug = asbool(config.get('debug'))
URL Prefix
==========
View
@@ -73,7 +73,7 @@ By default the ``pylons.middleware.error_mapper`` is used. It looks like this::
if kw is None:
kw = {}
codes = [401, 403, 404]
- if not asbool(global_conf.get('debug', 'true')):
+ if not asbool(global_conf.get('debug')):
codes.append(500)
if code in codes:
url = '%s/error/document/?%s'%(get_prefix(environ), urlencode({'message':message, 'code':code}))
View
@@ -109,8 +109,8 @@ def init_app(self, global_conf, app_conf, package):
``global_config``
Several options are expected to be set for a Pylons web application.
They will be loaded from the global_config which has the main Paste
- options. If ``debug`` is set to ``false`` as a global config option,
- the following option *must* be set:
+ options. If ``debug`` is not enabled as a global config option, the
+ following option *must* be set:
* error_to - The email address to send the debug error to
@@ -161,7 +161,7 @@ def init_app(self, global_conf, app_conf, package):
# Load the errorware configuration from the Paste configuration file
# These all have defaults, and emails are only sent if configured and
# if this application is running in production mode
- errorware['debug'] = asbool(global_conf.get('debug', 'true'))
+ errorware['debug'] = asbool(global_conf.get('debug'))
if not errorware['debug']:
errorware['debug'] = False
errorware['error_email'] = global_conf.get('email_to')
View
@@ -4,6 +4,7 @@
import xmlrpclib
from paste.deploy.config import CONFIG
+from paste.deploy.converters import asbool
import pylons
@@ -82,10 +83,10 @@ def _dispatch_call(self):
if isinstance(func, types.MethodType):
response = self._inspect_call(func)
else:
- if CONFIG['global_conf']['debug'] == 'false':
- response = pylons.Response(code=404)
- else:
+ if asbool(CONFIG['global_conf'].get('debug')):
raise NotImplementedError('Action %s is not implemented' % action)
+ else:
+ response = pylons.Response(code=404)
return response
def __call__(self, *args, **kargs):
@@ -152,10 +153,11 @@ def __call__(self, action, **kargs):
action = self._req.environ['pylons.routes_dict'].get('action')
action_method = action.replace('-', '_')
if action_method != RPCController.resource:
- if CONFIG['default']['debug'] == 'false':
- return pylons.Response(code=404)
+ if asbool(CONFIG['global_conf'].get('debug')):
+ raise NotImplementedError('RPCController only supports %s action',
+ RPCController.resource)
else:
- raise NotImplementedError('RPCController only supports %s action', RPCController.resource)
+ return pylons.Response(code=404)
d = self._req.environ['wsgi.input'].read()
params, method = xmlrpclib.loads(d)
View
@@ -34,15 +34,15 @@ def run_wsgi(app, m, req):
def ErrorHandler(app, global_conf, **errorware):
"""ErrorHandler Toggle
- If debug is set, and true, this function will return the
- app wrapped in our customized Paste EvalException middleware
- we have called the ``PylonsEvalException``.
+ If debug is enabled, this function will return the app wrapped in
+ our customized Paste EvalException middleware we have called the
+ ``PylonsEvalException``.
Otherwise, the app will be wrapped in the Paste ErrorMiddleware, and
the ``errorware`` dict will be passed into it.
"""
- if asbool(global_conf.get('debug', 'true')):
+ if asbool(global_conf.get('debug')):
from pylons.error import PylonsEvalException
app = PylonsEvalException(app, global_conf, **errorware)
else:
@@ -64,7 +64,7 @@ def ErrorHandler(app, global_conf, **errorware):
def error_mapper(code, message, environ, global_conf=None, **kw):
codes = [401, 403, 404]
- if not asbool(global_conf.get('debug', 'true')):
+ if not asbool(global_conf.get('debug')):
codes.append(500)
if code in codes:
url = '%s/error/document/?%s'%(get_prefix(environ), urlencode({'message':message, 'code':code}))
@@ -47,7 +47,8 @@ def make_app(global_conf, **app_conf):
# @@@ Cascade @@@
app = Cascade([static_app, javascripts_app, app])
- # @@@ Display error documents for 401, 403, 404 status codes (if debug is False also intercepts 500) @@@
+ # @@@ Display error documents for 401, 403, 404 status codes (if debug is disabled also
+ # intercepts 500) @@@
app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
# @@@ Establish the Registry for this application @@@

0 comments on commit a2579c1

Please sign in to comment.