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))
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))
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)))