Projet

Général

Profil

0002-django4-fix-urls-deprecation-warnings-68573.patch

A. Berriot, 31 août 2022 09:49

Télécharger (10,2 ko)

Voir les différences:

Subject: [PATCH 2/4] django4: fix urls deprecation warnings (#68573)

 welco/apps.py                 |  6 ++--
 welco/sources/counter/urls.py |  4 +--
 welco/sources/mail/urls.py    | 18 +++++-----
 welco/sources/phone/urls.py   | 14 ++++----
 welco/urls.py                 | 62 +++++++++++++++++------------------
 5 files changed, 52 insertions(+), 52 deletions(-)
welco/apps.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17
from django.apps import apps
18
from django.conf.urls import include, url
18
from django.urls import include, re_path
19 19

  
20 20

  
21 21
def register_urls(urlpatterns):
......
25 25
        if hasattr(app, 'get_before_urls'):
26 26
            urls = app.get_before_urls()
27 27
            if urls:
28
                pre_urls.append(url('^', include(urls)))
28
                pre_urls.append(re_path('^', include(urls)))
29 29
        if hasattr(app, 'get_after_urls'):
30 30
            urls = app.get_after_urls()
31 31
            if urls:
32
                post_urls.append(url('^', include(urls)))
32
                post_urls.append(re_path('^', include(urls)))
33 33
    return pre_urls + urlpatterns + post_urls
welco/sources/counter/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path
18 18

  
19 19
from . import views
20 20

  
21 21
urlpatterns = [
22
    url(r'^ajax/counter/zone/$', views.zone, name='counter-zone'),
22
    path('ajax/counter/zone/', views.zone, name='counter-zone'),
23 23
]
welco/sources/mail/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18

  
19 19
from .views import edit_note, feeder, mail_count, mail_response, note, qualification_save, reject, viewer
20 20

  
21 21
urlpatterns = [
22
    url(r'^mail/viewer/$', viewer, name='mail-viewer'),
23
    url(r'^mail/feeder/$', feeder, name='mail-feeder'),
24
    url(r'^ajax/mail/reject$', reject, name='mail-reject'),
25
    url(r'^ajax/qualification-mail-save$', qualification_save, name='qualif-mail-save'),
26
    url(r'^ajax/mail/edit-note/$', edit_note, name='mail-edit-note'),
27
    url(r'^ajax/mail/note/(?P<pk>\w+)$', note, name='mail-note'),
28
    url(r'^ajax/count/mail/$', mail_count, name='mail-count'),
29
    url(r'^api/mail/response/$', mail_response, name='mail-api-response'),
22
    path('mail/viewer/', viewer, name='mail-viewer'),
23
    path('mail/feeder/', feeder, name='mail-feeder'),
24
    path('ajax/mail/reject', reject, name='mail-reject'),
25
    path('ajax/qualification-mail-save', qualification_save, name='qualif-mail-save'),
26
    path('ajax/mail/edit-note/', edit_note, name='mail-edit-note'),
27
    re_path(r'^ajax/mail/note/(?P<pk>\w+)$', note, name='mail-note'),
28
    path('ajax/count/mail/', mail_count, name='mail-count'),
29
    path('api/mail/response/', mail_response, name='mail-api-response'),
30 30
]
welco/sources/phone/urls.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from django.conf.urls import url
17
from django.urls import path, re_path
18 18

  
19 19
from . import views
20 20

  
21 21
urlpatterns = [
22
    url(r'^ajax/phone/zone/$', views.zone, name='phone-zone'),
23
    url(r'^api/phone/call-event/$', views.call_event, name='phone-call-event'),
24
    url(r'^api/phone/active-call/(?P<pk>\w+)/$', views.active_call, name='phone-active-call'),
25
    url(r'^api/phone/current-calls/$', views.current_calls, name='phone-current-calls'),
26
    url(r'^api/phone/take-line/$', views.take_line, name='phone-take-line'),
27
    url(r'^api/phone/release-line/$', views.release_line, name='phone-release-line'),
22
    path('ajax/phone/zone/', views.zone, name='phone-zone'),
23
    path('api/phone/call-event/', views.call_event, name='phone-call-event'),
24
    re_path(r'^api/phone/active-call/(?P<pk>\w+)/$', views.active_call, name='phone-active-call'),
25
    path('api/phone/current-calls/', views.current_calls, name='phone-current-calls'),
26
    path('api/phone/take-line/', views.take_line, name='phone-take-line'),
27
    path('api/phone/release-line/', views.release_line, name='phone-release-line'),
28 28
]
welco/urls.py
16 16

  
17 17
from ckeditor import views as ckeditor_views
18 18
from django.conf import settings
19
from django.conf.urls import include, url
20 19
from django.conf.urls.static import static
21 20
from django.contrib import admin
22 21
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
22
from django.urls import include, path, re_path
23 23
from django.views.decorators.cache import never_cache
24 24

  
25 25
import welco.contacts.views
......
30 30
from .kb.views import kb_manager_required
31 31

  
32 32
urlpatterns = [
33
    url(r'^$', welco.views.home, name='home'),
34
    url(r'^mail/$', welco.views.home_mail, name='home-mail'),
35
    url(r'^phone/$', welco.views.home_phone, name='home-phone'),
36
    url(r'^counter/$', welco.views.home_counter, name='home-counter'),
37
    url(r'^', include('welco.sources.phone.urls')),
38
    url(r'^', include('welco.sources.counter.urls')),
39
    url(r'^ajax/qualification$', welco.views.qualification, name='qualif-zone'),
40
    url(
33
    path('', welco.views.home, name='home'),
34
    path('mail/', welco.views.home_mail, name='home-mail'),
35
    path('phone/', welco.views.home_phone, name='home-phone'),
36
    path('counter/', welco.views.home_counter, name='home-counter'),
37
    re_path(r'^', include('welco.sources.phone.urls')),
38
    re_path(r'^', include('welco.sources.counter.urls')),
39
    path('ajax/qualification', welco.views.qualification, name='qualif-zone'),
40
    re_path(
41 41
        r'^ajax/remove-association/(?P<pk>\w+)$',
42 42
        welco.views.remove_association,
43 43
        name='ajax-remove-association',
44 44
    ),
45
    url(r'^ajax/create-formdata/(?P<pk>\w+)$', welco.views.create_formdata, name='ajax-create-formdata'),
46
    url(r'^ajax/kb$', welco.kb.views.zone, name='kb-zone'),
47
    url(r'^kb/$', welco.kb.views.page_list, name='kb-home'),
48
    url(r'^kb/add/$', welco.kb.views.page_add, name='kb-page-add'),
49
    url(r'^kb/search/$', welco.kb.views.page_search, name='kb-page-search'),
50
    url(r'^kb/search/json/$', welco.kb.views.page_search_json, name='kb-page-search-json'),
51
    url(r'^kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail, name='kb-page-view'),
52
    url(r'^ajax/kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail_fragment, name='kb-page-fragment'),
53
    url(r'^kb/(?P<slug>[\w-]+)/edit$', welco.kb.views.page_edit, name='kb-page-edit'),
54
    url(r'^kb/(?P<slug>[\w-]+)/delete$', welco.kb.views.page_delete, name='kb-page-delete'),
55
    url(r'^ajax/contacts$', welco.contacts.views.zone, name='contacts-zone'),
56
    url(r'^contacts/search/json/$', welco.contacts.views.search_json, name='contacts-search-json'),
57
    url(
45
    re_path(r'^ajax/create-formdata/(?P<pk>\w+)$', welco.views.create_formdata, name='ajax-create-formdata'),
46
    path('ajax/kb', welco.kb.views.zone, name='kb-zone'),
47
    path('kb/', welco.kb.views.page_list, name='kb-home'),
48
    path('kb/add/', welco.kb.views.page_add, name='kb-page-add'),
49
    path('kb/search/', welco.kb.views.page_search, name='kb-page-search'),
50
    path('kb/search/json/', welco.kb.views.page_search_json, name='kb-page-search-json'),
51
    re_path(r'^kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail, name='kb-page-view'),
52
    re_path(r'^ajax/kb/(?P<slug>[\w-]+)/$', welco.kb.views.page_detail_fragment, name='kb-page-fragment'),
53
    re_path(r'^kb/(?P<slug>[\w-]+)/edit$', welco.kb.views.page_edit, name='kb-page-edit'),
54
    re_path(r'^kb/(?P<slug>[\w-]+)/delete$', welco.kb.views.page_delete, name='kb-page-delete'),
55
    path('ajax/contacts', welco.contacts.views.zone, name='contacts-zone'),
56
    path('contacts/search/json/', welco.contacts.views.search_json, name='contacts-search-json'),
57
    re_path(
58 58
        r'^ajax/contacts/(?P<slug>[\w-]+)/$',
59 59
        welco.contacts.views.contact_detail_fragment,
60 60
        name='contact-page-fragment',
61 61
    ),
62
    url(r'^contacts/add/$', welco.contacts.views.contact_add, name='contacts-add'),
63
    url(
62
    path('contacts/add/', welco.contacts.views.contact_add, name='contacts-add'),
63
    re_path(
64 64
        r'^ajax/summary/(?P<source_type>\w+)/(?P<source_pk>\w+)/$',
65 65
        welco.views.wcs_summary,
66 66
        name='wcs-summary',
67 67
    ),
68
    url(r'^admin/', admin.site.urls),
69
    url(r'^logout/$', welco.views.logout, name='auth_logout'),
70
    url(r'^login/$', welco.views.login, name='auth_login'),
71
    url(r'^menu.json$', welco.views.menu_json, name='menu_json'),
72
    url(r'^ckeditor/upload/', kb_manager_required(ckeditor_views.upload), name='ckeditor_upload'),
73
    url(
68
    re_path(r'^admin/', admin.site.urls),
69
    path('logout/', welco.views.logout, name='auth_logout'),
70
    path('login/', welco.views.login, name='auth_login'),
71
    re_path(r'^menu.json$', welco.views.menu_json, name='menu_json'),
72
    re_path(r'^ckeditor/upload/', kb_manager_required(ckeditor_views.upload), name='ckeditor_upload'),
73
    re_path(
74 74
        r'^ckeditor/browse/', never_cache(kb_manager_required(ckeditor_views.browse)), name='ckeditor_browse'
75 75
    ),
76 76
]
77 77

  
78 78
if 'mellon' in settings.INSTALLED_APPS:
79
    urlpatterns.append(url(r'^accounts/mellon/', include('mellon.urls')))
79
    urlpatterns.append(re_path(r'^accounts/mellon/', include('mellon.urls')))
80 80

  
81 81
# static and media files
82 82
urlpatterns += staticfiles_urlpatterns()
83
-