Skip to content

Commit

Permalink
Merge pull request #3225 from gustavi/fix-3223
Browse files Browse the repository at this point in the history
Fix #3223 : Mauvais redirection sur des tutoriels qui n'existent plus
  • Loading branch information
SpaceFox committed Jan 14, 2016
2 parents 9b84e27 + db16aaa commit ae4f5c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zds/tutorialv2/views/views_published.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class RedirectContentSEO(RedirectView):

def get_redirect_url(self, **kwargs):
"""Redirects the user to the new url"""
obj = PublishableContent.objects.get(old_pk=int(kwargs["pk"]), type="TUTORIAL")
if obj is None or not obj.in_public():
obj = get_object_or_404(PublishableContent, old_pk=int(kwargs.get('pk')), type='TUTORIAL')
if not obj.in_public():
raise Http404(_(u"Aucun contenu public n'est disponible avec cet identifiant."))
kwargs["parent_container_slug"] = str(kwargs["p2"]) + "_" + kwargs["parent_container_slug"]
kwargs["container_slug"] = str(kwargs["p3"]) + "_" + kwargs["container_slug"]
Expand Down

0 comments on commit ae4f5c8

Please sign in to comment.