Replacing some print statements with warnings.

This commit is contained in:
Ryan Petrello
2012-03-07 12:12:20 -05:00
parent 6d098bb5ab
commit 3857c3e2cd
2 changed files with 10 additions and 3 deletions

View File

@@ -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

View File

@@ -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