torchbox/wagtail — pull request #818 by zerolab (2014-11-17 10:44:55+00:00)
Title: Fix 'TypeError at /admin/pages/ID/edit/preview/ serve_subpage() takes exactly 2 arguments (1 given)' error

Consider a simple RoutablePage setup:

```
class EventPage(RoutablePageMixin, Page)
subpage_urls = (
url(r'^$', 'upcoming', name='upcoming_events'),
url(r'^archive/$', 'archive', name='arhive'),
)

def upcoming(self, request):
pass

def archive(self, request):
pass
```

Trying to preview any page using the RoutablePageMixin results in:

```
Internal Server Error: /admin/pages/49/edit/preview/
Traceback (most recent call last):
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py", line 22, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/wagtail/wagtailadmin/views/pages.py", line 419, in preview_on_edit
response = page.serve_preview(page.dummy_request(), preview_mode)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/wagtail/contrib/wagtailroutablepage/models.py", line 70, in serve_preview
return view(*args, **kwargs)
File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/django/views/decorators/vary.py", line 19, in inner_func
response = func(*args, **kwargs)
TypeError: upcoming() takes exactly 2 arguments (1 given)
```

This pull request aims to fix that.

Cheers,
Dan