Package amplee :: Package handler :: Class MemberHandler
[hide private]
[frames] | no frames]

Class MemberHandler

source code

object --+
         |
        MemberHandler


Main member hander that HTTP method handler can call to
perform CRUD operations on the member and resource.



Instance Methods [hide private]

Inherited from object: __delattr__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__


Class Methods [hide private]
  create_from_stream(cls, collection, member_type, fileobj, length, media_type=None)
Create a new a collection and attach it.
  get_content(cls, collection, rid)
Get the content of a resource which identifier is 'rid' Raise a amplee.error.UnknownResource error if it could not be found.
  get_atom(cls, collection, rid)
Get the content of an atom entry which identifier is 'rid' Raise a amplee.error.UnknownResource error if it could not be found.
  delete(cls, collection, member_id, media_id)
Delete the media resource and its meta data from the collection.
  update_content_from_stream(cls, collection, member_type, rid, fileobj, length)
Update a resource identified by 'rid' Returns the updated member.

Properties [hide private]

Inherited from object: __class__


Method Details [hide private]

create_from_stream(cls, collection, member_type, fileobj, length, media_type=None)
Class Method

source code 

Create a new a collection and attach it.
Returns the new member.

If member_type.on_create is set to a callable and that
callable raises an error or an exception, the member will not
be attached to the collection and not returned by the class method.

Keyword arguments
collection -- collection which will host the member
member_type -- a MemberType instance for the mime type of the resource
fileobj -- a file object containg the content. It only needs a read(length) method
length -- how much content to read from the file object
media_type -- media type of the request

get_content(cls, collection, rid)
Class Method

source code 

Get the content of a resource which identifier is 'rid'

Raise a amplee.error.UnknownResource error if it could not
be found.

Keyword arguments
collection -- collection which will host the member
rid -- resource identifier

get_atom(cls, collection, rid)
Class Method

source code 

Get the content of an atom entry which identifier is 'rid'

Raise a amplee.error.UnknownResource error if it could not
be found.

Keyword arguments
collection -- collection which will host the member
rid -- resource identifier

delete(cls, collection, member_id, media_id)
Class Method

source code 

Delete the media resource and its meta data from the collection.

Keyword arguments
collection -- collection which will host the member
member_id -- member identifier
media_id -- media identifier

update_content_from_stream(cls, collection, member_type, rid, fileobj, length)
Class Method

source code 

Update a resource identified by 'rid'
Returns the updated member.

If member_type.on_update is set to a callable and that
callable raises an error or an exception, the member will not
be attached to the collection and not returned by the class method.

Keyword arguments
collection -- collection which will host the member
member_type -- a MemberType instance for the mime type of the resource
rid - entry resource identifier
fileobj -- a file object containg the content. It only needs a read(length) method
length -- how much content to read from the file object