From 3857c3e2cddde13267802fe0fe67c967be3c2b61 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Wed, 7 Mar 2012 12:12:20 -0500 Subject: [PATCH] Replacing some print statements with warnings. --- pecan/core.py | 7 +++++-- pecan/routing.py | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pecan/core.py b/pecan/core.py index 73d224c..38d3cb8 100644 --- a/pecan/core.py +++ b/pecan/core.py @@ -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 diff --git a/pecan/routing.py b/pecan/routing.py index 8f22bc9..9739520 100644 --- a/pecan/routing.py +++ b/pecan/routing.py @@ -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