Python deprecated usage of flags not at the start of a regular expression 
[0], e.g. 'CaseInsensitive(?i)' instead of '(?i)CaseInsensitive'.

Deprecation warnings shows up in a few URL tests that are using (?i) to get 
case-insensitive matching of URLpatterns. However, because the URL resolver 
prefixes '^/' [or get_script_prefix()] to all patterns [1], the warning 
happens even if the regex group is at the start of a urlpattern, e.g. 

/home/tim/code/django/django/urls/resolvers.py:464: DeprecationWarning: 
Flags not at the start of the expression ^\/(?i)CaseInsensiti (truncated)
  if re.search('^%s%s' % (re.escape(_prefix), pattern), candidate_pat % 
candidate_subs, re.UNICODE):

A better sense of what's affected can be seen on my PR that removes support 
for the ignored groups [2]. All this landed in 2008 in Malcolm's rewrite of 
URL parsing [3].

I'm not sure if any of these groups are used in URLpatterns in the wild or 
if it's okay to proceed with the removal. To keep the feature, I imagine 
Django would need to do some extraction of flags from URLpatterns and put 
them at the start of patterns, but I'm not too sure.

Thanks for your feedback.

[0] http://bugs.python.org/issue22493
[1] 
https://github.com/django/django/blob/5d28fef8f9329e440ee67cefc900dbf89f4c524c/django/urls/resolvers.py#L464
[2] https://github.com/django/django/pull/7701
[3] 
https://github.com/django/django/commit/a63a83e5d88cd1696d1c40e89f254f69116c6800

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a1489dba-c602-4df4-87c4-3edf2ada702e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to