def admin_menu_to(req, id): check_login(req) check_right(req, module_right) check_token(req, req.form.get("token")) item = MenuItem(id) if req.uri.endswith("to_child"): status = item.to_child(req) else: status = item.to_parent(req) if status: return js_items(req) req.status = state.HTTP_BAD_REQUEST req.content_type = "application/json" return json.dumps({"reason": "not_possible"})