From 51e4a58a85bc1500d1400ba7d633d570f6296745 Mon Sep 17 00:00:00 2001 From: Jim Rollenhagen Date: Sat, 5 Nov 2011 09:02:05 -0400 Subject: [PATCH] Fix flask issue #338 Give POST its own url_rule to avoid TypeError. --- docs/views.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/views.rst b/docs/views.rst index 441620a6..37904729 100644 --- a/docs/views.rst +++ b/docs/views.rst @@ -210,7 +210,8 @@ and explicitly mentioning the methods for each:: user_view = UserAPI.as_view('user_api') app.add_url_rule('/users/', defaults={'user_id': None}, - view_func=user_view, methods=['GET', 'POST']) + view_func=user_view, methods=['GET',]) + app.add_url_rule('/users/', view_func=user_view, methods=['POST',]) app.add_url_rule('/users/', view_func=user_view, methods=['GET', 'PUT', 'DELETE']) @@ -220,7 +221,8 @@ registration code:: def register_api(view, endpoint, url, pk='id', pk_type='int'): view_func = view.as_view(endpoint) app.add_url_rule(url, defaults={pk: None}, - view_func=view_func, methods=['GET', 'POST']) + view_func=view_func, methods=['GET',]) + app.add_url_rule(url, view_func=view_func, methods=['POST',]) app.add_url_rule('%s<%s:%s>' % (url, pk), view_func=view_func, methods=['GET', 'PUT', 'DELETE'])