Adding a CMS to Your Pyramid Web App Transcripts
Chapter: Redirects and the admin section
Lecture: Concept: Doing a redirect
0:00 Quickly review doing a redirect with our CMS.
0:03 Because the way the URL routing works, the way the CMS works is everything gets sent to the one final route.
0:11 We give all the data driven routes, like here's a package or here's the popular things or here's the user log in.
0:18 But after that's done, it's like here is the one place where the URL Request gets the final say before we just say, "not found".
0:25 So we're gonna check and make sure that there's not a page that we want to show first. If there is, we're gonna show it.
0:31 But then we're going to say, well, no pages. Let's see if there's a redirect. So we're using our CMS service to get that.
0:36 Now it gets it from fake data. Later it'll get it from the database. But this code doesn't change, and we'll say, If there is a redirect,
0:42 let's quickly make sure that if there's a query string, we also pass that along. But we can adjust that destination URL.
0:49 And then we just say, http found, here's the URL, Go! And that's up to Pyramid to just take that and do the magic that's done inside of http
0:58 to tell your Web browser to go to that new destination. Finally, if you get through the pages and the redirect and neither of them are there,
1:04 we're just gonna return http not found and show our cool not found 404 error page.