@add_route("<STR_LIT>" + ACTIONS + "<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>" + ACTIONS + "<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>" + ACTIONS + "<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>@add_route("<STR_LIT>" + ACTIONS + "<STR_LIT>",<EOL>"<STR_LIT>", methods=["<STR_LIT:POST>"])<EOL>def action(context, request, action=None, resource=None, uid=None):
<EOL>if action is None:<EOL><INDENT>action = request.get_header("<STR_LIT>", "<STR_LIT>").lower()<EOL><DEDENT>func_name = "<STR_LIT>".format(action)<EOL>action_func = getattr(api, func_name, None)<EOL>if action_func is None:<EOL><INDENT>api.fail(<NUM_LIT>, "<STR_LIT>".format(func_name))<EOL><DEDENT>portal_type = api.resource_to_portal_type(resource)<EOL>items = action_func(portal_type=portal_type, uid=uid)<EOL>return {<EOL>"<STR_LIT:count>": len(items),<EOL>"<STR_LIT>": items,<EOL>"<STR_LIT:url>": api.url_for("<STR_LIT>", action=action),<EOL>}<EOL>
Various HTTP POST actions