l.b.i.w.IBugAttachment(IHasBug) : interface documentation

Part of lp.bugs.interfaces.webservice View In Hierarchy

A file attachment to an IBug.

Launchpadlib example of accessing content of an attachment:

for attachment in bug.attachments:
    buffer = attachment.data.open()
    for line in buffer:
        print line
    buffer.close()

Launchpadlib example of accessing metadata about an attachment:

attachment = bug.attachments[0]
print "title:", attachment.title
print "ispatch:", attachment.type

For information about the file-like object returned by attachment.data.open() see lazr.restfulclient's documentation of the HostedFile object.

Details about the message associated with an attachment can be found on the "message" attribute:

message = attachment.message
print "subject:", message.subject.encode('utf-8')
print "owner:", message.owner.display_name.encode('utf-8')
print "created:", message.date_created
Int id Undocumented
Bytes libraryfile Undocumented
Bool is_patch Is this attachment a patch?
Method removeFromBug Remove the attachment from the bug.
Method destroySelf Delete this record.
Method getFileByName Return the `ILibraryFileAlias for the given file name.
Int _messageID Undocumented

Inherited from IHasBug:

Int bug Undocumented
id =
Undocumented
libraryfile =
Undocumented
_messageID =
Undocumented
is_patch =
Is this attachment a patch?
@call_with(REQUEST_USER)
@export_write_operation()
def removeFromBug(user):
Remove the attachment from the bug.
def destroySelf():
Delete this record.

The library file content for this attachment is set to None.

def getFileByName(filename):
Return the `ILibraryFileAlias for the given file name.

NotFoundError is raised if the given filename does not match
libraryfile.filename.
API Documentation for Launchpad, generated by pydoctor at 2020-09-24 00:00:06.