From 42c4e91f3a5cfbdab5c14fa250286681be13fdab Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Tue, 19 Jun 2012 14:41:36 -0700 Subject: [PATCH] Redirect old-style link details page URLs. --- r2/r2/controllers/front.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/r2/r2/controllers/front.py b/r2/r2/controllers/front.py index 4c0a50be4..e850a92d2 100755 --- a/r2/r2/controllers/front.py +++ b/r2/r2/controllers/front.py @@ -113,11 +113,19 @@ class FrontController(RedditController): @prevent_framing_and_css() @validate(VAdmin(), - thing = VByName('article')) - def GET_details(self, thing): + thing = VByName('article'), + oldid36 = nop('article')) + def GET_details(self, thing, oldid36): """The (now deprecated) details page. Content on this page has been subsubmed by the presence of the LinkInfoBar on the rightbox, so it is only useful for Admin-only wizardry.""" + if not thing: + try: + link = Link._byID36(oldid36) + return self.redirect('/details/' + link._fullname) + except (NotFound, ValueError): + abort(404) + return DetailsPage(thing=thing, expand_children=False).render() def GET_selfserviceoatmeal(self):