#31069: Change in behavior for optional re matches.
--------------------------------+------------------------------------
Reporter: Terence Honles | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------+------------------------------------
Changes (by felixxm):
* severity: Release blocker => Normal
Comment:
Issue that Terence described is that we no longer pass `None` for named
groups that are not provided. The following example
{{{
def modules(request, format):
return render(request, 'home.html')
urlpatterns = [
path('admin/', admin.site.urls),
re_path(r'^module1/(?P<format>(html|json|xml))?/?$', modules,
name='modules1'),
]
}}}
works in Django 2.2 when we call `http://localhost:8000/module1/` but
throws an error in Django 3.0:
{{{
response = wrapped_callback(request, *callback_args,
**callback_kwargs)
TypeError: modules() missing 1 required positional argument: 'format'
}}}
IMO this behavior is correct, see
[https://code.djangoproject.com/ticket/31069#comment:1 comment].
I'm decreasing a severity because it's a documentation issue and can be
backported at anytime.
--
Ticket URL: <https://code.djangoproject.com/ticket/31069#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/071.666416343ba47299c1208a235c31b876%40djangoproject.com.