launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #20631
Re: [Merge] lp:~thomir/launchpad/devel-add-gpg-client-timeline-support into lp:launchpad
Review: Approve code
Diff comments:
> === modified file 'lib/lp/services/gpg/handler.py'
> --- lib/lp/services/gpg/handler.py 2016-05-19 04:37:33 +0000
> +++ lib/lp/services/gpg/handler.py 2016-06-16 23:12:12 +0000
> @@ -640,9 +641,35 @@
>
> def __init__(self):
> super(LPGPGClient, self).__init__(bypass_proxy=True)
> + self.action = None
>
> def get_endpoint(self):
> return config.gpgservice.api_endpoint
>
> def get_timeout(self):
> return 30.0
> +
> + def on_request_start(self, method, path, data=None,
> + headers=dict()):
> + assert self.action is None, "Error: Overlapping requests to gpgservice"
> + timeline = get_request_timeline(
> + get_current_browser_request())
> + if data:
> + data_summary = '%d byte body' % len(data)
> + else:
> + data_summary = 'no body'
> + header_whitelist = (
> + 'content-type',
> + 'x-gpg-fingerprint',
> + )
> + headers = dict(
> + [(k, v) for k, v in headers.items() if k.lower() in header_whitelist]
> + )
We only support Python 2.7, so this can use a dict comprehension.
> + self.action = timeline.start(
> + "gpgservice-%s" % method.upper(),
> + ' '.join((path, data_summary, json.dumps(headers)))
> + )
> +
> + def on_request_end(self):
> + self.action.finish()
> + self.action = None
--
https://code.launchpad.net/~thomir/launchpad/devel-add-gpg-client-timeline-support/+merge/297589
Your team Launchpad code reviewers is subscribed to branch lp:launchpad.
References