This branch adds an initializeRemoteBugDB() method to the BugzillaAPI ExternalBugTracker, in accordance with IExternalBugTracker. I've refactored a couple of methods out of BugzillaLPPlugin, which descends from BugzillaAPI, and into the BugzillaAPI class because they are useful utilities. I've also refactored the associated tests into the bugzilla-api doctest. Note that this branch is based on a branch that hasn't yet landed (but which is r=cprov). Please use the diff below rather than the one generated by the merge proposal. Launchpad lint -------------- Checking for conflicts. and issues in doctests and templates. Running jslint, xmllint, pyflakes, and pylint. Using normal rules. Linting changed files: lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt lib/lp/bugs/externalbugtracker/bugzilla.py lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt lib/lp/bugs/tests/externalbugtracker.py Diff of changes --------------- === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt' --- lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2009-08-20 15:43:37 +0000 +++ lib/lp/bugs/doc/externalbugtracker-bugzilla-api.txt 2009-08-21 09:51:57 +0000 @@ -111,3 +111,111 @@ >>> bugzilla.getCurrentDBTime() CALLED Bugzilla.time() datetime.datetime(2009, 8, 19, 22, 2, 2, tzinfo=) + + +Initializing the bug database +----------------------------- + +BugzillaAPI implements IExternalBugTracker.initializeRemoteBugDB(), +which takes a list of bug IDs to fetch from the remote server and stores +those bugs locally for future use. + + >>> bugzilla.initializeRemoteBugDB([1, 2]) + CALLED Bug.get({'ids': [1, 2], 'permissive': True}) + +The bug data is stored as a list of dicts: + + >>> def print_bugs(bugs): + ... for bug in sorted(bugs): + ... print "Bug %s:" % bug + ... for key in sorted(bugzilla._bugs[bug]): + ... print " %s: %s" % (key, bugzilla._bugs[bug][key]) + ... print "\n" + + >>> print_bugs(bugzilla._bugs) + Bug 1: + alias: + assigned_to: