Opened 2 months ago

Closed 2 months ago

#35725 closed Bug (needsinfo)

Flatpage's get_absolute_url Throws a Regex Tantrum

Reported by: Jason Cameron Owned by: Jason Cameron
Component: contrib.flatpages Version: 5.1
Severity: Normal Keywords:
Cc: Jason Cameron Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

FlatPages' get_absolute_url is encountering a regex error, affecting both the "view on site" feature and the django.contrib.flatpages.sitemaps.FlatPageSitemap. The following error is observed:

Exception Value: redefinition of group name 'url' as group 2; was group 1 at position 17

This issue stems from the following line (L46) in django\contrib\flatpages\models.py:

return reverse(flatpage, kwargs={"url": url})

Replacing this line with the following seemingly resolves the issue:

return reverse(flatpage, args=(url,))

Change History (3)

comment:1 by Jason Cameron, 2 months ago

Owner: set to Jason Cameron
Status: newassigned

comment:3 by Sarah Boyce, 2 months ago

Resolution: needsinfo
Status: assignedclosed

Hi Jason, I can see inside django.contrib.contenttypes.views.shortcut it calls the get_absolute_url for the FlatPage object. In order to be able to replicate this, I need to know the url of that specific object. Can you find that out and let us know?

Note: See TracTickets for help on using tickets.
Back to Top