[python-bugzilla] How to attach file ?

Cole Robinson crobinso at redhat.com
Tue Nov 19 18:12:41 UTC 2013


On 11/19/2013 05:26 AM, Khokhar cth wrote:
> Thanks for the information Cole,
> 
> Installing pycurl was challenge ;-)
> 
> However, I've installed python-request and latest python-bugzilla version from
> Git. 
> 
> But still I have problem while attaching the file. File get corrupted  (that
> was my actual problem).
> 
> 
> I am using "attachfile" method.
> 
>     def attachfile(self, idlist, attachfile, description, **kwargs):
> 
> and   _detect_filetype(fname) and "python magic" methods implemented in base.py but still file(s) (.zip, .jpeg etc) get corrupted after uploading on Bugzilla.. 
> 
> 

Does the bugzilla command line tool work for adding an attachment?
What version is the bugzilla server?
Is this server publicly accessible so I can try and reproduce on my side?

Can you reproduce with a patch like:


diff --git a/bugzilla/base.py b/bugzilla/base.py
index 3a5d65d..5eae7c0 100644
--- a/bugzilla/base.py
+++ b/bugzilla/base.py
@@ -1226,6 +1226,7 @@ class BugzillaBase(object):
                 ctype = 'application/octet-stream'
             kwargs['content_type'] = ctype

+        print kwargs
         ret = self._proxy.Bug.add_attachment(kwargs)

         if "attachments" in ret:


So we can see exactly what arguments are being passed to the API call

- Cole


More information about the python-bugzilla mailing list