[Django] #35725: Flatpage's get_absolute_url Throws a Regex Tantrum

15 views
Skip to first unread message

Django

unread,
Sep 2, 2024, 12:10:57 AM9/2/24
to django-...@googlegroups.com
#35725: Flatpage's get_absolute_url Throws a Regex Tantrum
-------------------------------------+-------------------------------------
Reporter: JasonLovesDoggo | Type: Bug
Status: new | Component:
| contrib.flatpages
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
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`:

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

Replacing this line with the following seemingly resolves the issue:

{{{#!python
return reverse(flatpage, args=(url,))
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35725>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 2, 2024, 12:16:22 AM9/2/24
to django-...@googlegroups.com
#35725: Flatpage's get_absolute_url Throws a Regex Tantrum
-------------------------------------+-------------------------------------
Reporter: Jason Cameron | Owner: Jason
| Cameron
Type: Bug | Status: assigned
Component: contrib.flatpages | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jason Cameron):

* owner: (none) => Jason Cameron
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35725#comment:1>

Django

unread,
Sep 2, 2024, 1:34:23 AM9/2/24
to django-...@googlegroups.com
#35725: Flatpage's get_absolute_url Throws a Regex Tantrum
-------------------------------------+-------------------------------------
Reporter: Jason Cameron | Owner: Jason
| Cameron
Type: Bug | Status: assigned
Component: contrib.flatpages | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jason Cameron):

Here is a full traceback of it. https://project-
metropolis.sentry.io/share/issue/4ee5940a0f6646d38732140ee87ba6c6/
--
Ticket URL: <https://code.djangoproject.com/ticket/35725#comment:2>

Django

unread,
Sep 2, 2024, 3:32:11 AM9/2/24
to django-...@googlegroups.com
#35725: Flatpage's get_absolute_url Throws a Regex Tantrum
-------------------------------------+-------------------------------------
Reporter: Jason Cameron | Owner: Jason
| Cameron
Type: Bug | Status: closed
Component: contrib.flatpages | Version: 5.1
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* resolution: => needsinfo
* status: assigned => closed

Comment:

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?
--
Ticket URL: <https://code.djangoproject.com/ticket/35725#comment:3>
Reply all
Reply to author
Forward
0 new messages