Esempio n. 1
0
def edit_redirect():
    record = None

    # Find out where we wanted to go to.  We need to chop off the leading
    # /admin on this URL as this is where the admin thinks it's placed.
    path = extract_path_info(request.url_root.rstrip('/').rsplit('/', 1)[0],
                             request.args.get('path', '/'))

    if path is not None:
        record = g.admin_context.pad.resolve_url_path(path, alt_fallback=False)
    if record is None:
        abort(404)
    path = fs_path_to_url_path(record.path)
    if record.alt != PRIMARY_ALT:
        path += '+' + record.alt
    return redirect(url_for('dash.edit', path=path))
Esempio n. 2
0
def edit_redirect():
    record = None

    # Find out where we wanted to go to.  We need to chop off the leading
    # /admin on this URL as this is where the admin thinks it's placed.
    path = extract_path_info(
        request.url_root.rstrip('/').rsplit('/', 1)[0],
        request.args.get('path', '/'))

    if path is not None:
        record = g.admin_context.pad.resolve_url_path(path, alt_fallback=False)
    if record is None:
        abort(404)
    path = fs_path_to_url_path(record.path)
    if record.alt != PRIMARY_ALT:
        path += '+' + record.alt
    return redirect(url_for('dash.edit', path=path))
Esempio n. 3
0
File: dash.py Progetto: jab/lektor
def edit_redirect():
    # XXX: the path here only works if the website is on the root.
    record = g.admin_context.pad.resolve_url_path(request.args.get('path', '/'))
    if record is None:
        abort(404)
    return redirect(url_for('dash.edit', path=fs_path_to_url_path(record.url_path)))