components.blob.models

Blob model

class components.blob.models.Blob(*args, **kwargs)

Bases: django_mongoengine.document.DjangoFlavor, mongoengine.document.Document

Blob object

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

blob

Return blob from blob host.

Returns:

classmethod blob_host()

Return blob host.

Returns:

delete_blob()

Delete blob on the blob host.

Returns:

filename
static get_all()

Return all blobs.

Args:

Returns:List of Blob instances.
static get_all_by_user_id(user_id)

Return all blobs by user.

Parameters:user_id – User id.
Returns:List of Blob instances for the given user id.
static get_all_except_user_id(user_id)

Return all blobs except the ones of user.

Parameters:user_id – User id.
Returns:List of Blob instances except for the given user id.
static get_by_id(blob_id)

Return the object with the given id.

Parameters:blob_id
Returns:Blob
handle
id

A field wrapper around MongoDB’s ObjectIds.

save_blob()

Save blob on the blob host.

Returns:

user_id