ripozo.viewsets package¶
Subpackages¶
Submodules¶
ripozo.viewsets.constructor module¶
ripozo.viewsets.resource_base module¶
-
class
ripozo.viewsets.resource_base.
ResourceBase
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
object
The core of ripozo.
Parameters: - __abstract__ (bool) – abstract classes are not registered by the ResourceMetaClass
- _relationships (dict) – The relationships that will be constructed by instances
- _pks (list) – The pks for this resource. These, along
with the
namespace
andresource_name
are combined to generate the url - _manager (type) – The BaseManager subclass that is responsible for persistence within the applictation. I.E. the AlchemyManager from ripozo-sqlalchemy
- _namespace (unicode) – The namespace of this resource. This is prepended to the resource_name and pks to create the url
- _resource_name (unicode) – The name of the resource.
- _preprocessors (list) – A list of functions that will be run before any apimethod is called.
- _postprocessors (list) – A list of functions that will be run after any apimethod from this class is called.
- _links (dict) – Works similarly to relationships. The primary difference between this and links is that links will assume the resource is the same as this class if a relation is not specified. Additionally, links are supposed to be meta information effectively. They are not necessarily about this specific resource. For example, next and previous links for a list resource or created links when creating a new resource on a list resource.
-
base_url
= u'/resource_base'¶
-
base_url_sans_pks
= u'/resource_base'¶
-
classmethod
endpoint_dictionary
()[source]¶ A dictionary of the endpoints with the method as the key and the route options as the value
Returns: dictionary of endpoints Return type: dict
-
has_all_pks
¶ Returns: Indicates whether an instance of this class has all of the items in the pks list as a key in the self.properties
attribute.Return type: bool
-
has_error
¶
-
item_pks
¶ Gets a dictionary of an individual resource’s primary keys. The key of the dictionary is the name of the primary key and the value is the actual value of the primary key specified
Return type: dict
-
links
= ()¶
-
manager
= None¶
-
namespace
= u'/'¶
-
pks
= []¶
-
postprocessors
= []¶
-
preprocessors
= []¶
-
relationships
= ()¶
-
resource_name
= u'resource_base'¶
-
url
¶ Lazily constructs the url for this specific resource using the specific pks as specified in the pks tuple.
Returns: The url for this resource Return type: unicode
-
ripozo.viewsets.resource_base.
create_url
(base_url, **kwargs)[source]¶ Generates a fully qualified url. It iterates over the keyword arguments and for each key it replaces any instances of “<key>” with “value” The keys of the dictionary must be strings.
Parameters: - base_url (unicode) – The url template that will be used to generate an acutal url
- kwargs (dict) – The dictionary of template variables and their associated values
Returns: A complete url.
Return type: unicode
ripozo.viewsets.restmixins module¶
-
class
ripozo.viewsets.restmixins.
Create
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.resource_base.ResourceBase
-
links
= (<ripozo.viewsets.relationships.relationship.Relationship object at 0xf5bff7ec>,)¶
-
-
class
ripozo.viewsets.restmixins.
CreateRetrieve
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.restmixins.Create
,ripozo.viewsets.restmixins.Retrieve
-
class
ripozo.viewsets.restmixins.
CreateRetrieveUpdate
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.restmixins.Create
,ripozo.viewsets.restmixins.Retrieve
,ripozo.viewsets.restmixins.Update
-
class
ripozo.viewsets.restmixins.
CreateRetrieveUpdateDelete
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.restmixins.Create
,ripozo.viewsets.restmixins.Retrieve
,ripozo.viewsets.restmixins.Update
,ripozo.viewsets.restmixins.Delete
-
class
ripozo.viewsets.restmixins.
Delete
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶
-
class
ripozo.viewsets.restmixins.
Retrieve
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶
-
class
ripozo.viewsets.restmixins.
RetrieveList
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.resource_base.ResourceBase
-
links
= (<ripozo.viewsets.relationships.relationship.Relationship object at 0xf5c3128c>, <ripozo.viewsets.relationships.relationship.Relationship object at 0xf5c3120c>)¶
-
-
class
ripozo.viewsets.restmixins.
RetrieveUpdate
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.restmixins.Retrieve
,ripozo.viewsets.restmixins.Update
-
class
ripozo.viewsets.restmixins.
RetrieveUpdateDelete
(properties=None, errors=None, meta=None, status_code=200, query_args=None, include_relationships=True)[source]¶ Bases:
ripozo.viewsets.restmixins.Retrieve
,ripozo.viewsets.restmixins.Update
,ripozo.viewsets.restmixins.Delete