From f7e83960ed83c221eb2de60059d30b862617d1c9 Mon Sep 17 00:00:00 2001 From: Arnaud-D <35631001+Arnaud-D@users.noreply.github.com> Date: Sat, 9 Dec 2023 19:12:07 +0100 Subject: [PATCH] Refactorise les patterns d'URL pour les tutoriels --- zds/tutorialv2/urls/urls_tutorials.py | 34 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/zds/tutorialv2/urls/urls_tutorials.py b/zds/tutorialv2/urls/urls_tutorials.py index 77ffa78dc8..76f9fc46a1 100644 --- a/zds/tutorialv2/urls/urls_tutorials.py +++ b/zds/tutorialv2/urls/urls_tutorials.py @@ -8,17 +8,12 @@ from zds.tutorialv2.views.redirect import RedirectContentSEO, RedirectOldBetaTuto from zds.tutorialv2.feeds import LastTutorialsFeedRSS, LastTutorialsFeedATOM - -urlpatterns = [ - # flux +feed_patterns = [ path("flux/rss/", LastTutorialsFeedRSS(), name="feed-rss"), path("flux/atom/", LastTutorialsFeedATOM(), name="feed-atom"), - # view - path( - "//////", - RedirectContentSEO.as_view(), - name="redirect_old_tuto", - ), +] + +display_patterns = [ path( "////", ContainerOnlineView.as_view(), @@ -26,15 +21,17 @@ ), path("///", ContainerOnlineView.as_view(), name="view-container"), path("//", TutorialOnlineView.as_view(), name="view"), - # downloads: +] + +download_patterns = [ path("md//.md", DownloadOnlineTutorial.as_view(requested_file="md"), name="download-md"), path("pdf//.pdf", DownloadOnlineTutorial.as_view(requested_file="pdf"), name="download-pdf"), path("epub//.epub", DownloadOnlineTutorial.as_view(requested_file="epub"), name="download-epub"), path("zip//.zip", DownloadOnlineTutorial.as_view(requested_file="zip"), name="download-zip"), path("tex//.tex", DownloadOnlineTutorial.as_view(requested_file="tex"), name="download-tex"), - # Old beta url compatibility - path("beta///", RedirectOldBetaTuto.as_view(), name="old-beta-url"), - # Listing +] + +listing_patterns = [ path("", RedirectView.as_view(pattern_name="publication:list", permanent=True)), path("tags/", TagsListView.as_view(displayed_types=["TUTORIAL"]), name="tags"), path( @@ -48,3 +45,14 @@ name="find-contributions-tutorial", ), ] + +redirect_patterns = [ + path( + "//////", + RedirectContentSEO.as_view(), + name="redirect_old_tuto", + ), + path("beta///", RedirectOldBetaTuto.as_view(), name="old-beta-url"), +] + +urlpatterns = feed_patterns + display_patterns + download_patterns + listing_patterns + redirect_patterns