Update example in static_site_generation docs to use new-style route API

This commit is contained in:
Matt Westcott 2014-07-04 18:24:01 +01:00
parent 06c79d4866
commit 4fde40df92

View file

@ -45,6 +45,8 @@ For example, let's say we have a Blog Index which uses pagination. We can overri
.. code:: python
from wagtail.wagtailcore.url_routing import RouteResult
class BlogIndex(Page):
...
@ -54,7 +56,7 @@ For example, let's say we have a Blog Index which uses pagination. We can overri
def route(self, request, path_components):
if self.live and len(path_components) == 2 and path_components[0] == 'page':
try:
return self.serve(request, page=int(path_components[1]))
return RouteResult(self, kwargs={'page': int(path_components[1])})
except (TypeError, ValueError):
pass