Combining a db instance with an API.
copyright: | 2009-2010 Fom Authors. |
---|---|
license: | MIT, see LICENSE for more information. |
A fluiddb session.
Parameters: |
|
---|
Bind this instance of the session to the global object mapper
This is a convenience to allow declaring mapped objects that are bound to this session without requiring passing the session to each created object.
>>> fdb = Fluid()
>>> fdb.bind()
>>> from fom.mapper import Object
>>> o = Object() # this is bound to the fdb instance
Log in to the connected FluidDB
The login is maintained for the session until logout() is called.
>>> fdb = Fluid()
>>> fdb.login(u'test', u'test')
>>> fdb.users.get(u'aliafshar') # this is now authenticated
Parameters: |
|
---|
Log out of the FluidDB session
Object orientated interface into FluidDB
copyright: | 2010 Fom Authors. |
---|---|
license: | MIT, see LICENSE for more information. |
A FluidDB Namespace
The associated API instance for this Namespace
It can be used to access lower-level information as required. Read-only.
>>> ns = Namespace(u'fluiddb')
>>> ns.api.get()
<FluidResponse (200, 'application/json', ...>
Create this namespace.
Parameters: |
|
---|
Create a child namespace, and return it.
Parameters: |
|
---|
Create a tag in this namespace, and return it.
Parameters: |
|
---|
Delete this namespace.
The description of this Namespace.
Setting and getting the value attempts to set/get the description in FluidDB.
Get a child namespace of this namespace
Parameters: |
|
---|
The names of the child Namespaces in this Namespace
The full paths of the child Namespaces in this Namespace
The child Namespaces in this Namespace
Get a child tag of this namespace.
Parameters: |
|
---|
The names of the Tags in this Namespace.
The full paths of the Tags in this Namespace
The Tags in this Namespace
An object
The api ObjectApi for this instance.
Create a new object.
Removes a tag from the object
Returns a collection of objects that match the supplied query written in the query language described here:
http://doc.fluidinfo.com/fluidDB/queries.html
If result_type is passed the results will be instantiated as a list of result_type otherwise they’ll be instantiations of cls.
Get the value of a tag.
Get the cached value of a tag.
Check if an object has a tag.
Clears the local cache
Saves those fields that have been updated
Set the value of a tag.
Sets the value of the given tag_value instance to be pushed to FluidDB only when save() is called
A nicer view onto Namespace/Tag/TagValue permissions
Represents a policy specification for permissions on an action
Something with a path that is bound to a database.
The path of the item relative to the toplevel.
The instance of fom.session.Fluid bound to this item.
A FluidDB Tag
The associated API instance for this Tag
It can be used to access lower-level information as required. Read-only.
>>> tag = Tag(u'fluiddb/about')
>>> tag.api.get()
<FluidResponse (200, 'application/json', ...>
Delete this tag
The description of a tag.
Setting the value attempts to set the description in the FluidDB.
>>> tag = Tag(u'fluiddb/about')
>>> tag.description
u'A description of what an object is about.'
Get the named child for a path.
Split a path into parent, self
Descriptor to provide a tag value lookup on an object to simulate a simple attribute.
Parameters: |
|
---|
Descriptor to provide a relation lookup.
An id is actually stored in the database.
Descriptor to provide a list of relations.
A list of ids are stored in the database
Descriptor to provide a tag value lookup on an object to simulate a simple attribute. With write support.
Parameters: |
|
---|
Thin wrapper over the fluiddb restish api.
copyright: | 2009-2010 Fom Authors. |
---|---|
license: | MIT, see LICENSE for more information. |
Complete fluiddb api
provides the API toplevels. The API toplevels are each bound to the instance of fom.db.FluidDB, and correspond to FluidDB’s toplevels.
A bound instance of fom.api.TagsApi
A bound instance of fom.api.NamespacesApi
A bound instance of fom.api.UsersApi
A bound instance of fom.api.ObjectsApi
A bound instance of fom.api.PermissionsApi
A bound instance of fom.api.PoliciesApi
Base class for an api component.
Stores the db instance as state and uses it to call the required call.
Parameters: |
|
---|
The root path against which request paths are calculated
The FluidDB that this API is bound to.
Make a request against the fluiddb.
The path is relative to this API’s root path, but otherwise parameters are as fom.db.FluidDB.__call__()
API component for a single object referenced by its about tag value.
Call GET on an individual object.
API component for a tag on an object referenced by its about tag value.
Call DELETE on an individual object’s tag.
Call GET on an individual object’s tag.
Call HEAD on an individial object’s tag.
Call PUT on an individual object’s tag.
API Component for the /about toplevel
Call POST on the /about toplevel to create a new object.
Parameters: |
|
---|
Base class for an api component.
Stores the db instance as state and uses it to call the required call.
Parameters: |
|
---|
Complete fluiddb api
provides the API toplevels. The API toplevels are each bound to the instance of fom.db.FluidDB, and correspond to FluidDB’s toplevels.
A bound instance of fom.api.TagsApi
A bound instance of fom.api.NamespacesApi
A bound instance of fom.api.UsersApi
A bound instance of fom.api.ObjectsApi
A bound instance of fom.api.PermissionsApi
A bound instance of fom.api.PoliciesApi
API component for all individual permissions.
API component for all groups of permissions for a type of toplevel.
API Component for a single Namespace.
This is usually returned by using the NamespacesApi[path], or can be created as required for a specific namespace:
>>> from fom.db import FluidDB
>>> db = FluidDB()
>>> ns_api = NamespaceApi('fluiddb', db) # api for the fluiddb namespace
>>> ns_api.get(returnDescription=True)
Call DELETE on the namespace to delete it.
Call GET on the namespaces to fetch information about it.
Call POST on the namespace to create a new child namespace.
Call PUT on ther namespace to update its description.
API Component for the /namespaces target.
Provides no methods, only access to named namespaces.
API component for a single object.
Call GET on an individual object.
API component for a tag on an object.
Call DELETE on an individual object’s tag.
Call GET on an individual object’s tag.
Call HEAD on an individial object’s tag.
Call PUT on an individual object’s tag.
API Component for the /objects toplevel
Call GET on the /objects toplevel
Call POST on the /objects toplevel to create a new object.
Parameters: |
|
---|
None is passed, no about tag will be set.
API Component for /permissions toplevel.
API Component for the /policies toplevel.
API Component for a specific permission
Call get on the Policy.
Get the path of this component relative to the toplevel.
Call put on the policy.
API Component for a single tag.
API Component for /tags toplevel.
API component for a single user.
Return information about the user.
API component for users.
This is a container API that handles getting the path for individual users.
API Component for the /values toplevel
Call DELETE on the /values toplevel with a supplied query and list of tags to delete
Call GET on the /values toplevel with a supplied query and list of tags to return.
Call PUT on the /values toplevel with a supplied query and payload indicating new/updated tag-values.
Raw connection and querying.
copyright: | 2009-2010 Fom Authors. |
---|---|
license: | MIT, see LICENSE for more information. |
The default FluidDB URL
A set of serializable content types
A set of iterable types of primitive
The primitive FluidDB content type
Content types which can be deserialized
HTTP client.
Could/Should be swapped out for other implementations. Although is generally synchronous.
Parameters: |
|
---|
Make a request and return a response.
>>> db = FluidDB()
>>> r = db('GET', '/users/aliafshar')
>>> print r.value
{u'name': u'aliafshar', u'id': u'11e00b96-e346-44e7-af7f-e1a3575ff43e'}
Parameters: |
|
---|
A response to a FluidDB request.
These are generally created by the API, and returned, and there is little use to create them manually.
Parameters: |
|
---|
The content type of the response.
The deserialized value of the response body, if it is appropriate for deserialization.
The raw content of the response body.
The request id of the response. This is only available during errors.
The error from the response. This is only available during errors.