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

@ -23,7 +23,7 @@ from werkzeug.routing import Map, Rule
from werkzeug.exceptions import HTTPException, InternalServerError, NotFound
from .helpers import _PackageBoundObject, url_for, get_flashed_messages, \
_tojson_filter
_tojson_filter, _endpoint_from_view_func
from .wrappers import Request, Response
from .config import ConfigAttribute, Config
from .ctx import _RequestContext
@ -496,9 +496,7 @@ class Flask(_PackageBoundObject):
added and handled by the standard request handling.
"""
if endpoint is None:
assert view_func is not None, 'expected view func if endpoint ' \
'is not provided.'
endpoint = view_func.__name__
endpoint = _endpoint_from_view_func(view_func)
options['endpoint'] = endpoint
methods = options.pop('methods', ('GET',))
provide_automatic_options = False