changeset 34:1ce13b2b54a4

stubbing adding attachment; incomplete
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 14 Dec 2012 14:38:27 -0800
parents 19c6b5cea57f
children 94b0b7b4f190
files bzconsole/api.py
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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"""