> @@ -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:
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/ externalbugtrac ker-bugzilla- api.txt' bugs/doc/ externalbugtrac ker-bugzilla- api.txt 2009-08-20 15:43:37 +0000 bugs/doc/ externalbugtrac ker-bugzilla- api.txt 2009-08-21 09:51:57 +0000 getCurrentDBTim e() datetime( 2009, 8, 19, 22, 2, 2, tzinfo=<UTC>) ------- ------- ------- -- cker.initialize RemoteBugDB( ), initializeRemot eBugDB( [1, 2]) bugzilla. _bugs[bug] ): _bugs[bug] [key]) bugzilla. _bugs)
> --- lib/lp/
> +++ lib/lp/
> @@ -111,3 +111,111 @@
> >>> bugzilla.
> CALLED Bugzilla.time()
> datetime.
> +
> +
> +Initializing the bug database
> +------
> +
> +BugzillaAPI implements IExternalBugTra
> +which takes a list of bug IDs to fetch from the remote server and stores
> +those bugs locally for future use.
> +
> + >>> bugzilla.
> + 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(
> + ... print " %s: %s" % (key, bugzilla.
> + ... print "\n"
> +
> + >>> print_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 teBugDB( ) uses the _storeBugs() method to store bug data. _bug_aliases = {} initializeRemot eBugDB( [2, 'bug-two']) bugzilla. _bugs): bugzilla. _bugs[bug] ): _bugs[bug] [key])
> + status: NEW
> + summary: Collect unknown persons in docking bay 2.
> + <BLANKLINE>
> + <BLANKLINE>
> +
> +
> +Storing bugs
> +------------
> +
> +initializeRemo
> +_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.
> + >>> bugzilla.
> + CALLED Bug.get({'ids': [2, 'bug-two'], 'permissive': True})
> +
> + >>> for bug in sorted(
> + ... print "Bug %r:" % bug
> + ... for key in sorted(
> + ... print " %s: %s" % (key, bugzilla.
> + ... 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/ externalbugtrac ker-bugzilla- lp-plugin. txt' bugs/doc/ externalbugtrac ker-bugzilla- lp-plugin. txt 2009-08-19 09:22:08 +0000 bugs/doc/ externalbugtrac ker-bugzilla- lp-plugin. txt 2009-08-21 09:51:57 +0000
> --- lib/lp/
> +++ lib/lp/
> @@ -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' bugs/tests/ bugzilla- xmlrpc- transport. txt 2009-08-19 23:17:09 +0000 bugs/tests/ bugzilla- xmlrpc- transport. txt 2009-08-21 09:51:57 +0000 ------- ------- ------- - value[' bugs']
> --- lib/lp/
> +++ lib/lp/
> @@ -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_
> + >>> for key in sorted(bug_dict):
> + ... print "%s: %s" % (key, bug_dict[key])
> + alias:
trailing space.