'Return the content of a wiki page
If `v` is given, show the wiki page as it was at that version
If both `v` and `v2` are given, show a diff of the two'

@require_oauth2_scope('wikiread')
@api_doc(api_section.wiki, uri='/wiki/{page}', uses_site=True)
@validate(pv=VWikiPageAndVersion(('page', 'v', 'v2'), required=False, restricted=False, allow_hidden_revision=False), page_name=VWikiPageName('page', error_on_name_normalized=True))
def GET_wiki_page(self, pv, page_name):

    message = None
    if c.errors.get(('PAGE_NAME_NORMALIZED', 'page')):
        url = join_urls(c.wiki_base_url, page_name)
        return self.redirect(url)
    (page, version, version2) = pv
    if (not page):
        is_api = (c.render_style in extensions.API_TYPES)
        if this_may_revise():
            if is_api:
                self.handle_error(404, 'PAGE_NOT_CREATED')
            errorpage = WikiNotFound(page=page_name)
            request.environ['usable_error_content'] = errorpage.render()
        elif is_api:
            self.handle_error(404, 'PAGE_NOT_FOUND')
        self.abort404()
    if version:
        edit_by = version.get_author()
        edit_date = version.date
    else:
        edit_by = page.get_author()
        edit_date = page._get('last_edit_date')
    diffcontent = None
    if (not version):
        content = page.content
        if (c.is_wiki_mod and (page.name in page_descriptions)):
            message = page_descriptions[page.name]
    else:
        message = (_('viewing    revision    from    %s') % timesince(version.date))
        if version2:
            t1 = timesince(version.date)
            t2 = timesince(version2.date)
            timestamp1 = (_('%s    ago') % t1)
            timestamp2 = (_('%s    ago') % t2)
            message = (_('comparing    revisions    from    %(date_1)s    and    %(date_2)s') % {'date_1': t1, 'date_2': t2})
            diffcontent = make_htmldiff(version.content, version2.content, timestamp1, timestamp2)
            content = version2.content
        else:
            message = (_('viewing    revision    from    %s    ago') % timesince(version.date))
            content = version.content
    renderer = RENDERERS_BY_PAGE.get(page.name, 'wiki')
    return WikiPageView(content, alert=message, v=version, diff=diffcontent, may_revise=this_may_revise(page), edit_by=edit_by, edit_date=edit_date, page=page.name, renderer=renderer).render()
