Hi,

Since url() is deprecated I think it should be removed. Although I'm not
sure why it was deprecated and renamed to re_path(). It took me about 10
minutes to replace the calls to "url(regex=" with "re_path(route=" (I
usually prefer to call all functions by parameter name) and replace the
imports to django.urls (instead of django.conf.urls). I think no harm will
be done when deprecating url(). Users can either replace url() with
re_path(), or if they want they can declare they own function, like is
declared in Django:

def url(regex, view, kwargs=None, name=None):

    return re_path(regex, view, kwargs, name)

And then import it, so they can keep using url() if they want to. So to
conclude, I'm not sure what's the reason why url() was deprecated and
renamed to re_path(), but since it has been done I think it should be
removed in Django 4.0.

Uri.
אורי
u...@speedy.net


On Tue, May 5, 2020 at 6:42 PM Collin Anderson <cmawebs...@gmail.com> wrote:

> Hi All,
>
> Are we _sure_ we want to completely get rid of url()?
>
> Yesterday, url() was given a RemovedInDjango40Warning [PR]. The removal
> was approved as part of the new path() syntax back in 2017 [DEP 0201].
>
> Is this really worth it? It's only a *few lines of code* to keep backward
> compatibility, and it seems to me it would take *almost no work to
> maintain* that compatibility shim compared to the countless programmer
> hours needed to upgrade their code, including many unpaid programmers
> working on open source projects. I'll personally need to do a find/replace
> for url() to re_path() across my ~20 projects, and update all of the
> imports. Isn't this *useless code churn*?
>
> Yes, there's an advantage to having one and only one way to do it, so I
> agree we should encourage people to use re_path() instead of url(), but
> shouldn't we also make it *as easy as possible to upgrade django*? Is
> getting rid of url() really worth the cost?
>
> Yes, the removal is still ~3+ years away, but that's a question of _when_
> not _if_.
>
> If we want, we _could_ deprecate url() without giving it an actual removal
> date [Compatibility Discussion] and leave the compatibility shim around
> longer, if not indefinitely.
>
> Thanks,
> Collin
>
>
> [PR] https://github.com/django/django/pull/12855
>
> [DEP 0201]
> https://github.com/django/deps/blob/master/final/0201-simplified-routing-syntax.rst
>
> [Compatibility Discussion]
> https://groups.google.com/d/topic/django-developers/asqnjcYPnms/discussion
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/17899c17-2c07-4a80-baa5-e0a348d9512c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/17899c17-2c07-4a80-baa5-e0a348d9512c%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CABD5YeFAZZT0q8twtchWaBEUtUQY1u%3DC8eVekCfKHxHwS%2B7gkg%40mail.gmail.com.

Reply via email to