Code review comment for lp:~gmb/launchpad/bugzilla-3.4-init-db-bug-416514

Revision history for this message
Abel Deuring (adeuring) wrote :

Hi Graham,

nice branch. No complaints, but I found a few lines with trailing spaces.
Could you remove them?

r=me

Abel

> === 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=<UTC>)
> +
> +
> +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:

trailing space.

> + assigned_to: <email address hidden>
> + component: GPPSystems
> + creation_time: 20080610T16:19:53
> + id: 1
> + internals:...
> + is_open: True
> + last_change_time: 20080610T16:19:53
> + priority: P1
> + product: Marvin
> + resolution: FIXED
> + severity: normal
> + status: RESOLVED
> + summary: That bloody robot still exists.
> + <BLANKLINE>
> + Bug 2:
> + alias: bug-two
> + assigned_to: <email address hidden>
> + component: Crew
> + creation_time: 20080611T09:23:12
> + id: 2
> + internals:...
> + is_open: True
> + last_change_time: 20080611T09:24:29
> + priority: P1
> + product: HeartOfGold
> + resolution:

trailing space.

> + severity: high
> + status: NEW
> + summary: Collect unknown persons in docking bay 2.
> + <BLANKLINE>
> + <BLANKLINE>
> +
> +
> +Storing bugs
> +------------
> +
> +initializeRemoteBugDB() uses the _storeBugs() method to store bug data.
> +_storeBugs() will only store a bug once, even if it is requested both by
> +alias and ID. We'll reset the test BugzillaAPI's _bugs and _bug_aliases
> +dicts to demonstrate this.
> +
> + >>> bugzilla._bugs = {}
> + >>> bugzilla._bug_aliases = {}
> + >>> bugzilla.initializeRemoteBugDB([2, 'bug-two'])
> + CALLED Bug.get({'ids': [2, 'bug-two'], 'permissive': True})
> +
> + >>> for bug in sorted(bugzilla._bugs):
> + ... print "Bug %r:" % bug
> + ... for key in sorted(bugzilla._bugs[bug]):
> + ... print " %s: %s" % (key, bugzilla._bugs[bug][key])
> + ... print "\n"
> + Bug 2:
> + alias: bug-two
> + assigned_to: <email address hidden>
> + component: Crew
> + creation_time: 20080611T09:23:12
> + id: 2
> + internals:...
> + is_open: True
> + last_change_time: 20080611T09:24:29
> + priority: P1
> + product: HeartOfGold
> + resolution:

trailing space.

[...]

> === modified file 'lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt'
> --- lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2009-08-19 09:22:08 +0000
> +++ lib/lp/bugs/doc/externalbugtracker-bugzilla-lp-plugin.txt 2009-08-21 09:51:57 +0000

> @@ -369,7 +331,8 @@
> >>> del bugzilla._bugs[999]
>
>
> -== Getting the remote product ==
> +Getting the remote product
> +--------------------------
>
> getRemoteProduct() returns the product a remote bug is associated with
> in Bugzilla.

trailing space.

[...]

> === modified file 'lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt'
> --- lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt 2009-08-19 23:17:09 +0000
> +++ lib/lp/bugs/tests/bugzilla-xmlrpc-transport.txt 2009-08-21 09:51:57 +0000
> @@ -609,3 +609,35 @@
> tz_short_name: CET
> web_time: 20080501T01:01:01
> web_time_utc: 20080501T00:01:01
> +
> +
> +Getting bugs from the server
> +----------------------------
> +
> +The Bugzilla API method Bug.get() allows us to get one or more bugs from
> +the remote server. It takes a list of bug IDs to return and returns a
> +list of dicts containing those bugs' data.
> +
> + >>> return_value = server.Bug.get(
> + ... {'ids': [1], 'permissive': True})
> + >>> [bug_dict] = return_value['bugs']
> + >>> for key in sorted(bug_dict):
> + ... print "%s: %s" % (key, bug_dict[key])
> + alias:

trailing space.

review: Approve (code)

« Back to merge proposal