endpoint is optional for modules. This fixes #86

This commit is contained in:
Armin Ronacher 2010-07-15 14:35:02 +02:00
parent b1790cca55
commit f5b8c08284
4 changed files with 35 additions and 7 deletions

View file

@ -59,6 +59,15 @@ else:
_tojson_filter = json.dumps
def _endpoint_from_view_func(view_func):
"""Internal helper that returns the default endpoint for a given
function. This always is the function name.
"""
assert view_func is not None, 'expected view func if endpoint ' \
'is not provided.'
return view_func.__name__
def jsonify(*args, **kwargs):
"""Creates a :class:`~flask.Response` with the JSON representation of
the given arguments with an `application/json` mimetype. The arguments