Jump to >

reviewboard.attachments.managers

class FileAttachmentManager[source]

Bases: django.db.models.manager.Manager

Manages FileAttachment objects.

Adds utility functions for looking up FileAttachments based on other objects.

create_from_filediff(filediff, from_modified=True, save=True, **kwargs)[source]

Create a new FileAttachment for a FileDiff.

FileAttachments created from a FileDiff are used to represent changes to binary files which would otherwise not be displayed with the diff.

An individual FileAttachment can represent either the original or modified copy of the file. If ‘from_modified’ is True, then the FileAttachment will be created using the information (filename, revision, etc.) for the modified version. If it is False, the FileAttachment will be created using the information for the original version.

filter_for_repository(repository)[source]

Filter results for those on a given repository.

get_for_filediff(filediff, modified=True)[source]

Return the FileAttachment matching a DiffSet.

The FileAttachment associated with the path, revision and repository matching the DiffSet will be returned, if it exists.

It is up to the caller to check for errors.