[RFE attachmentbase.py|LPAttachment] make ATTACHMENTS.ATTACHMENT_PATH a property of LPAttachment

Bug #242317 reported by Stephan Rügamer
2
Affects Status Importance Assigned to Milestone
python-launchpad-bugs
Fix Released
Undecided
Unassigned

Bug Description

Dear Colleagues,

please make ATTACHMENTS.ATTACHMENT_PATH a property of LPAttachment and not a global variable in lpconstants.

Thx,

\sh - Project Leonov :)

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

Markus Korn (thekorn)
Changed in python-launchpad-bugs:
status: New → In Progress
Revision history for this message
Markus Korn (thekorn) wrote :

In the recent rev of the intrepid.merge branch I renamed the function, it is now just '.download' instead of 'download_to', so in my example above it should be:

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

Markus

Revision history for this message
Stephan Rügamer (sruegamer) wrote :

Hi Markus,

I forgot to comment on this report yesterday.
I've implemented the download function into Leonov and it works great.

the new bugreport progress hook I didn't test...but this is only a matter of time :)

regards,

\sh

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

------------------------------------------------------------
revno: 107
committer: Markus Korn <email address hidden>
branch nick: python-launchpad-bugs
timestamp: Wed 2008-07-02 22:34:33 +0200
message:
  * Improved LPBugList and LPBugPage:
    This two classes have now a cleaner structure, filtering of bug lists
    with python-launchpad-bugs is now a lot easier. With
    LPBugList.set_progress_hook() it is now possible to visualize the
    process of fetching bug lists.
  * launchpadbugs/{tasksbase,html_bug.py,text_bug.py}: if a task is a
    bugwatch then task.remote returns the remote-url, otherwise it returns
    'None'
  * Improved error handling in python-launchpad-bugs and added
    infrastructure for unittests. This also contains some basic testcases in
    tests/ (LP: #189572)
  * Added ability to parse bugtracker overviews (LP: #203312)
  * It is now possible to filter bug lists based on milestones. This also
    implements a helper function to list all active milestones of a project
    in launchpad (LP: #200457)
  * Added function to filter buglists based on Bug.date_reported
    (LP: #185357)
  * added 'move-duplicates' written by Kjell Braden and 'README' to
    examples/ (LP: #208148)
  * launchpadbugs/attachmentsbase.py: LPAttachment.download() now also
    accepts an optional argument to specify the location where to download
    the attachment (LP: #242317)
  * Added method to let the user choose which version/server of launchpad to
    use, so it is possible to explicit use bugs.launchpad.net or
    bugs.edge.launchpad.net (LP: #188298)
  * launchpadbugs/html_bug.py: InfoTable: fixed parsing of milestones in
    read-only mode (LP: #243057)
  * Added functionality for adding new tasks to bug reports.
    With this implementation so far you are able to add 'project' and
    'distro' tasks, but unable to create bugwatches and change task
    attributes before committing the changes. (LP: #193853)
  * launchpadbugs/html_bug.py: Stephan Hermann fixed html connector to work
    with the newest launchpad rollout (LP: #243193, #244452)
    .
    Unfortunately this update breaks compatibilty. Please update your code
    to make use of the python-launchpad-bugs 0.3 API. It's worth it.
    ------------------------------------------------------------

Changed in python-launchpad-bugs:
status: In Progress → Fix Committed
Revision history for this message
Markus Korn (thekorn) wrote :

Fix released in py-lp-bugs 0.3

Changed in python-launchpad-bugs:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.