def parse_enum_item_name(enum_cls, item_id): """Parse an `EnumItem` name from the external id provided by the API client.""" return su.spinal_to_snake(item_id, screaming=True)
def get_request_action(default=None): """Retrieve the "action" value from the request or fallback to the provided default. The value will be converted from spinal to snake-case so that matching can occur on the Resource's dispatch methods. """ path_parts = filter(None, request.path.split('/')) return su.spinal_to_snake(path_parts[-1]) if path_parts else default