swimlane.core.fields.attachment module

class swimlane.core.fields.attachment.AttachmentCursor(field, initial_elements=None)[source]

Bases: FieldCursor

Allows creation and iteration of attachments

add(filename, stream, content_type=None)[source]

Upload a new attachment, and add it to current fields raw data to be persisted on save

Can optionally manually set the content_type, will be guessed by provided filename extension and default to application/octet-stream if it cannot be guessed

validate_stream(stream, key)[source]
class swimlane.core.fields.attachment.AttachmentsField(*args, **kwargs)[source]

Bases: MultiSelectField

bulk_modify_support = False
cast_to_python(value)[source]

Called during set_swimlane, should accept a single raw value as provided from API

Defaults to no-op

cast_to_swimlane(value)[source]

Called during get_swimlane, should accept a python value and return swimlane representation

Defaults to no-op

cursor_class

alias of AttachmentCursor

field_type = ('Core.Models.Fields.AttachmentField, Core', 'Core.Models.Fields.Attachment.AttachmentField, Core')
get_batch_representation()[source]

Return best batch process representation of field value

get_initial_elements()[source]

Return initial elements to be passed with cursor instantiation

supported_types = [<class 'swimlane.core.resources.attachment.Attachment'>]