def _try_url_with_appended_slash(self):
new_url_to_try = self.kwargs.get('<STR_LIT:path>', '<STR_LIT>') + '<STR_LIT:/>'<EOL>if not new_url_to_try.startswith('<STR_LIT:/>'):<EOL><INDENT>new_url_to_try = '<STR_LIT:/>' + new_url_to_try<EOL><DEDENT>if CMSPage.objects.published().filter(url=new_url_to_try).exists():<EOL><INDENT>return HttpResponsePermanentRedirect(new_url_to_try)<EOL><DEDENT>else:<EOL><INDENT>raise Http404<EOL><DEDENT>
Try our URL with an appended slash. If a CMS page is found at that URL, redirect to it.
If no page is found at that URL, raise Http404.