add warning for when content_type mismatch

This commit is contained in:
Mark McClain
2011-03-08 21:53:57 -05:00
parent bbb0a04114
commit 0d8d2f5f5e

View File

@@ -387,6 +387,12 @@ class Pecan(object):
request.pecan['content_type'] = cfg.get('content_type', 'text/html')
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" % (
controller.__name__,
request.pecan['content_type'],
cfg.get('content_types', {}).keys()
)
raise exc.HTTPNotFound
# get a sorted list of hooks, by priority