# HG changeset patch # User Jeff Hammel # Date 1355524707 28800 # Node ID 1ce13b2b54a4ae3f8081f6a1ee5b4ee79ce3f0c4 # Parent 19c6b5cea57feb73feba411a746ea636a928b48c stubbing adding attachment; incomplete diff -r 19c6b5cea57f -r 1ce13b2b54a4 bzconsole/api.py --- a/bzconsole/api.py Tue Dec 04 13:48:13 2012 -0800 +++ b/bzconsole/api.py Fri Dec 14 14:38:27 2012 -0800 @@ -155,6 +155,30 @@ # return the URL return results['ref'] + def attach(self, bug, contents, description=None, reviewer=None, comment=None): + """ + add an attachment to a bug + + - bug: bug number to attach to + - contents: file or URL of attachment + - reviewer: flag for review (r?) + - comment: add this comment to the bug + """ + + if not description: + description = contents + + # create attachment data structure + # https://wiki.mozilla.org/Bugzilla:REST_API:Objects#Attachment + attachment= {'bug': int(bug), + 'description': description, + } + if reviewer: + flags = [] + pass # TODO + + self.request('/bug/%s/attachment', attachment) + def configuration(self): """bugzilla configuration"""