'Legacy: supporting permalink pages from \'06,
and non-search-engine-friendly links'

@validate(article=VLink('article'), comment=VCommentID('comment'))
def GET_oldinfo(self, article, type, dest, rest=None, comment=''):

    if (not (dest in ('comments', 'details'))):
        dest = 'comments'
    if (type == 'ancient'):
        max_link_id = 10000000
        new_id = (max_link_id - int(article._id))
        return self.redirect(((('/info/' + to36(new_id)) + '/') + rest))
    if (type == 'old'):
        if (not article.subreddit_slow.can_view(c.user)):
            self.abort403()
        new_url = ('/%s/%s/%s' % (dest, article._id36, quote_plus(title_to_url(article.title).encode('utf-8'))))
        if (not c.default_sr):
            new_url = ('/r/%s%s' % (c.site.name, new_url))
        if comment:
            new_url = (new_url + ('/%s' % comment._id36))
        if c.extension:
            new_url = (new_url + ('/.%s' % c.extension))
        new_url = (new_url + query_string(request.GET))
        return self.redirect(new_url, code=301)
