[yocto] [layerindex-web][PATCH v2 15/15] Explicitly specify temporary redirection

Paul Eggleton paul.eggleton at linux.intel.com
Wed Jun 8 06:20:08 PDT 2016


Django 1.8 warns that the default for the "permanent" parameter to
RedirectView is changing in 1.9 from True to False, but I believe we
should be specifying False for these redirections - these are not just
redirections from old URLs and may in fact change in the future if the
site structure changes.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
---
 layerindex/urls.py        | 12 ++++++------
 layerindex/urls_branch.py |  2 +-
 urls.py                   |  2 +-
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/layerindex/urls.py b/layerindex/urls.py
index b170460..cbd29ad 100644
--- a/layerindex/urls.py
+++ b/layerindex/urls.py
@@ -24,19 +24,19 @@ router.register(r'machines', restviews.MachineViewSet)
 
 urlpatterns = patterns('',
     url(r'^$',
-        RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',))),
+        RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False),
         name='frontpage'),
 
     url(r'^api/', include(router.urls)),
 
     url(r'^layers/$',
-        RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)))),
+        RedirectView.as_view(url=reverse_lazy('layer_list', args=('master',)), permanent=False)),
     url(r'^layer/(?P<slug>[-\w]+)/$',
-        RedirectParamsView.as_view(), {'redirect_name': 'layer_item', 'branch':'master'}),
+        RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_item', 'branch':'master'}),
     url(r'^recipes/$',
-        RedirectView.as_view(url=reverse_lazy('recipe_search', args=('master',)))),
+        RedirectView.as_view(url=reverse_lazy('recipe_search', args=('master',)), permanent=False)),
     url(r'^machines/$',
-        RedirectView.as_view(url=reverse_lazy('machine_search', args=('master',)))),
+        RedirectView.as_view(url=reverse_lazy('machine_search', args=('master',)), permanent=False)),
  
     url(r'^submit/$', edit_layer_view, {'template_name': 'layerindex/submitlayer.html'}, name="submit_layer"),
     url(r'^submit/thanks$',
@@ -107,7 +107,7 @@ urlpatterns = patterns('',
             template_name='layerindex/about.html'),
             name="about"),
     url(r'^oe-classic/$',
-        RedirectView.as_view(url=reverse_lazy('classic_recipe_search')),
+        RedirectView.as_view(url=reverse_lazy('classic_recipe_search'), permanent=False),
             name='classic'),
     url(r'^oe-classic/recipes/$',
         ClassicRecipeSearchView.as_view(
diff --git a/layerindex/urls_branch.py b/layerindex/urls_branch.py
index ab5e2d5..3313290 100644
--- a/layerindex/urls_branch.py
+++ b/layerindex/urls_branch.py
@@ -11,7 +11,7 @@ from layerindex.views import LayerListView, RecipeSearchView, MachineSearchView,
 
 urlpatterns = patterns('',
     url(r'^$', 
-        RedirectParamsView.as_view(), {'redirect_name': 'layer_list'}),
+        RedirectParamsView.as_view(permanent=False), {'redirect_name': 'layer_list'}),
     url(r'^layers/$',
         LayerListView.as_view(
             template_name='layerindex/layers.html'),
diff --git a/urls.py b/urls.py
index 98fc734..649635c 100644
--- a/urls.py
+++ b/urls.py
@@ -16,6 +16,6 @@ urlpatterns = patterns('',
     url(r'^admin/', include(admin.site.urls)),
     url(r'^accounts/', include('registration.backends.default.urls')),
     url(r'^captcha/', include('captcha.urls')),
-    url(r'.*', RedirectView.as_view(url='/layerindex/')),
+    url(r'.*', RedirectView.as_view(url='/layerindex/', permanent=False)),
 )
 
-- 
2.5.5




More information about the yocto mailing list