Merge lp:~milo/linaro-patchmetrics/bug1013577 into lp:linaro-patchmetrics

Proposed by Milo Casagrande
Status: Merged
Merged at revision: 367
Proposed branch: lp:~milo/linaro-patchmetrics/bug1013577
Merge into: lp:linaro-patchmetrics
Diff against target: 42 lines (+9/-4)
2 files modified
apps/patchmetrics/gerrit.py (+7/-2)
apps/patchmetrics/tests/test_gerrit.py (+2/-2)
To merge this branch: bzr merge lp:~milo/linaro-patchmetrics/bug1013577
Reviewer Review Type Date Requested Status
Deepti B. Kalakeri (community) Approve
Review via email: mp+112722@code.launchpad.net

Description of the change

Proposing another merge, hopefully now taking into consideration all cases.

We still have a problem with some type of "emails", that are not valid, like "dp583@stebjsxu0119.(none)": the android-review gerrit instance will skip the "(none)" part giving back an error string that does not contain the original email.

The changes should fix this, and also the tests.

To post a comment you must log in.
Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

+1 Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'apps/patchmetrics/gerrit.py'
2--- apps/patchmetrics/gerrit.py 2012-06-27 10:35:27 +0000
3+++ apps/patchmetrics/gerrit.py 2012-06-29 08:26:22 +0000
4@@ -120,9 +120,14 @@
5 for key, value in query_params.iteritems():
6 # We cannot have None values here, we just skip them.
7 if value is not None:
8+ # We need string, and remove white chars.
9+ value = str(value).strip()
10+ # Some emails need to be quoted, and only double quotes are
11+ # accepted by gerrit.
12+ if key == GERRIT_OWNER_KEY:
13+ value = ("\"%s\"" % value)
14 # We need strings here, and we remove white spaces.
15- params_list.append(":".join((key,
16- urllib.quote(str(value).strip()))))
17+ params_list.append(":".join((key, urllib.quote(value))))
18 # The resulting query string, without separators or prefixes, should be in
19 # the form of:
20 # key:value+key:value
21
22=== modified file 'apps/patchmetrics/tests/test_gerrit.py'
23--- apps/patchmetrics/tests/test_gerrit.py 2012-06-27 12:17:02 +0000
24+++ apps/patchmetrics/tests/test_gerrit.py 2012-06-29 08:26:22 +0000
25@@ -112,7 +112,7 @@
26 query_params = {'owner': 'person@example.org', 'sortkey_after': 'abcd'}
27 expected_result = (ROOT_REST_URL + CHANGES_QUERY_PATH +
28 QUERY_STRING_START + "n=100&format=JSON&q=owner:"
29- "person%40example.org+resume_sortkey:abcd")
30+ "%22person%40example.org%22+resume_sortkey:abcd")
31 self.assertEquals(expected_result,
32 create_request_query_url(ROOT_REST_URL,
33 CHANGES_QUERY_PATH,
34@@ -125,7 +125,7 @@
35 GERRIT_QUERY_RESUME_SORTKEY: 'abcd'}
36 expected_result = (ROOT_REST_URL + CHANGES_QUERY_PATH +
37 QUERY_STRING_START + "n=100&format=JSON&q=owner:"
38- "name%2Bsurname.person%40example.org+"
39+ "%22name%2Bsurname.person%40example.org%22+"
40 "resume_sortkey:abcd")
41 self.assertEquals(expected_result,
42 create_request_query_url(ROOT_REST_URL,

Subscribers

People subscribed via source and target branches