Пример #1
0
def page(path):
    """
    Page detail page

    Renders a single page.
    """
    newpath = path.strip('/')
    if path != newpath:
        redirect('/' + newpath)

    try:
        doc = manager.get('page/%s' % path)
    except DocumentNotFound, e:
        abort(404)
Пример #2
0
def node_redirect(node_id):
    """
    Legacy redirect for node pages reference by node id

    Since these are namespaced by blog or page we need to check each for
    a document to redirect to.
    """
    for doctype, redirbase in {'blog':'/blog/', 'page':'/'}.items():
        try:
            doc = manager.get('%s/node/%s' % (doctype, node_id))
        except DocumentNotFound, e:
            doc = None
        except DocumentMoved, e:
            redirect(redirbase + e.location)
Пример #3
0
def blog_post(path):
    """
    Blog detail page

    Renders a single blog post.
    """
    newpath = path.strip('/')
    if path != newpath:
        redirect('/blog/' + newpath)

    try:
        doc = manager.get('blog/%s' % path)
    except DocumentNotFound, e:
        abort(404)