Replacing some print statements with warnings.
This commit is contained in:
@@ -459,11 +459,14 @@ class Pecan(object):
|
||||
elif cfg.get('content_type') is not None and \
|
||||
request.pecan['content_type'] not in cfg.get('content_types', {}):
|
||||
|
||||
print "Controller '%s' defined does not support content_type '%s'. Supported type(s): %s" % (
|
||||
import warnings
|
||||
warnings.warn("Controller '%s' defined does not support content_type '%s'. Supported type(s): %s" % (
|
||||
controller.__name__,
|
||||
request.pecan['content_type'],
|
||||
cfg.get('content_types', {}).keys()
|
||||
)
|
||||
),
|
||||
RuntimeWarning
|
||||
)
|
||||
raise exc.HTTPNotFound
|
||||
|
||||
# get a sorted list of hooks, by priority
|
||||
|
||||
@@ -39,7 +39,11 @@ def lookup_controller(obj, url_path):
|
||||
cross_boundary(prev_obj, obj)
|
||||
break
|
||||
except TypeError, te:
|
||||
print 'Got exception calling lookup(): %s (%s)' % (te, te.args)
|
||||
import warnings
|
||||
warnings.warn(
|
||||
'Got exception calling lookup(): %s (%s)' % (te, te.args),
|
||||
RuntimeWarning
|
||||
)
|
||||
else:
|
||||
raise exc.HTTPNotFound
|
||||
|
||||
|
||||
Reference in New Issue
Block a user