#31070: Add a check for URLconfs that mix named and unnamed capture groups
-------------------------------------+-------------------------------------
     Reporter:  Baptiste Mispelon    |                    Owner:  Baptiste
                                     |  Mispelon
         Type:  New feature          |                   Status:  assigned
    Component:  Core (System         |                  Version:  master
  checks)                            |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

 Right, OK... So I come back to my initial thought:

 > Rather (I think) in the mixed case, we should just use "Prefer named
 capturing groups", assuming folks know what they´re doing if they´ve used
 just unnamed groups.

 i.e. the bit I'm (still) not quite following you to is:

 > As a remedy, it would suggest converting the unnamed groups to non-
 capturing groups ((?:\d+) syntax with our current example).

 They'd still be mixed patterns and fail getting passed to the view.

 This:

 > ... assume that the current pattern was working correctly as-is.

 I think that's probably not right no? I have a mixed pattern, of which
 only the named groups will ever be passed to the view, so I don't see how
 the pattern can be thought of as working correctly. ??? (Sorry if I'm
 being really slow here...)

 So tl;dr: I think we should have a warning for mixed patterns, but say to
 use all named groups, rather than a mix.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31070#comment:7>
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/067.7ac3277d1ccd24ee0393681f1387182d%40djangoproject.com.

Reply via email to