Package entropy :: Package client :: Package services :: Module interfaces :: Class DocumentFactory

Class DocumentFactory

source code


Class to generate valid, new Document objects.

Instance Methods
 
__init__(self, repository_id)
DocumentFactory constructor.
source code
Document
comment(self, username, comment, title, keywords)
Generate a new Comment Document.
source code
Document
image(self, username, file_object, title, description, keywords)
Generate a new Image Document.
source code
Document
icon(self, username, file_object, title, description, keywords)
Generate a new Icon Document.
source code
Document
video(self, username, file_object, title, description, keywords)
Generate a new Icon Document.
source code
Document
file(self, username, file_object, title, description, keywords)
Generate a new File Document.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  DOCUMENT_USERNAME_ID = 'username'
  DOCUMENT_PAYLOAD_ID = 'payload'
  MAX_STRING_LENGTH = 4000
Properties

Inherited from object: __class__

Method Details

__init__(self, repository_id)
(Constructor)

source code 

DocumentFactory constructor.

Parameters:
  • repository_id (string) - repository identifier
Overrides: object.__init__

comment(self, username, comment, title, keywords)

source code 

Generate a new Comment Document.

Parameters:
  • username (string) - username of the owner of the Document
  • comment (string) - comment text
  • title (string) - comment title
  • keywords (string) - space separated string containing keywords
Returns: Document
a new Document object

image(self, username, file_object, title, description, keywords)

source code 

Generate a new Image Document.

Parameters:
  • username (string) - username of the owner of the Document
  • file_object (string) - file object pointing to the image file data. Note that this resource must be closed by the caller once the object lifecycle is over. Not doing so will cause the application running out of resources, leading to crashes. To retrieve the filename, the "name" attribute is read, this won't work for fdopened files.
  • title (string) - comment title
  • keywords (string) - space separated string containing keywords
Returns: Document
a new Document object

icon(self, username, file_object, title, description, keywords)

source code 

Generate a new Icon Document.

Parameters:
  • username (string) - username of the owner of the Document
  • file_object (string) - file object pointing to the image file data. Note that this resource must be closed by the caller once the object lifecycle is over. Not doing so will cause the application running out of resources, leading to crashes. To retrieve the filename, the "name" attribute is read, this won't work for fdopened files.
  • title (string) - comment title
  • keywords (string) - space separated string containing keywords
Returns: Document
a new Document object

video(self, username, file_object, title, description, keywords)

source code 

Generate a new Icon Document.

Parameters:
  • username (string) - username of the owner of the Document
  • file_object (string) - file object pointing to the image file data. Note that this resource must be closed by the caller once the object lifecycle is over. Not doing so will cause the application running out of resources, leading to crashes. To retrieve the filename, the "name" attribute is read, this won't work for fdopened files.
  • title (string) - comment title
  • keywords (string) - space separated string containing keywords
Returns: Document
a new Document object

file(self, username, file_object, title, description, keywords)

source code 

Generate a new File Document.

Parameters:
  • username (string) - username of the owner of the Document
  • file_object (string) - file object pointing to the image file data. Note that this resource must be closed by the caller once the object lifecycle is over. Not doing so will cause the application running out of resources, leading to crashes. To retrieve the filename, the "name" attribute is read, this won't work for fdopened files.
  • title (string) - comment title
  • keywords (string) - space separated string containing keywords
Returns: Document
a new Document object