Skip to content

Mentions broken in Wagtail 6 #54

Description

@garrettc

Django==5.1.2
django-wm==4.1.1
wagtail==6.3.2

You previously helped me get django-wm working in Wagtail (see: #45) but I've come across a problem since upgrading to Wagtail 6. I've only noticed it recently as I don't get a lot of traffic, but noticed a recent post didn't have any mentions attached, even though I know it was referenced a few times.

$ python manage.py pending_mentions --settings=core.settings.production

Checking for pending webmentions [all]...
Traceback (most recent call last):
  File "/Users/garrettc/sandbox/polytechnic/.venv/lib/python3.11/site-packages/mentions/resolution.py", line 85, in get_model_for_url
    model_name = urlpattern_kwargs.pop(contract.URLPATTERNS_MODEL_NAME)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'model_name'

[rest of trace]

File "/Users/garrettc/sandbox/polytechnic/.venv/lib/python3.11/site-packages/wagtail/contrib/routable_page/models.py", line 158, in route
    request.routable_resolver_match = resolver_match
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'routable_resolver_match'

I've stepped through with a debugger, and indeed urlpattern_kwargs is empty, but urlpattern_args is populated.

For the URL 'https://polytechnic.co.uk/blog/2024/12/top-albums-and-films-and-other-stats-for-2024/', match inside resolution.py:get_model_for_url() is set to:

ResolverMatch(
    func=wagtail.views.serve, 
    args=('blog/2024/12/top-albums-and-films-and-other-stats-for-2024/',), 
    kwargs={}, 
    url_name='wagtail_serve', 
    app_names=[], 
    namespaces=[], 
    route='^((?:[\\w\\-]+/)*)$'
)

I haven't changed any of my configuration since #45 apart from the upgrade to Wagtail 6 in November. Any ideas on how to resolve this?

Activity

  1. added a commit that references this issue on Jan 30, 2025
  2. beatonma commented on Jan 30, 2025

    @beatonma
    Owner

    Hey, thanks for the report and sorry it hasn't been working.

    Fix now available in 4.1.2.

    The issue was introduced in Wagtail 6.2: Make routable_resolver_match attribute available on RoutablePageMixin responses. Basically it sets an attribute on the given request object but we were passing a null request object (because none is available at time of webmention processing) so that failed.

    Please let me know if you have any further issues.

  3. garrettc commented on Jan 30, 2025

    @garrettc
    ContributorAuthor

    That's all working now, thank you for sorting it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions