models_transients_akas_get (class)

class models_transients_akas_get(log, request, elementId=False, search=False)[source]

Bases: dryxPyramid.models.models_base.base_model

The worker class for the models_transients_akas_get module

Key Arguments

  • log – logger

  • request – the pyramid request

  • elementId – the specific element id requests (or False)

Usage

usage code



.. todo::

    - add usage info
    - create a sublime snippet for usage
    - add a tutorial about ``models_transients_akas_get`` to documentation
    - create a blog post about what ``models_transients_akas_get`` does

Methods

close()

convert_to_nested_data_structure(listOfDict, …)

given a flat list of dictionaries, converts and returns the content in a nested structure better suited for json rendering

get()

execute the get method on the models_transients_akas_get object

convert_to_nested_data_structure(listOfDict, primaryKey, resourceName, resourceKeys)[source]

given a flat list of dictionaries, converts and returns the content in a nested structure better suited for json rendering

Key Arguments

  • listOfDict – the list of dictionaries (generally returned from a database query)

  • primaryKey – the primary key in the result sets by which to group json results by

  • resourceName – the name of the subresource belong to be collected together

  • resourceKeys – the name of the keys to be grouped together under the subresource

Usage

Here’s an example usage of this method:

responseContent = self.convert_to_nested_data_structure(
    listOfDict=rows,
    primaryKey="transientBucketId",
    resourceName="akas",
    resourceKeys=["name", "url"]
)
get()[source]

execute the get method on the models_transients_akas_get object

Return

  • responseContent – the reponse to send to the browser