[FIX] website: fix sitemap to avoid to get post route inside

Route with method="['POST']" should not appear in sitemap

This code had never works.

rule.method is not the list of methods declared on the endpoint but "the HTTP
method for the rule if there are different URLs for different methods on
the same endpoint" (src http://werkzeug.pocoo.org/docs/0.11/routing/)

The new code uses the method declared on endpoint and so will avoid to add
endpoint with method declared and wich doesn't support GET.
This commit is contained in:
Jeremy Kersten 2016-01-11 12:21:55 +01:00
parent 148c1ed51c
commit 33e84a6622
1 changed files with 2 additions and 1 deletions

View File

@ -347,7 +347,8 @@ class website(osv.osv):
:rtype: bool
"""
endpoint = rule.endpoint
methods = rule.methods or ['GET']
methods = endpoint.routing.get('method') or ['GET']
converters = rule._converters.values()
if not ('GET' in methods
and endpoint.routing['type'] == 'http'