Comment 1 for bug 242317

Revision history for this message
Markus Korn (thekorn) wrote :

This is how I implemented it in the intrepid.merge branch:

In [10]: from launchpadbugs.connector import ConnectBug

In [11]: Bug = ConnectBug()

In [12]: b = Bug(240685)

In [13]: b.attachments[0]
Out[13]: <Attachment (up: #15380150)>

In [14]: b.attachments[0].download_to("/tmp/boo/baz.diff")

In [15]: b.attachments[0]
Out[15]: <Attachment (up: #15380150), (down: /tmp/boo/baz.diff)>

In [16]: b.attachments[0].text
Out[16]: '=== modified file \'launchpadbugs/http_connection.py\'\n--- launchpadbugs/http_connection.py\t2008-06-14 09:22:30 +0000\n+++ launchpadbugs/http_connection.py\t2008-06-17 14:38:10 +0000\n@@ -195,6 +195,12 @@\n assert callable(hook_func), "hook_func needs to be callable with three arguments"\n self.__progress_hook = hook_func\n \n+ def save_cookie(self, filename):\n+ cj = cookielib.MozillaCookieJar()\n+ for cookie in self.__cookie_handler.cookiejar:\n+ cj.set_cookie(cookie)\n+ cj.save(filename)\n+ \n \n if __name__ == \'__main__\':\n c = HTTPConnection()\n\n'

In [17]:

In [17]: print b.attachments[0].is_down
True

Markus