Module Import alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias alias alias alias alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam NameParam defaults body Assign NameStore Call NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Return BoolOpOr NameLoad NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str ImportFrom alias Assign NameStore Call AttributeLoad SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Index Num attr If Call NameLoad NameLoad body If AttributeLoad NameLoad attr body Raise Call NameLoad Str Return Assign NameStore NameStore Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad BoolOpOr AttributeLoad NameLoad attr Str Assign NameStore Call NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad If BoolOpAnd UnaryOpNot AttributeLoad NameLoad attr BoolOpOr NameLoad NameLoad body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr orelse Assign NameStore Call NameLoad NameLoad Assign NameStore Call NameLoad NameLoad Assign NameStore Dict Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad keyword NameLoad keyword NameLoad If UnaryOpNot NameLoad body Assign SubscriptStore NameLoad Index Str Call NameLoad keyword NameLoad keyword NameLoad keyword Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Assign SubscriptStore NameLoad Index Str Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad keyword NameLoad If NameLoad body Assign NameStore Call NameLoad NameLoad Assign NameStore SubscriptLoad NameLoad Index Str Assign AttributeStore NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore TupleLoad Call NameLoad NameLoad If UnaryOpNot NameLoad body AugAssignAdd NameStore TupleLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Str If UnaryOpNot AttributeLoad NameLoad attr body Return Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Dict For NameStore AttributeLoad NameLoad attr body If CompareIn AttributeLoad NameLoad attr NameLoad body Continue Assign NameStore Call NameLoad NameLoad NameLoad NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str ImportFrom alias If UnaryOpNot NameLoad body Return For NameStore NameLoad body If Call NameLoad AttributeLoad NameLoad attr body Continue If CompareNotEq Call AttributeLoad AttributeLoad NameLoad attr attr Str body Continue Assign NameStore SubscriptLoad Call AttributeLoad AttributeLoad NameLoad attr attr Str Index Num Assign NameStore Call AttributeLoad NameLoad attr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad If NameLoad body Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad decorator_list
N/A N/A logging inflection singularize views generate_rest_view acl generate_acl utils is_dynamic_uri resource_view_attrs generate_model_name dynamic_part_name attr_subresource singular_subresource get_static_parent N/A log N/A N/A logging getLogger __name__ _get_nefertari_parent_resource N/A N/A raml_resource generated_resources default N/A N/A N/A parent_raml_res N/A get_static_parent raml_resource N/A N/A parent_raml_res None N/A N/A parent_resource N/A N/A generated_resources get N/A parent_raml_res path N/A N/A parent_resource default N/A default N/A generate_resource N/A N/A config raml_resource parent_resource N/A N/A N/A  Perform complete one resource configuration process

    This function generates: ACL, view, route, resource, database
    model for a given `raml_resource`. New nefertari resource is
    attached to `parent_resource` class which is an instance of
    `nefertari.resource.Resource`.

    Things to consider:
      * Top-level resources must be collection names.
      * No resources are explicitly created for dynamic (ending with '}')
        RAML resources as they are implicitly processed by parent collection
        resources.
      * Resource nesting must look like collection/id/collection/id/...
      * Only part of resource path after last '/' is taken into account,
        thus each level of resource nesting should add one more path
        element. E.g. /stories -> /stories/{id} and not
        /stories -> /stories/mystories/{id}. Latter route will be generated
        at /stories/{id}.

    :param raml_resource: Instance of ramlfications.raml.ResourceNode.
    :param parent_resource: Parent nefertari resource object.
     models get_existing_model N/A resource_uri N/A N/A N/A N/A N/A N/A raml_resource path split / N/A -1 strip N/A N/A is_dynamic_uri resource_uri N/A N/A N/A parent_resource is_root N/A N/A N/A Exception Top-level resources can't be dynamic and must represent collections instead N/A N/A clean_uri route_name N/A N/A resource_uri strip / N/A N/A N/A log info N/A N/A Configuring resource: `{}`. Parent: `{}` format route_name N/A N/A parent_resource uid root N/A is_singular N/A singular_subresource raml_resource route_name N/A is_attr_res N/A attr_subresource raml_resource route_name N/A N/A N/A N/A parent_resource is_root N/A is_attr_res is_singular N/A N/A model_cls N/A N/A parent_resource view Model N/A N/A model_name N/A generate_model_name route_name N/A model_cls N/A get_existing_model model_name N/A resource_kwargs N/A N/A N/A N/A log info N/A N/A Generating ACL for `{}` format route_name N/A N/A resource_kwargs N/A factory N/A generate_acl config model_cls model_cls raml_resource raml_resource N/A N/A is_singular N/A N/A N/A resource_kwargs N/A id_name N/A dynamic_part_name raml_resource raml_resource clean_uri clean_uri pk_field N/A N/A model_cls pk_field N/A N/A N/A log info N/A N/A Generating view for `{}` format route_name N/A view_attrs N/A resource_view_attrs raml_resource is_singular N/A N/A resource_kwargs N/A view N/A generate_rest_view config model_cls model_cls attrs view_attrs attr_view is_attr_res singular is_singular N/A is_singular N/A N/A model_name N/A generate_model_name route_name N/A view_cls N/A resource_kwargs N/A view N/A N/A view_cls _parent_model N/A view_cls Model N/A N/A view_cls Model N/A get_existing_model model_name N/A N/A N/A log info N/A N/A Creating new resource for `{}` format route_name N/A resource_args N/A N/A singularize clean_uri N/A N/A is_singular N/A N/A resource_args N/A clean_uri N/A N/A N/A parent_resource add resource_args resource_kwargs N/A generate_server N/A N/A raml_root config N/A N/A N/A  Handle server generation process.

    :param raml_root: Instance of ramlfications.raml.RootNode.
    :param config: Pyramid Configurator instance.
     N/A N/A N/A log info Server generation started N/A N/A N/A raml_root resources N/A N/A N/A root_resource N/A N/A config get_root_resource N/A generated_resources N/A N/A raml_resource N/A raml_root resources N/A N/A N/A N/A raml_resource path generated_resources N/A N/A N/A parent_resource N/A _get_nefertari_parent_resource raml_resource generated_resources root_resource N/A new_resource N/A generate_resource config raml_resource parent_resource N/A N/A new_resource None N/A N/A N/A generated_resources N/A N/A raml_resource path new_resource N/A generate_models N/A N/A config raml_resources N/A N/A N/A  Generate model for each resource in :raml_resources:

    The DB model name is generated using singular titled version of current
    resource's url. E.g. for resource under url '/stories', model with
    name 'Story' will be generated.

    :param config: Pyramid Configurator instance.
    :param raml_resources: List of ramlfications.raml.ResourceNode.
     models handle_model_generation N/A N/A raml_resources N/A N/A N/A raml_resource raml_resources N/A N/A N/A is_dynamic_uri N/A raml_resource path N/A N/A N/A N/A N/A N/A N/A raml_resource method upper POST N/A N/A N/A route_name N/A N/A N/A N/A raml_resource path split / N/A -1 N/A route_name N/A N/A route_name strip / N/A N/A N/A attr_subresource raml_resource route_name N/A N/A N/A N/A log info N/A N/A Configuring model for route `{}` format route_name N/A N/A model_cls is_auth_model N/A handle_model_generation config raml_resource route_name N/A is_auth_model N/A N/A N/A N/A config registry auth_model model_cls N/A