You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the django user model is modified such that the email address is treated as a username, the entries_by_author route cannot find a reverse match, resulting in server error.
ERROR 2019-06-13 13:11:12,433 log 98761 123145480708096 Internal Server Error: /blog/
Traceback (most recent call last):
[ ... blah massive stacktrace ... ]
File "/Users/thc29/.pyenv/versions/tpast/lib/python3.6/site-packages/wagtail/contrib/routable_page/templatetags/wagtailroutablepage_tags.py", line 22, in routablepageurl
routed_url = page.reverse_subpage(url_name, args=args, kwargs=kwargs)
File "/Users/thc29/.pyenv/versions/tpast/lib/python3.6/site-packages/wagtail/contrib/routable_page/models.py", line 85, in reverse_subpage
return self.get_resolver().reverse(name, *args, **kwargs)
File "/Users/thc29/.pyenv/versions/tpast/lib/python3.6/site-packages/django/urls/resolvers.py", line 555, in reverse
return self._reverse_with_prefix(lookup_view, '', *args, **kwargs)
File "/Users/thc29/.pyenv/versions/tpast/lib/python3.6/site-packages/django/urls/resolvers.py", line 622, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'entries_by_author' with arguments '('[email protected]',)' not found. 1 pattern(s) tried: ['author/(?P<author>\\w+)/$']
[13/Jun/2019 13:11:12] "GET /blog/ HTTP/1.1" 500 234407
Not sure about this
I put the pattern author/(?P<author>\\w+)/$ into regex101 and it doesn't match any of the possible inputs I can think of - usernames, email addresses, or tuples as set in this argument (like ('[email protected]',)). So not sure how this works for anybody else either?
Workaround
Override the entry_links.html template (I copied it from puput/templates to myapp/templates/puput) to remove the entries by author link:
Summary
If the django user model is modified such that the email address is treated as a username, the
entries_by_author
route cannot find a reverse match, resulting in server error.Here are the places where
entries_by_author
are defined and used in puput.Error details
Here is how to do django auth with an email username, if you wish to reproduce the error. Alternatively it might be possible to reproduce by setting an email address as a django username.
The abridged error is as follows:
Not sure about this
I put the pattern
author/(?P<author>\\w+)/$
into regex101 and it doesn't match any of the possible inputs I can think of - usernames, email addresses, or tuples as set in this argument (like('[email protected]',)
). So not sure how this works for anybody else either?Workaround
Override the
entry_links.html
template (I copied it frompuput/templates
tomyapp/templates/puput
) to remove the entries by author link:Long Term Solution
Probably the best solution is to adjust the route as per the accepted answer here, since an invalid username in the URL shouldn't bring the server to its knees:
https://stackoverflow.com/questions/32395062/django-urlpattern-for-username
The text was updated successfully, but these errors were encountered: