Merge ~cjwatson/launchpad:reduce-ensure-str into launchpad:master
- Git
- lp:~cjwatson/launchpad
- reduce-ensure-str
- Merge into master
Proposed by
Colin Watson
Status: | Merged |
---|---|
Approved by: | Colin Watson |
Approved revision: | 84ad29369c11fcaef75eff96df0fe73a56ad855f |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | ~cjwatson/launchpad:reduce-ensure-str |
Merge into: | launchpad:master |
Diff against target: |
1607 lines (+153/-211) 57 files modified
lib/launchpad_loggerhead/app.py (+1/-2) lib/lp/answers/stories/question-obfuscation.txt (+2/-2) lib/lp/app/doc/displaying-paragraphs-of-text.txt (+7/-12) lib/lp/app/doc/launchpadform.txt (+1/-1) lib/lp/app/doc/launchpadview.txt (+2/-2) lib/lp/app/doc/menus.txt (+1/-1) lib/lp/app/doc/textformatting.txt (+2/-2) lib/lp/app/widgets/doc/announcement-date-widget.txt (+1/-1) lib/lp/app/widgets/doc/noneable-text-widgets.txt (+1/-1) lib/lp/app/widgets/doc/project-scope-widget.txt (+1/-2) lib/lp/app/widgets/doc/stripped-text-widget.txt (+1/-1) lib/lp/blueprints/browser/sprint.py (+0/-7) lib/lp/blueprints/stories/blueprints/xx-editing.txt (+2/-2) lib/lp/blueprints/stories/blueprints/xx-productseries.txt (+5/-6) lib/lp/blueprints/stories/standalone/subscribing.txt (+10/-14) lib/lp/bugs/model/tests/test_bugtasksearch.py (+4/-7) lib/lp/bugs/stories/bug-also-affects/xx-bug-also-affects.txt (+2/-2) lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt (+3/-3) lib/lp/bugs/stories/bugattachments/xx-bugattachments.txt (+5/-5) lib/lp/bugs/stories/bugs/xx-bug-edit.txt (+2/-2) lib/lp/bugs/stories/bugs/xx-bug-index.txt (+2/-2) lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt (+1/-1) lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt (+1/-1) lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt (+2/-3) lib/lp/code/browser/tests/test_codereviewcomment.py (+1/-1) lib/lp/code/model/branch.py (+1/-1) lib/lp/coop/answersbugs/visibility.py (+1/-3) lib/lp/registry/browser/tests/person-admin-views.txt (+3/-3) lib/lp/registry/browser/tests/test_announcements.py (+1/-2) lib/lp/registry/doc/person-account.txt (+3/-3) lib/lp/registry/scripts/tests/test_closeaccount.py (+33/-34) lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt (+2/-2) lib/lp/services/database/doc/enumcol.txt (+1/-1) lib/lp/services/database/doc/textsearching.txt (+2/-2) lib/lp/services/doc/limitedlist.txt (+1/-1) lib/lp/services/gpg/doc/gpg-encryption.txt (+4/-4) lib/lp/services/gpg/handler.py (+1/-2) lib/lp/services/gpg/tests/test_gpghandler.py (+2/-2) lib/lp/services/librarian/model.py (+1/-2) lib/lp/services/mail/doc/notification-recipient-set.txt (+1/-1) lib/lp/services/webapp/breadcrumb.py (+1/-6) lib/lp/services/webapp/doc/canonical_url.txt (+1/-2) lib/lp/services/webapp/doc/menus.txt (+1/-2) lib/lp/services/webapp/doc/test_adapter.txt (+2/-2) lib/lp/services/webapp/publication.py (+1/-5) lib/lp/services/webapp/publisher.py (+3/-5) lib/lp/services/webapp/servers.py (+1/-3) lib/lp/services/webservice/doc/launchpadlib.txt (+1/-3) lib/lp/soyuz/scripts/gina/packages.py (+2/-6) lib/lp/soyuz/scripts/ppareport.py (+2/-3) lib/lp/soyuz/stories/soyuz/xx-builds-pages.txt (+1/-2) lib/lp/translations/model/pomsgid.py (+1/-1) lib/lp/translations/model/potranslation.py (+1/-1) lib/lp/translations/stories/standalone/xx-language.txt (+2/-3) lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt (+5/-6) lib/lp/translations/stories/translations/xx-translations.txt (+10/-12) scripts/list-team-members (+1/-3) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guruprasad | Approve | ||
Review via email: mp+415902@code.launchpad.net |
Commit message
Remove simple uses of six.ensure_str
Description of the change
These were clearly no-ops on Python 3, but missed by pyupgrade for various reasons, such as being in doctests.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/lib/launchpad_loggerhead/app.py b/lib/launchpad_loggerhead/app.py | |||
2 | index 7ada98a..3e693f2 100644 | |||
3 | --- a/lib/launchpad_loggerhead/app.py | |||
4 | +++ b/lib/launchpad_loggerhead/app.py | |||
5 | @@ -40,7 +40,6 @@ from paste.request import ( | |||
6 | 40 | parse_querystring, | 40 | parse_querystring, |
7 | 41 | path_info_pop, | 41 | path_info_pop, |
8 | 42 | ) | 42 | ) |
9 | 43 | import six | ||
10 | 44 | from six.moves.urllib.parse import ( | 43 | from six.moves.urllib.parse import ( |
11 | 45 | urlencode, | 44 | urlencode, |
12 | 46 | urljoin, | 45 | urljoin, |
13 | @@ -256,7 +255,7 @@ class RootApp: | |||
14 | 256 | self.log.info('Using branch: %s', branch_name) | 255 | self.log.info('Using branch: %s', branch_name) |
15 | 257 | if trail and not trail.startswith('/'): | 256 | if trail and not trail.startswith('/'): |
16 | 258 | trail = '/' + trail | 257 | trail = '/' + trail |
18 | 259 | environ['PATH_INFO'] = six.ensure_str(trail) | 258 | environ['PATH_INFO'] = trail |
19 | 260 | environ['SCRIPT_NAME'] += consumed.rstrip('/') | 259 | environ['SCRIPT_NAME'] += consumed.rstrip('/') |
20 | 261 | branch_url = lp_server.get_url() + branch_name | 260 | branch_url = lp_server.get_url() + branch_name |
21 | 262 | branch_link = urljoin( | 261 | branch_link = urljoin( |
22 | diff --git a/lib/lp/answers/stories/question-obfuscation.txt b/lib/lp/answers/stories/question-obfuscation.txt | |||
23 | index f6a23c9..1f082fd 100644 | |||
24 | --- a/lib/lp/answers/stories/question-obfuscation.txt | |||
25 | +++ b/lib/lp/answers/stories/question-obfuscation.txt | |||
26 | @@ -96,7 +96,7 @@ Anonymous cannot see the email address anywhere on the Answers front | |||
27 | 96 | page. | 96 | page. |
28 | 97 | 97 | ||
29 | 98 | >>> anon_browser.open('http://answers.launchpad.test/') | 98 | >>> anon_browser.open('http://answers.launchpad.test/') |
31 | 99 | >>> six.ensure_str('user@domain.com') in anon_browser.contents | 99 | >>> 'user@domain.com' in anon_browser.contents |
32 | 100 | False | 100 | False |
33 | 101 | 101 | ||
34 | 102 | >>> question_portlet = find_tag_by_id( | 102 | >>> question_portlet = find_tag_by_id( |
35 | @@ -132,7 +132,7 @@ They cannot see the address reading the question either. | |||
36 | 132 | link ... | 132 | link ... |
37 | 133 | 133 | ||
38 | 134 | >>> anon_browser.getLink('mailto: problem in webpage').click() | 134 | >>> anon_browser.getLink('mailto: problem in webpage').click() |
40 | 135 | >>> six.ensure_str('user@domain.com') in anon_browser.contents | 135 | >>> 'user@domain.com' in anon_browser.contents |
41 | 136 | False | 136 | False |
42 | 137 | 137 | ||
43 | 138 | >>> description = find_main_content(anon_browser.contents).p | 138 | >>> description = find_main_content(anon_browser.contents).p |
44 | diff --git a/lib/lp/app/doc/displaying-paragraphs-of-text.txt b/lib/lp/app/doc/displaying-paragraphs-of-text.txt | |||
45 | index 94171e0..c50955a 100644 | |||
46 | --- a/lib/lp/app/doc/displaying-paragraphs-of-text.txt | |||
47 | +++ b/lib/lp/app/doc/displaying-paragraphs-of-text.txt | |||
48 | @@ -494,7 +494,7 @@ we want to replace a variable number of spaces with the same number of | |||
49 | 494 | 494 | ||
50 | 495 | >>> from lp.app.browser.stringformatter import FormattersAPI | 495 | >>> from lp.app.browser.stringformatter import FormattersAPI |
51 | 496 | >>> import re | 496 | >>> import re |
53 | 497 | >>> matchobj = re.match('foo(.*)bar', six.ensure_str('fooX Ybar')) | 497 | >>> matchobj = re.match('foo(.*)bar', 'fooX Ybar') |
54 | 498 | >>> matchobj.groups() | 498 | >>> matchobj.groups() |
55 | 499 | ('X Y',) | 499 | ('X Y',) |
56 | 500 | >>> FormattersAPI._substitute_matchgroup_for_spaces(matchobj) | 500 | >>> FormattersAPI._substitute_matchgroup_for_spaces(matchobj) |
57 | @@ -508,10 +508,9 @@ First, let's try a match of nothing it understands. This is a bug, so we get | |||
58 | 508 | an AssertionError. | 508 | an AssertionError. |
59 | 509 | 509 | ||
60 | 510 | >>> matchobj = re.match( | 510 | >>> matchobj = re.match( |
65 | 511 | ... six.ensure_str( | 511 | ... '(?P<bug>xxx)?(?P<faq>www)?(?P<url>yyy)?(?P<oops>zzz)?' |
66 | 512 | ... '(?P<bug>xxx)?(?P<faq>www)?(?P<url>yyy)?(?P<oops>zzz)?' | 512 | ... '(?P<lpbranchurl>www)?(?P<clbug>vvv)?', |
67 | 513 | ... '(?P<lpbranchurl>www)?(?P<clbug>vvv)?'), | 513 | ... 'fish') |
64 | 514 | ... six.ensure_str('fish')) | ||
68 | 515 | >>> sorted(matchobj.groupdict().items()) | 514 | >>> sorted(matchobj.groupdict().items()) |
69 | 516 | [('bug', None), | 515 | [('bug', None), |
70 | 517 | ('clbug', None), | 516 | ('clbug', None), |
71 | @@ -527,9 +526,7 @@ an AssertionError. | |||
72 | 527 | When we have a URL, the URL is made into a link. A quote is added to the | 526 | When we have a URL, the URL is made into a link. A quote is added to the |
73 | 528 | url to demonstrate quoting in the HTML attribute. | 527 | url to demonstrate quoting in the HTML attribute. |
74 | 529 | 528 | ||
78 | 530 | >>> matchobj = re.match( | 529 | >>> matchobj = re.match('(?P<bug>xxx)?(?P<url>y"y)?', 'y"y') |
76 | 531 | ... six.ensure_str('(?P<bug>xxx)?(?P<url>y"y)?'), | ||
77 | 532 | ... six.ensure_str('y"y')) | ||
79 | 533 | >>> sorted(matchobj.groupdict().items()) | 530 | >>> sorted(matchobj.groupdict().items()) |
80 | 534 | [('bug', None), ('url', 'y"y')] | 531 | [('bug', None), ('url', 'y"y')] |
81 | 535 | >>> print(FormattersAPI._linkify_substitution(matchobj)) | 532 | >>> print(FormattersAPI._linkify_substitution(matchobj)) |
82 | @@ -539,8 +536,7 @@ When we have a bug reference, the 'bug' group is used as the text of the link, | |||
83 | 539 | and the 'bugnum' is used to look up the bug. | 536 | and the 'bugnum' is used to look up the bug. |
84 | 540 | 537 | ||
85 | 541 | >>> matchobj = re.match( | 538 | >>> matchobj = re.match( |
88 | 542 | ... six.ensure_str('(?P<bug>xxxx)?(?P<bugnum>2)?(?P<url>yyy)?'), | 539 | ... '(?P<bug>xxxx)?(?P<bugnum>2)?(?P<url>yyy)?', 'xxxx2') |
87 | 543 | ... six.ensure_str('xxxx2')) | ||
89 | 544 | >>> sorted(matchobj.groupdict().items()) | 540 | >>> sorted(matchobj.groupdict().items()) |
90 | 545 | [('bug', 'xxxx'), ('bugnum', '2'), ('url', None)] | 541 | [('bug', 'xxxx'), ('bugnum', '2'), ('url', None)] |
91 | 546 | >>> FormattersAPI._linkify_substitution(matchobj) | 542 | >>> FormattersAPI._linkify_substitution(matchobj) |
92 | @@ -550,8 +546,7 @@ When the bugnum doesn't match any bug, we still get a link, but get a message | |||
93 | 550 | in the link's title. | 546 | in the link's title. |
94 | 551 | 547 | ||
95 | 552 | >>> matchobj = re.match( | 548 | >>> matchobj = re.match( |
98 | 553 | ... six.ensure_str('(?P<bug>xxxx)?(?P<bugnum>2000)?(?P<url>yyy)?'), | 549 | ... '(?P<bug>xxxx)?(?P<bugnum>2000)?(?P<url>yyy)?', 'xxxx2000') |
97 | 554 | ... six.ensure_str('xxxx2000')) | ||
99 | 555 | >>> sorted(matchobj.groupdict().items()) | 550 | >>> sorted(matchobj.groupdict().items()) |
100 | 556 | [('bug', 'xxxx'), ('bugnum', '2000'), ('url', None)] | 551 | [('bug', 'xxxx'), ('bugnum', '2000'), ('url', None)] |
101 | 557 | >>> FormattersAPI._linkify_substitution(matchobj) | 552 | >>> FormattersAPI._linkify_substitution(matchobj) |
102 | diff --git a/lib/lp/app/doc/launchpadform.txt b/lib/lp/app/doc/launchpadform.txt | |||
103 | index db59937..6fa4e8e 100644 | |||
104 | --- a/lib/lp/app/doc/launchpadform.txt | |||
105 | +++ b/lib/lp/app/doc/launchpadform.txt | |||
106 | @@ -229,7 +229,7 @@ setFieldError() method (for errors specific to a field): | |||
107 | 229 | ... self.addError('your password may not be the same ' | 229 | ... self.addError('your password may not be the same ' |
108 | 230 | ... 'as your name') | 230 | ... 'as your name') |
109 | 231 | ... if data.get('password') == 'password': | 231 | ... if data.get('password') == 'password': |
111 | 232 | ... self.setFieldError(six.ensure_str('password'), | 232 | ... self.setFieldError('password', |
112 | 233 | ... 'your password must not be "password"') | 233 | ... 'your password must not be "password"') |
113 | 234 | 234 | ||
114 | 235 | >>> context = FormTest() | 235 | >>> context = FormTest() |
115 | diff --git a/lib/lp/app/doc/launchpadview.txt b/lib/lp/app/doc/launchpadview.txt | |||
116 | index f49c1ef..2951085 100644 | |||
117 | --- a/lib/lp/app/doc/launchpadview.txt | |||
118 | +++ b/lib/lp/app/doc/launchpadview.txt | |||
119 | @@ -62,7 +62,7 @@ an IStructuredString implementation. | |||
120 | 62 | >>> print(view.info_message) | 62 | >>> print(view.info_message) |
121 | 63 | None | 63 | None |
122 | 64 | 64 | ||
124 | 65 | >>> view.error_message = six.ensure_str('A simple string.') | 65 | >>> view.error_message = 'A simple string.' |
125 | 66 | Traceback (most recent call last): | 66 | Traceback (most recent call last): |
126 | 67 | ... | 67 | ... |
127 | 68 | ValueError: <... 'str'> is not a valid value for error_message, | 68 | ValueError: <... 'str'> is not a valid value for error_message, |
128 | @@ -70,7 +70,7 @@ an IStructuredString implementation. | |||
129 | 70 | >>> print(view.error_message) | 70 | >>> print(view.error_message) |
130 | 71 | None | 71 | None |
131 | 72 | 72 | ||
133 | 73 | >>> view.info_message = six.ensure_str('A simple string.') | 73 | >>> view.info_message = 'A simple string.' |
134 | 74 | Traceback (most recent call last): | 74 | Traceback (most recent call last): |
135 | 75 | ... | 75 | ... |
136 | 76 | ValueError: <... 'str'> is not a valid value for info_message, | 76 | ValueError: <... 'str'> is not a valid value for info_message, |
137 | diff --git a/lib/lp/app/doc/menus.txt b/lib/lp/app/doc/menus.txt | |||
138 | index c76ac01..001eac8 100644 | |||
139 | --- a/lib/lp/app/doc/menus.txt | |||
140 | +++ b/lib/lp/app/doc/menus.txt | |||
141 | @@ -33,7 +33,7 @@ later, implementations having facets and menus will be defined. | |||
142 | 33 | 33 | ||
143 | 34 | >>> import sys | 34 | >>> import sys |
144 | 35 | >>> import types | 35 | >>> import types |
146 | 36 | >>> cookingexample = types.ModuleType(six.ensure_str('cookingexample')) | 36 | >>> cookingexample = types.ModuleType('cookingexample') |
147 | 37 | >>> sys.modules['lp.app.cookingexample'] = cookingexample | 37 | >>> sys.modules['lp.app.cookingexample'] = cookingexample |
148 | 38 | 38 | ||
149 | 39 | >>> cookingexample.ICookbook = ICookbook | 39 | >>> cookingexample.ICookbook = ICookbook |
150 | diff --git a/lib/lp/app/doc/textformatting.txt b/lib/lp/app/doc/textformatting.txt | |||
151 | index 3d9dd40..faee73c 100644 | |||
152 | --- a/lib/lp/app/doc/textformatting.txt | |||
153 | +++ b/lib/lp/app/doc/textformatting.txt | |||
154 | @@ -230,14 +230,14 @@ The line endings are normalized to \n, so if we get a text with | |||
155 | 230 | dos-style line endings, we get the following result: | 230 | dos-style line endings, we get the following result: |
156 | 231 | 231 | ||
157 | 232 | >>> mailwrapper = MailWrapper(width=56) | 232 | >>> mailwrapper = MailWrapper(width=56) |
159 | 233 | >>> dos_style_comment = six.ensure_str( | 233 | >>> dos_style_comment = ( |
160 | 234 | ... "This paragraph is longer than 56 characters, so it should" | 234 | ... "This paragraph is longer than 56 characters, so it should" |
161 | 235 | ... " be wrapped even though the paragraphs are separated with" | 235 | ... " be wrapped even though the paragraphs are separated with" |
162 | 236 | ... " dos-style line endings." | 236 | ... " dos-style line endings." |
163 | 237 | ... "\r\n\r\n" | 237 | ... "\r\n\r\n" |
164 | 238 | ... "Here's the second paragraph.") | 238 | ... "Here's the second paragraph.") |
165 | 239 | >>> wrapped_text = mailwrapper.format(dos_style_comment) | 239 | >>> wrapped_text = mailwrapper.format(dos_style_comment) |
167 | 240 | >>> wrapped_text.split(six.ensure_str('\n')) | 240 | >>> wrapped_text.split('\n') |
168 | 241 | ['This paragraph is longer than 56 characters, so it', | 241 | ['This paragraph is longer than 56 characters, so it', |
169 | 242 | 'should be wrapped even though the paragraphs are', | 242 | 'should be wrapped even though the paragraphs are', |
170 | 243 | 'separated with dos-style line endings.', | 243 | 'separated with dos-style line endings.', |
171 | diff --git a/lib/lp/app/widgets/doc/announcement-date-widget.txt b/lib/lp/app/widgets/doc/announcement-date-widget.txt | |||
172 | index d90250c..3b901ce 100644 | |||
173 | --- a/lib/lp/app/widgets/doc/announcement-date-widget.txt | |||
174 | +++ b/lib/lp/app/widgets/doc/announcement-date-widget.txt | |||
175 | @@ -9,7 +9,7 @@ future, or to manually publish it later. | |||
176 | 9 | >>> from lp.testing.pages import extract_text | 9 | >>> from lp.testing.pages import extract_text |
177 | 10 | >>> from lp.services.webapp.servers import LaunchpadTestRequest | 10 | >>> from lp.services.webapp.servers import LaunchpadTestRequest |
178 | 11 | >>> from lp.app.widgets.announcementdate import AnnouncementDateWidget | 11 | >>> from lp.app.widgets.announcementdate import AnnouncementDateWidget |
180 | 12 | >>> field = Field(__name__=six.ensure_str('foo'), title=u'Foo') | 12 | >>> field = Field(__name__='foo', title='Foo') |
181 | 13 | >>> widget = AnnouncementDateWidget(field, LaunchpadTestRequest()) | 13 | >>> widget = AnnouncementDateWidget(field, LaunchpadTestRequest()) |
182 | 14 | >>> print(extract_text(widget())) | 14 | >>> print(extract_text(widget())) |
183 | 15 | Publish this announcement: | 15 | Publish this announcement: |
184 | diff --git a/lib/lp/app/widgets/doc/noneable-text-widgets.txt b/lib/lp/app/widgets/doc/noneable-text-widgets.txt | |||
185 | index 85ca174..6f79a1c 100644 | |||
186 | --- a/lib/lp/app/widgets/doc/noneable-text-widgets.txt | |||
187 | +++ b/lib/lp/app/widgets/doc/noneable-text-widgets.txt | |||
188 | @@ -65,5 +65,5 @@ Excess whitespace is stripped, but newlines are preserved. | |||
189 | 65 | >>> request = LaunchpadTestRequest( | 65 | >>> request = LaunchpadTestRequest( |
190 | 66 | ... form={'field.summary' : ' flower \n grass '}) | 66 | ... form={'field.summary' : ' flower \n grass '}) |
191 | 67 | >>> widget = NoneableDescriptionWidget(field, request) | 67 | >>> widget = NoneableDescriptionWidget(field, request) |
193 | 68 | >>> six.ensure_str(widget.getInputValue()) | 68 | >>> widget.getInputValue() |
194 | 69 | 'flower \n grass' | 69 | 'flower \n grass' |
195 | diff --git a/lib/lp/app/widgets/doc/project-scope-widget.txt b/lib/lp/app/widgets/doc/project-scope-widget.txt | |||
196 | index 366a4bd..1871412 100644 | |||
197 | --- a/lib/lp/app/widgets/doc/project-scope-widget.txt | |||
198 | +++ b/lib/lp/app/widgets/doc/project-scope-widget.txt | |||
199 | @@ -15,8 +15,7 @@ selected. | |||
200 | 15 | 15 | ||
201 | 16 | >>> empty_request = LaunchpadTestRequest() | 16 | >>> empty_request = LaunchpadTestRequest() |
202 | 17 | >>> scope_field = Choice( | 17 | >>> scope_field = Choice( |
205 | 18 | ... __name__=six.ensure_str('scope'), vocabulary='ProjectGroup', | 18 | ... __name__='scope', vocabulary='ProjectGroup', required=False) |
204 | 19 | ... required=False) | ||
206 | 20 | >>> scope_field = scope_field.bind(object()) | 19 | >>> scope_field = scope_field.bind(object()) |
207 | 21 | >>> widget = ProjectScopeWidget( | 20 | >>> widget = ProjectScopeWidget( |
208 | 22 | ... scope_field, scope_field.vocabulary, empty_request) | 21 | ... scope_field, scope_field.vocabulary, empty_request) |
209 | diff --git a/lib/lp/app/widgets/doc/stripped-text-widget.txt b/lib/lp/app/widgets/doc/stripped-text-widget.txt | |||
210 | index 3343cd7..c4612d1 100644 | |||
211 | --- a/lib/lp/app/widgets/doc/stripped-text-widget.txt | |||
212 | +++ b/lib/lp/app/widgets/doc/stripped-text-widget.txt | |||
213 | @@ -57,7 +57,7 @@ provided. | |||
214 | 57 | True | 57 | True |
215 | 58 | 58 | ||
216 | 59 | >>> required_field = StrippedTextLine( | 59 | >>> required_field = StrippedTextLine( |
218 | 60 | ... __name__=six.ensure_str('field'), title=u'Title', required=True) | 60 | ... __name__='field', title=u'Title', required=True) |
219 | 61 | >>> request = LaunchpadTestRequest(form={'field.field':' \n '}) | 61 | >>> request = LaunchpadTestRequest(form={'field.field':' \n '}) |
220 | 62 | >>> widget = StrippedTextWidget(required_field, request) | 62 | >>> widget = StrippedTextWidget(required_field, request) |
221 | 63 | >>> widget.getInputValue() | 63 | >>> widget.getInputValue() |
222 | diff --git a/lib/lp/blueprints/browser/sprint.py b/lib/lp/blueprints/browser/sprint.py | |||
223 | index 84ac65e..95bf105 100644 | |||
224 | --- a/lib/lp/blueprints/browser/sprint.py | |||
225 | +++ b/lib/lp/blueprints/browser/sprint.py | |||
226 | @@ -612,13 +612,6 @@ class SprintAttendeesCsvExportView(LaunchpadView): | |||
227 | 612 | attendance.time_starts.strftime('%Y-%m-%dT%H:%M:%SZ'), | 612 | attendance.time_starts.strftime('%Y-%m-%dT%H:%M:%SZ'), |
228 | 613 | attendance.time_ends.strftime('%Y-%m-%dT%H:%M:%SZ'), | 613 | attendance.time_ends.strftime('%Y-%m-%dT%H:%M:%SZ'), |
229 | 614 | str(attendance.is_physical))) | 614 | str(attendance.is_physical))) |
230 | 615 | # On Python 2, CSV can't handle unicode, so we encode everything as | ||
231 | 616 | # UTF-8. Note that none of the columns constructed above can ever | ||
232 | 617 | # be None, so it's safe to use six.ensure_str here (which will raise | ||
233 | 618 | # TypeError if given None). | ||
234 | 619 | rows = [[six.ensure_str(column) | ||
235 | 620 | for column in row] | ||
236 | 621 | for row in rows] | ||
237 | 622 | self.request.response.setHeader( | 615 | self.request.response.setHeader( |
238 | 623 | 'Content-type', 'text/csv;charset="utf-8"') | 616 | 'Content-type', 'text/csv;charset="utf-8"') |
239 | 624 | self.request.response.setHeader( | 617 | self.request.response.setHeader( |
240 | diff --git a/lib/lp/blueprints/stories/blueprints/xx-editing.txt b/lib/lp/blueprints/stories/blueprints/xx-editing.txt | |||
241 | index b5b3e2c..fd1a89a 100644 | |||
242 | --- a/lib/lp/blueprints/stories/blueprints/xx-editing.txt | |||
243 | +++ b/lib/lp/blueprints/stories/blueprints/xx-editing.txt | |||
244 | @@ -26,7 +26,7 @@ Launchpad won't let us use an URL already used in another blueprint. | |||
245 | 26 | >>> browser.getControl('Specification URL').value = url | 26 | >>> browser.getControl('Specification URL').value = url |
246 | 27 | >>> browser.getControl('Change').click() | 27 | >>> browser.getControl('Change').click() |
247 | 28 | 28 | ||
249 | 29 | >>> message = six.ensure_str( | 29 | >>> message = ( |
250 | 30 | ... 'https://wiki.ubuntu.com/MediaIntegrityCheck is already ' | 30 | ... 'https://wiki.ubuntu.com/MediaIntegrityCheck is already ' |
251 | 31 | ... 'registered by') | 31 | ... 'registered by') |
252 | 32 | >>> message in browser.contents | 32 | >>> message in browser.contents |
253 | @@ -40,7 +40,7 @@ product. | |||
254 | 40 | >>> browser.getControl('Specification URL').value = url | 40 | >>> browser.getControl('Specification URL').value = url |
255 | 41 | >>> browser.getControl('Change').click() | 41 | >>> browser.getControl('Change').click() |
256 | 42 | 42 | ||
258 | 43 | >>> message = six.ensure_str('e4x is already in use by another blueprint') | 43 | >>> message = 'e4x is already in use by another blueprint' |
259 | 44 | >>> message in browser.contents | 44 | >>> message in browser.contents |
260 | 45 | True | 45 | True |
261 | 46 | 46 | ||
262 | diff --git a/lib/lp/blueprints/stories/blueprints/xx-productseries.txt b/lib/lp/blueprints/stories/blueprints/xx-productseries.txt | |||
263 | index 309a17f..4b3f4a3 100644 | |||
264 | --- a/lib/lp/blueprints/stories/blueprints/xx-productseries.txt | |||
265 | +++ b/lib/lp/blueprints/stories/blueprints/xx-productseries.txt | |||
266 | @@ -153,8 +153,7 @@ there are none left in the queue. | |||
267 | 153 | ... 'http://blueprints.launchpad.test/firefox/1.0/+setgoals') | 153 | ... 'http://blueprints.launchpad.test/firefox/1.0/+setgoals') |
268 | 154 | >>> driver_browser.getControl('Support E4X').selected = True | 154 | >>> driver_browser.getControl('Support E4X').selected = True |
269 | 155 | >>> driver_browser.getControl('Decline').click() | 155 | >>> driver_browser.getControl('Decline').click() |
272 | 156 | >>> six.ensure_str('Declined 1 specification(s)') in ( | 156 | >>> 'Declined 1 specification(s)' in driver_browser.contents |
271 | 157 | ... driver_browser.contents) | ||
273 | 158 | True | 157 | True |
274 | 159 | 158 | ||
275 | 160 | The accepted item should show up in the list of specs for this series: | 159 | The accepted item should show up in the list of specs for this series: |
276 | @@ -216,9 +215,9 @@ OK, lets see if it was immediately accepted: | |||
277 | 216 | 215 | ||
278 | 217 | >>> anon_browser.open( | 216 | >>> anon_browser.open( |
279 | 218 | ... 'http://launchpad.test/firefox/+spec/svg-support') | 217 | ... 'http://launchpad.test/firefox/+spec/svg-support') |
281 | 219 | >>> six.ensure_str('firefox/trunk') in anon_browser.contents | 218 | >>> 'firefox/trunk' in anon_browser.contents |
282 | 220 | True | 219 | True |
284 | 221 | >>> six.ensure_str('Accepted') in anon_browser.contents | 220 | >>> 'Accepted' in anon_browser.contents |
285 | 222 | True | 221 | True |
286 | 223 | 222 | ||
287 | 224 | And lets put it back: | 223 | And lets put it back: |
288 | @@ -258,7 +257,7 @@ And again, it should be accepted automatically. | |||
289 | 258 | 257 | ||
290 | 259 | >>> anon_browser.open( | 258 | >>> anon_browser.open( |
291 | 260 | ... 'http://launchpad.test/firefox/+spec/svg-support') | 259 | ... 'http://launchpad.test/firefox/+spec/svg-support') |
293 | 261 | >>> six.ensure_str('firefox/1.0') in anon_browser.contents | 260 | >>> 'firefox/1.0' in anon_browser.contents |
294 | 262 | True | 261 | True |
296 | 263 | >>> six.ensure_str('Accepted') in anon_browser.contents | 262 | >>> 'Accepted' in anon_browser.contents |
297 | 264 | True | 263 | True |
298 | diff --git a/lib/lp/blueprints/stories/standalone/subscribing.txt b/lib/lp/blueprints/stories/standalone/subscribing.txt | |||
299 | index beab847..f8289a0 100644 | |||
300 | --- a/lib/lp/blueprints/stories/standalone/subscribing.txt | |||
301 | +++ b/lib/lp/blueprints/stories/standalone/subscribing.txt | |||
302 | @@ -52,11 +52,10 @@ Now, we'll POST the form. We should see a message that we have just | |||
303 | 52 | subscribed. | 52 | subscribed. |
304 | 53 | 53 | ||
305 | 54 | >>> browser.getControl('Subscribe').click() | 54 | >>> browser.getControl('Subscribe').click() |
308 | 55 | >>> six.ensure_str('You have subscribed to this blueprint') in ( | 55 | >>> 'You have subscribed to this blueprint' in browser.contents |
307 | 56 | ... browser.contents) | ||
309 | 57 | True | 56 | True |
310 | 58 | 57 | ||
312 | 59 | >>> six.ensure_str('subscriber-essential') in browser.contents | 58 | >>> 'subscriber-essential' in browser.contents |
313 | 60 | True | 59 | True |
314 | 61 | 60 | ||
315 | 62 | Now the link should say "Update subscription" in the actions menu. | 61 | Now the link should say "Update subscription" in the actions menu. |
316 | @@ -77,11 +76,10 @@ We will unset the essential flag and resubmit: | |||
317 | 77 | 76 | ||
318 | 78 | >>> essential.selected = False | 77 | >>> essential.selected = False |
319 | 79 | >>> browser.getControl('Change').click() | 78 | >>> browser.getControl('Change').click() |
322 | 80 | >>> six.ensure_str('Your subscription has been updated') in ( | 79 | >>> 'Your subscription has been updated' in browser.contents |
321 | 81 | ... browser.contents) | ||
323 | 82 | True | 80 | True |
324 | 83 | 81 | ||
326 | 84 | >>> six.ensure_str('subscriber-inessential') in browser.contents | 82 | >>> 'subscriber-inessential' in browser.contents |
327 | 85 | True | 83 | True |
328 | 86 | 84 | ||
329 | 87 | It's also possible to change the essential flag clicking on the star | 85 | It's also possible to change the essential flag clicking on the star |
330 | @@ -93,7 +91,7 @@ icon in the Subscribers portlet. | |||
331 | 93 | >>> browser.url | 91 | >>> browser.url |
332 | 94 | 'http://blueprints.launchpad.test/firefox/+spec/e4x' | 92 | 'http://blueprints.launchpad.test/firefox/+spec/e4x' |
333 | 95 | 93 | ||
335 | 96 | >>> six.ensure_str('subscriber-essential') in browser.contents | 94 | >>> 'subscriber-essential' in browser.contents |
336 | 97 | True | 95 | True |
337 | 98 | 96 | ||
338 | 99 | We don't really want to be subscribed, so lets unsubscribe from that | 97 | We don't really want to be subscribed, so lets unsubscribe from that |
339 | @@ -104,14 +102,13 @@ unsubscribe confirmation page loads. | |||
340 | 104 | >>> unsubit.click() | 102 | >>> unsubit.click() |
341 | 105 | >>> confirm = browser.getControl('Unsubscribe') | 103 | >>> confirm = browser.getControl('Unsubscribe') |
342 | 106 | >>> confirm.click() | 104 | >>> confirm.click() |
345 | 107 | >>> six.ensure_str('You have unsubscribed from this blueprint.') in ( | 105 | >>> 'You have unsubscribed from this blueprint.' in browser.contents |
344 | 108 | ... browser.contents) | ||
346 | 109 | True | 106 | True |
347 | 110 | 107 | ||
349 | 111 | >>> six.ensure_str('subscriber-inessential') in browser.contents | 108 | >>> 'subscriber-inessential' in browser.contents |
350 | 112 | False | 109 | False |
351 | 113 | 110 | ||
353 | 114 | >>> six.ensure_str('subscriber-essential') in browser.contents | 111 | >>> 'subscriber-essential' in browser.contents |
354 | 115 | False | 112 | False |
355 | 116 | 113 | ||
356 | 117 | 114 | ||
357 | @@ -128,8 +125,7 @@ When we want other users to track a specification we can subscribe them. | |||
358 | 128 | 125 | ||
359 | 129 | >>> browser.getControl('Subscriber').value = 'stub' | 126 | >>> browser.getControl('Subscriber').value = 'stub' |
360 | 130 | >>> browser.getControl('Subscribe').click() | 127 | >>> browser.getControl('Subscribe').click() |
363 | 131 | >>> msg = six.ensure_str( | 128 | >>> msg = "Stuart Bishop has been subscribed to this blueprint." |
362 | 132 | ... "Stuart Bishop has been subscribed to this blueprint.") | ||
364 | 133 | >>> msg in browser.contents | 129 | >>> msg in browser.contents |
365 | 134 | True | 130 | True |
366 | 135 | 131 | ||
367 | @@ -280,7 +276,7 @@ list, and now the unsubscribe confirmation page loads. | |||
368 | 280 | >>> unsubit.click() | 276 | >>> unsubit.click() |
369 | 281 | >>> confirm = browser.getControl('Unsubscribe') | 277 | >>> confirm = browser.getControl('Unsubscribe') |
370 | 282 | >>> confirm.click() | 278 | >>> confirm.click() |
372 | 283 | >>> msg = six.ensure_str( | 279 | >>> msg = ( |
373 | 284 | ... "Launchpad Administrators has been unsubscribed from this " | 280 | ... "Launchpad Administrators has been unsubscribed from this " |
374 | 285 | ... "blueprint.") | 281 | ... "blueprint.") |
375 | 286 | >>> msg in browser.contents | 282 | >>> msg in browser.contents |
376 | diff --git a/lib/lp/bugs/model/tests/test_bugtasksearch.py b/lib/lp/bugs/model/tests/test_bugtasksearch.py | |||
377 | index a8bd7a7..c19503e 100644 | |||
378 | --- a/lib/lp/bugs/model/tests/test_bugtasksearch.py | |||
379 | +++ b/lib/lp/bugs/model/tests/test_bugtasksearch.py | |||
380 | @@ -9,7 +9,6 @@ from operator import attrgetter | |||
381 | 9 | import unittest | 9 | import unittest |
382 | 10 | 10 | ||
383 | 11 | import pytz | 11 | import pytz |
384 | 12 | import six | ||
385 | 13 | from storm.expr import Or | 12 | from storm.expr import Or |
386 | 14 | from testtools.matchers import Equals | 13 | from testtools.matchers import Equals |
387 | 15 | from testtools.testcase import ExpectedException | 14 | from testtools.testcase import ExpectedException |
388 | @@ -2460,8 +2459,7 @@ def test_suite(): | |||
389 | 2460 | loader = unittest.TestLoader() | 2459 | loader = unittest.TestLoader() |
390 | 2461 | for bug_target_search_type_class in ( | 2460 | for bug_target_search_type_class in ( |
391 | 2462 | PreloadBugtaskTargets, NoPreloadBugtaskTargets, QueryBugIDs): | 2461 | PreloadBugtaskTargets, NoPreloadBugtaskTargets, QueryBugIDs): |
394 | 2463 | class_name = six.ensure_str( | 2462 | class_name = 'Test%s' % bug_target_search_type_class.__name__ |
393 | 2464 | 'Test%s' % bug_target_search_type_class.__name__) | ||
395 | 2465 | class_bases = ( | 2463 | class_bases = ( |
396 | 2466 | bug_target_search_type_class, ProductTarget, OnceTests, | 2464 | bug_target_search_type_class, ProductTarget, OnceTests, |
397 | 2467 | SearchTestBase, TestCaseWithFactory) | 2465 | SearchTestBase, TestCaseWithFactory) |
398 | @@ -2469,10 +2467,9 @@ def test_suite(): | |||
399 | 2469 | suite.addTest(loader.loadTestsFromTestCase(test_class)) | 2467 | suite.addTest(loader.loadTestsFromTestCase(test_class)) |
400 | 2470 | 2468 | ||
401 | 2471 | for target_mixin in bug_targets_mixins: | 2469 | for target_mixin in bug_targets_mixins: |
406 | 2472 | class_name = six.ensure_str( | 2470 | class_name = 'Test%s%s' % ( |
407 | 2473 | 'Test%s%s' % ( | 2471 | bug_target_search_type_class.__name__, |
408 | 2474 | bug_target_search_type_class.__name__, | 2472 | target_mixin.__name__) |
405 | 2475 | target_mixin.__name__)) | ||
409 | 2476 | mixins = [ | 2473 | mixins = [ |
410 | 2477 | target_mixin, bug_target_search_type_class] | 2474 | target_mixin, bug_target_search_type_class] |
411 | 2478 | class_bases = ( | 2475 | class_bases = ( |
412 | diff --git a/lib/lp/bugs/stories/bug-also-affects/xx-bug-also-affects.txt b/lib/lp/bugs/stories/bug-also-affects/xx-bug-also-affects.txt | |||
413 | index d58193d..7a7ebf8 100644 | |||
414 | --- a/lib/lp/bugs/stories/bug-also-affects/xx-bug-also-affects.txt | |||
415 | +++ b/lib/lp/bugs/stories/bug-also-affects/xx-bug-also-affects.txt | |||
416 | @@ -704,7 +704,7 @@ confirmation. | |||
417 | 704 | mailto:dark-master-o-bugs@mylittlepony.com | 704 | mailto:dark-master-o-bugs@mylittlepony.com |
418 | 705 | 705 | ||
419 | 706 | >>> user_browser.contents.count( | 706 | >>> user_browser.contents.count( |
421 | 707 | ... six.ensure_str('mailto:dark-master-o-bugs@mylittlepony.com')) | 707 | ... 'mailto:dark-master-o-bugs@mylittlepony.com') |
422 | 708 | 3 | 708 | 3 |
423 | 709 | 709 | ||
424 | 710 | To evade harvesting, the email address above is obfuscated if you're not | 710 | To evade harvesting, the email address above is obfuscated if you're not |
425 | @@ -720,5 +720,5 @@ logged in. | |||
426 | 720 | auto-dark-master-o-bugs | 720 | auto-dark-master-o-bugs |
427 | 721 | 721 | ||
428 | 722 | >>> anon_browser.contents.count( | 722 | >>> anon_browser.contents.count( |
430 | 723 | ... six.ensure_str('mailto:dark-master-o-bugs@mylittlepony.com')) | 723 | ... 'mailto:dark-master-o-bugs@mylittlepony.com') |
431 | 724 | 0 | 724 | 0 |
432 | diff --git a/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt b/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt | |||
433 | index 918cf50..e4b2e8d 100644 | |||
434 | --- a/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt | |||
435 | +++ b/lib/lp/bugs/stories/bug-tags/xx-tags-on-bug-page.txt | |||
436 | @@ -34,11 +34,11 @@ Let's specify two valid tags. | |||
437 | 34 | 34 | ||
438 | 35 | Now the tags will be displayed on the bug page: | 35 | Now the tags will be displayed on the bug page: |
439 | 36 | 36 | ||
441 | 37 | >>> six.ensure_str('Tags:') in user_browser.contents | 37 | >>> 'Tags:' in user_browser.contents |
442 | 38 | True | 38 | True |
444 | 39 | >>> six.ensure_str('foo') in user_browser.contents | 39 | >>> 'foo' in user_browser.contents |
445 | 40 | True | 40 | True |
447 | 41 | >>> six.ensure_str('bar') in user_browser.contents | 41 | >>> 'bar' in user_browser.contents |
448 | 42 | True | 42 | True |
449 | 43 | 43 | ||
450 | 44 | Simply changing the ordering of the bug tags won't cause anything to | 44 | Simply changing the ordering of the bug tags won't cause anything to |
451 | diff --git a/lib/lp/bugs/stories/bugattachments/xx-bugattachments.txt b/lib/lp/bugs/stories/bugattachments/xx-bugattachments.txt | |||
452 | index ec8e157..ae6db94 100644 | |||
453 | --- a/lib/lp/bugs/stories/bugattachments/xx-bugattachments.txt | |||
454 | +++ b/lib/lp/bugs/stories/bugattachments/xx-bugattachments.txt | |||
455 | @@ -44,14 +44,14 @@ We can check that the attachment is there | |||
456 | 44 | >>> link.url | 44 | >>> link.url |
457 | 45 | 'http://bugs.launchpad.test/firefox/+bug/1/+attachment/.../+files/foo.txt' | 45 | 'http://bugs.launchpad.test/firefox/+bug/1/+attachment/.../+files/foo.txt' |
458 | 46 | 46 | ||
460 | 47 | >>> six.ensure_str('Added some information') in user_browser.contents | 47 | >>> 'Added some information' in user_browser.contents |
461 | 48 | True | 48 | True |
462 | 49 | 49 | ||
463 | 50 | And that we stripped the leading and trailing whitespace correctly | 50 | And that we stripped the leading and trailing whitespace correctly |
464 | 51 | 51 | ||
466 | 52 | >>> six.ensure_str(' Some information ') in user_browser.contents | 52 | >>> ' Some information ' in user_browser.contents |
467 | 53 | False | 53 | False |
469 | 54 | >>> six.ensure_str('Some information') in user_browser.contents | 54 | >>> 'Some information' in user_browser.contents |
470 | 55 | True | 55 | True |
471 | 56 | 56 | ||
472 | 57 | If no description is given it gets set to the attachment filename. It's | 57 | If no description is given it gets set to the attachment filename. It's |
473 | @@ -265,7 +265,7 @@ We can also edit the attachment details, let's navigate to that page. | |||
474 | 265 | >>> user_browser.url | 265 | >>> user_browser.url |
475 | 266 | 'http://bugs.launchpad.test/firefox/+bug/1/+attachment/...' | 266 | 'http://bugs.launchpad.test/firefox/+bug/1/+attachment/...' |
476 | 267 | 267 | ||
478 | 268 | >>> six.ensure_str('Edit attachment') in user_browser.contents | 268 | >>> 'Edit attachment' in user_browser.contents |
479 | 269 | True | 269 | True |
480 | 270 | 270 | ||
481 | 271 | There's also an option to cancel, which takes you back to the bug | 271 | There's also an option to cancel, which takes you back to the bug |
482 | @@ -286,7 +286,7 @@ whitespace to test that's correctly stripped)... | |||
483 | 286 | >>> user_browser.url | 286 | >>> user_browser.url |
484 | 287 | 'http://bugs.launchpad.test/firefox/+bug/1' | 287 | 'http://bugs.launchpad.test/firefox/+bug/1' |
485 | 288 | 288 | ||
487 | 289 | >>> six.ensure_str('Another title') in user_browser.contents | 289 | >>> 'Another title' in user_browser.contents |
488 | 290 | True | 290 | True |
489 | 291 | 291 | ||
490 | 292 | We can edit the attachment to be a patch. | 292 | We can edit the attachment to be a patch. |
491 | diff --git a/lib/lp/bugs/stories/bugs/xx-bug-edit.txt b/lib/lp/bugs/stories/bugs/xx-bug-edit.txt | |||
492 | index 7700e4a..2456c33 100644 | |||
493 | --- a/lib/lp/bugs/stories/bugs/xx-bug-edit.txt | |||
494 | +++ b/lib/lp/bugs/stories/bugs/xx-bug-edit.txt | |||
495 | @@ -73,9 +73,9 @@ Now we are back at the bug page, and the tag has been added. | |||
496 | 73 | 73 | ||
497 | 74 | >>> user_browser.url | 74 | >>> user_browser.url |
498 | 75 | 'http://bugs.launchpad.test/firefox/+bug/1' | 75 | 'http://bugs.launchpad.test/firefox/+bug/1' |
500 | 76 | >>> six.ensure_str('layout-test') in user_browser.contents | 76 | >>> 'layout-test' in user_browser.contents |
501 | 77 | True | 77 | True |
503 | 78 | >>> six.ensure_str('new-tag') in user_browser.contents | 78 | >>> 'new-tag' in user_browser.contents |
504 | 79 | False | 79 | False |
505 | 80 | 80 | ||
506 | 81 | Now, let's add 'new-tag' again, and confirm it this time. | 81 | Now, let's add 'new-tag' again, and confirm it this time. |
507 | diff --git a/lib/lp/bugs/stories/bugs/xx-bug-index.txt b/lib/lp/bugs/stories/bugs/xx-bug-index.txt | |||
508 | index 590df67..540000e 100644 | |||
509 | --- a/lib/lp/bugs/stories/bugs/xx-bug-index.txt | |||
510 | +++ b/lib/lp/bugs/stories/bugs/xx-bug-index.txt | |||
511 | @@ -43,7 +43,7 @@ highlighted. | |||
512 | 43 | ...<tr> | 43 | ...<tr> |
513 | 44 | ...mozilla-firefox (Ubuntu)... | 44 | ...mozilla-firefox (Ubuntu)... |
514 | 45 | ... | 45 | ... |
516 | 46 | >>> anon_browser.contents.count(six.ensure_str('<tr class="highlight"')) | 46 | >>> anon_browser.contents.count('<tr class="highlight"') |
517 | 47 | 1 | 47 | 1 |
518 | 48 | 48 | ||
519 | 49 | >>> anon_browser.open( | 49 | >>> anon_browser.open( |
520 | @@ -60,7 +60,7 @@ highlighted. | |||
521 | 60 | ...<tr> | 60 | ...<tr> |
522 | 61 | ...mozilla-firefox (Ubuntu)... | 61 | ...mozilla-firefox (Ubuntu)... |
523 | 62 | ... | 62 | ... |
525 | 63 | >>> anon_browser.contents.count(six.ensure_str('<tr class="highlight"')) | 63 | >>> anon_browser.contents.count('<tr class="highlight"') |
526 | 64 | 1 | 64 | 1 |
527 | 65 | 65 | ||
528 | 66 | If the context is a distribution package, the package name has a | 66 | If the context is a distribution package, the package name has a |
529 | diff --git a/lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt b/lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt | |||
530 | index a7dc948..7864052 100644 | |||
531 | --- a/lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt | |||
532 | +++ b/lib/lp/bugs/stories/bugs/xx-bug-obfuscation.txt | |||
533 | @@ -29,7 +29,7 @@ An anonymous cannot see the email address anywhere in the page. | |||
534 | 29 | >>> print(anon_browser.title) | 29 | >>> print(anon_browser.title) |
535 | 30 | Bug #3 ... | 30 | Bug #3 ... |
536 | 31 | 31 | ||
538 | 32 | >>> six.ensure_str('user@domain.org') in anon_browser.contents | 32 | >>> 'user@domain.org' in anon_browser.contents |
539 | 33 | False | 33 | False |
540 | 34 | 34 | ||
541 | 35 | >>> description = find_tag_by_id( | 35 | >>> description = find_tag_by_id( |
542 | diff --git a/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt b/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt | |||
543 | index f4e5a39..f25404c 100644 | |||
544 | --- a/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt | |||
545 | +++ b/lib/lp/bugs/stories/bugs/xx-bug-text-pages.txt | |||
546 | @@ -127,7 +127,7 @@ are replaced by a single space. | |||
547 | 127 | 127 | ||
548 | 128 | >>> attachments_text = text_bug[text_bug.find('attachments:'):] | 128 | >>> attachments_text = text_bug[text_bug.find('attachments:'):] |
549 | 129 | >>> attachment_2 = attachments_text.split('\n')[2] | 129 | >>> attachment_2 = attachments_text.split('\n')[2] |
551 | 130 | >>> six.ensure_str(attachment_2) | 130 | >>> attachment_2 |
552 | 131 | ' http://bugs.launchpad.test/.../file%20with%20space.txt text/plain; | 131 | ' http://bugs.launchpad.test/.../file%20with%20space.txt text/plain; |
553 | 132 | name="file with space.txt"' | 132 | name="file with space.txt"' |
554 | 133 | 133 | ||
555 | diff --git a/lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt b/lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt | |||
556 | index 2488478..d86a58d 100644 | |||
557 | --- a/lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt | |||
558 | +++ b/lib/lp/bugs/stories/bugwatches/xx-edit-bugwatch.txt | |||
559 | @@ -10,9 +10,8 @@ After a bug watch is recorded, it is possible to go back and change it. | |||
560 | 10 | >>> admin_browser.getControl('Change').click() | 10 | >>> admin_browser.getControl('Change').click() |
561 | 11 | >>> admin_browser.url | 11 | >>> admin_browser.url |
562 | 12 | 'http://bugs.launchpad.test/firefox/+bug/1' | 12 | 'http://bugs.launchpad.test/firefox/+bug/1' |
566 | 13 | >>> six.ensure_str( | 13 | >>> 'https://bugzilla.mozilla.org/show_bug.cgi?id=1000' in ( |
567 | 14 | ... 'https://bugzilla.mozilla.org/show_bug.cgi?id=1000') in ( | 14 | ... admin_browser.contents) |
565 | 15 | ... admin_browser.contents) | ||
568 | 16 | True | 15 | True |
569 | 17 | 16 | ||
570 | 18 | The URL supplied must be a valid bug tracker URL and must point to a | 17 | The URL supplied must be a valid bug tracker URL and must point to a |
571 | diff --git a/lib/lp/code/browser/tests/test_codereviewcomment.py b/lib/lp/code/browser/tests/test_codereviewcomment.py | |||
572 | index 458f67a..ac402fe 100644 | |||
573 | --- a/lib/lp/code/browser/tests/test_codereviewcomment.py | |||
574 | +++ b/lib/lp/code/browser/tests/test_codereviewcomment.py | |||
575 | @@ -207,7 +207,7 @@ class TestCodeReviewCommentHtmlMixin: | |||
576 | 207 | contents = 'test-comment' | 207 | contents = 'test-comment' |
577 | 208 | comment = self.makeCodeReviewComment(body=contents) | 208 | comment = self.makeCodeReviewComment(body=contents) |
578 | 209 | browser = self.getViewBrowser(comment, view_name='+reply') | 209 | browser = self.getViewBrowser(comment, view_name='+reply') |
580 | 210 | self.assertIn(six.ensure_str(contents), browser.contents) | 210 | self.assertIn(contents, browser.contents) |
581 | 211 | 211 | ||
582 | 212 | def test_footer_for_mergeable_and_admin(self): | 212 | def test_footer_for_mergeable_and_admin(self): |
583 | 213 | """An admin sees Hide/Reply links for a comment on a mergeable MP.""" | 213 | """An admin sees Hide/Reply links for a comment on a mergeable MP.""" |
584 | diff --git a/lib/lp/code/model/branch.py b/lib/lp/code/model/branch.py | |||
585 | index 98952be..f86f754 100644 | |||
586 | --- a/lib/lp/code/model/branch.py | |||
587 | +++ b/lib/lp/code/model/branch.py | |||
588 | @@ -743,7 +743,7 @@ class Branch(SQLBase, WebhookTargetMixin, BzrIdentityMixin): | |||
589 | 743 | 743 | ||
590 | 744 | def getInternalBzrUrl(self): | 744 | def getInternalBzrUrl(self): |
591 | 745 | """See `IBranch`.""" | 745 | """See `IBranch`.""" |
593 | 746 | return six.ensure_str('lp-internal:///' + self.unique_name) | 746 | return 'lp-internal:///' + self.unique_name |
594 | 747 | 747 | ||
595 | 748 | def getBzrBranch(self): | 748 | def getBzrBranch(self): |
596 | 749 | """See `IBranch`.""" | 749 | """See `IBranch`.""" |
597 | diff --git a/lib/lp/coop/answersbugs/visibility.py b/lib/lp/coop/answersbugs/visibility.py | |||
598 | index b167ef2..cbb3815 100644 | |||
599 | --- a/lib/lp/coop/answersbugs/visibility.py | |||
600 | +++ b/lib/lp/coop/answersbugs/visibility.py | |||
601 | @@ -8,8 +8,6 @@ __all__ = [ | |||
602 | 8 | 'TestMessageVisibilityMixin', | 8 | 'TestMessageVisibilityMixin', |
603 | 9 | ] | 9 | ] |
604 | 10 | 10 | ||
605 | 11 | import six | ||
606 | 12 | |||
607 | 13 | from lp.services.webapp.escaping import html_escape | 11 | from lp.services.webapp.escaping import html_escape |
608 | 14 | from lp.testing.pages import find_tag_by_id | 12 | from lp.testing.pages import find_tag_by_id |
609 | 15 | 13 | ||
610 | @@ -17,7 +15,7 @@ from lp.testing.pages import find_tag_by_id | |||
611 | 17 | class TestMessageVisibilityMixin: | 15 | class TestMessageVisibilityMixin: |
612 | 18 | 16 | ||
613 | 19 | comment_text = "You can't see me." | 17 | comment_text = "You can't see me." |
615 | 20 | html_comment_text = six.ensure_str(html_escape(comment_text)) | 18 | html_comment_text = html_escape(comment_text) |
616 | 21 | 19 | ||
617 | 22 | def makeHiddenMessage(self): | 20 | def makeHiddenMessage(self): |
618 | 23 | """To be overwridden by subclasses. | 21 | """To be overwridden by subclasses. |
619 | diff --git a/lib/lp/registry/browser/tests/person-admin-views.txt b/lib/lp/registry/browser/tests/person-admin-views.txt | |||
620 | index 9e4d33d..34d0d8f 100644 | |||
621 | --- a/lib/lp/registry/browser/tests/person-admin-views.txt | |||
622 | +++ b/lib/lp/registry/browser/tests/person-admin-views.txt | |||
623 | @@ -129,7 +129,7 @@ an account is suspended, the preferred email address is disabled. | |||
624 | 129 | >>> transaction.commit() | 129 | >>> transaction.commit() |
625 | 130 | >>> user.account_status | 130 | >>> user.account_status |
626 | 131 | <DBItem AccountStatus.SUSPENDED, ...> | 131 | <DBItem AccountStatus.SUSPENDED, ...> |
628 | 132 | >>> six.ensure_str(user.account_status_history) | 132 | >>> user.account_status_history |
629 | 133 | '... name16: Active -> Suspended: Wanted by the galactic police.\n' | 133 | '... name16: Active -> Suspended: Wanted by the galactic police.\n' |
630 | 134 | >>> print(user.preferredemail) | 134 | >>> print(user.preferredemail) |
631 | 135 | None | 135 | None |
632 | @@ -161,7 +161,7 @@ user must log in to restore the email addresses using the reactivate step. | |||
633 | 161 | [] | 161 | [] |
634 | 162 | >>> user.account_status | 162 | >>> user.account_status |
635 | 163 | <DBItem AccountStatus.DEACTIVATED, ...> | 163 | <DBItem AccountStatus.DEACTIVATED, ...> |
637 | 164 | >>> six.ensure_str(user.account_status_history) | 164 | >>> user.account_status_history |
638 | 165 | "... name16: Active -> Suspended: Wanted by the galactic police.\n... | 165 | "... name16: Active -> Suspended: Wanted by the galactic police.\n... |
639 | 166 | name16: Suspended -> Deactivated: Zaphod's a hoopy frood.\n" | 166 | name16: Suspended -> Deactivated: Zaphod's a hoopy frood.\n" |
640 | 167 | >>> print(user.preferredemail) | 167 | >>> print(user.preferredemail) |
641 | @@ -180,7 +180,7 @@ An admin can mark an account as belonging to a user who has died. | |||
642 | 180 | [] | 180 | [] |
643 | 181 | >>> user.account_status | 181 | >>> user.account_status |
644 | 182 | <DBItem AccountStatus.DECEASED, ...> | 182 | <DBItem AccountStatus.DECEASED, ...> |
646 | 183 | >>> six.ensure_str(user.account_status_history) | 183 | >>> user.account_status_history |
647 | 184 | "... name16: Active -> Suspended: Wanted by the galactic police.\n... | 184 | "... name16: Active -> Suspended: Wanted by the galactic police.\n... |
648 | 185 | name16: Suspended -> Deactivated: Zaphod's a hoopy frood.\n... | 185 | name16: Suspended -> Deactivated: Zaphod's a hoopy frood.\n... |
649 | 186 | name16: Deactivated -> Deceased: In memoriam.\n" | 186 | name16: Deactivated -> Deceased: In memoriam.\n" |
650 | diff --git a/lib/lp/registry/browser/tests/test_announcements.py b/lib/lp/registry/browser/tests/test_announcements.py | |||
651 | index 5f005c6..af459b4 100644 | |||
652 | --- a/lib/lp/registry/browser/tests/test_announcements.py | |||
653 | +++ b/lib/lp/registry/browser/tests/test_announcements.py | |||
654 | @@ -7,7 +7,6 @@ from datetime import datetime | |||
655 | 7 | 7 | ||
656 | 8 | from lxml import html | 8 | from lxml import html |
657 | 9 | from pytz import utc | 9 | from pytz import utc |
658 | 10 | import six | ||
659 | 11 | from zope.component import getUtility | 10 | from zope.component import getUtility |
660 | 12 | from zope.security.proxy import removeSecurityProxy | 11 | from zope.security.proxy import removeSecurityProxy |
661 | 13 | 12 | ||
662 | @@ -107,7 +106,7 @@ class TestAnnouncementPage(BrowserTestCase): | |||
663 | 107 | removeSecurityProxy(inactive_product).active = False | 106 | removeSecurityProxy(inactive_product).active = False |
664 | 108 | 107 | ||
665 | 109 | browser = self.getViewBrowser(context, view_name, user=user) | 108 | browser = self.getViewBrowser(context, view_name, user=user) |
667 | 110 | contents = six.ensure_str(browser.contents, "utf-8") | 109 | contents = browser.contents |
668 | 111 | 110 | ||
669 | 112 | self.assertIn(first_announcement.title, contents) | 111 | self.assertIn(first_announcement.title, contents) |
670 | 113 | self.assertIn(first_announcement.summary, contents) | 112 | self.assertIn(first_announcement.summary, contents) |
671 | diff --git a/lib/lp/registry/doc/person-account.txt b/lib/lp/registry/doc/person-account.txt | |||
672 | index 576ab7d..0ed70c6 100644 | |||
673 | --- a/lib/lp/registry/doc/person-account.txt | |||
674 | +++ b/lib/lp/registry/doc/person-account.txt | |||
675 | @@ -49,7 +49,7 @@ Matsubara can. | |||
676 | 49 | True | 49 | True |
677 | 50 | >>> matsubara.account.status | 50 | >>> matsubara.account.status |
678 | 51 | <DBItem AccountStatus.ACTIVE, ...> | 51 | <DBItem AccountStatus.ACTIVE, ...> |
680 | 52 | >>> six.ensure_str(removeSecurityProxy(matsubara.account).status_history) | 52 | >>> removeSecurityProxy(matsubara.account).status_history |
681 | 53 | '...: Unactivated -> Active: test\n' | 53 | '...: Unactivated -> Active: test\n' |
682 | 54 | >>> print(removeSecurityProxy(matsubara.preferredemail).email) | 54 | >>> print(removeSecurityProxy(matsubara.preferredemail).email) |
683 | 55 | matsubara@async.com.br | 55 | matsubara@async.com.br |
684 | @@ -156,7 +156,7 @@ adds a '-deactivatedaccount' suffix to the person's name... | |||
685 | 156 | >>> foobar.account.status | 156 | >>> foobar.account.status |
686 | 157 | <DBItem AccountStatus.DEACTIVATED... | 157 | <DBItem AccountStatus.DEACTIVATED... |
687 | 158 | 158 | ||
689 | 159 | >>> six.ensure_str(removeSecurityProxy(foobar.account).status_history) | 159 | >>> removeSecurityProxy(foobar.account).status_history |
690 | 160 | "... name16: Active -> Deactivated: | 160 | "... name16: Active -> Deactivated: |
691 | 161 | I'm a person who doesn't want to be listed as a Launchpad user.\n" | 161 | I'm a person who doesn't want to be listed as a Launchpad user.\n" |
692 | 162 | 162 | ||
693 | @@ -232,7 +232,7 @@ Accounts can be reactivated. | |||
694 | 232 | >>> foobar.account.status | 232 | >>> foobar.account.status |
695 | 233 | <DBItem AccountStatus.ACTIVE... | 233 | <DBItem AccountStatus.ACTIVE... |
696 | 234 | 234 | ||
698 | 235 | >>> six.ensure_str(removeSecurityProxy(foobar.account).status_history) | 235 | >>> removeSecurityProxy(foobar.account).status_history |
699 | 236 | "... name16: Active -> Deactivated: I'm a person | 236 | "... name16: Active -> Deactivated: I'm a person |
700 | 237 | who doesn't want to be listed as a Launchpad user.\n...: | 237 | who doesn't want to be listed as a Launchpad user.\n...: |
701 | 238 | Deactivated -> Active: | 238 | Deactivated -> Active: |
702 | diff --git a/lib/lp/registry/scripts/tests/test_closeaccount.py b/lib/lp/registry/scripts/tests/test_closeaccount.py | |||
703 | index ada1dd5..66277ea 100644 | |||
704 | --- a/lib/lp/registry/scripts/tests/test_closeaccount.py | |||
705 | +++ b/lib/lp/registry/scripts/tests/test_closeaccount.py | |||
706 | @@ -3,7 +3,6 @@ | |||
707 | 3 | 3 | ||
708 | 4 | """Test the close-account script.""" | 4 | """Test the close-account script.""" |
709 | 5 | 5 | ||
710 | 6 | import six | ||
711 | 7 | from storm.store import Store | 6 | from storm.store import Store |
712 | 8 | from testtools.matchers import ( | 7 | from testtools.matchers import ( |
713 | 9 | MatchesSetwise, | 8 | MatchesSetwise, |
714 | @@ -178,7 +177,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
715 | 178 | person_id = person.id | 177 | person_id = person.id |
716 | 179 | account_id = person.account.id | 178 | account_id = person.account.id |
717 | 180 | self.factory.makeProduct(owner=person) | 179 | self.factory.makeProduct(owner=person) |
719 | 181 | script = self.makeScript([six.ensure_str(person.name)]) | 180 | script = self.makeScript([person.name]) |
720 | 182 | with dbuser('launchpad'): | 181 | with dbuser('launchpad'): |
721 | 183 | self.assertRaisesWithContent( | 182 | self.assertRaisesWithContent( |
722 | 184 | LaunchpadScriptFailure, | 183 | LaunchpadScriptFailure, |
723 | @@ -192,7 +191,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
724 | 192 | 191 | ||
725 | 193 | def test_dry_run(self): | 192 | def test_dry_run(self): |
726 | 194 | person, person_id, account_id = self.makePopulatedUser() | 193 | person, person_id, account_id = self.makePopulatedUser() |
728 | 195 | script = self.makeScript(['--dry-run', six.ensure_str(person.name)]) | 194 | script = self.makeScript(['--dry-run', person.name]) |
729 | 196 | with dbuser('launchpad'): | 195 | with dbuser('launchpad'): |
730 | 197 | self.runScript(script) | 196 | self.runScript(script) |
731 | 198 | self.assertIn( | 197 | self.assertIn( |
732 | @@ -201,14 +200,14 @@ class TestCloseAccount(TestCaseWithFactory): | |||
733 | 201 | 200 | ||
734 | 202 | def test_single_by_name(self): | 201 | def test_single_by_name(self): |
735 | 203 | person, person_id, account_id = self.makePopulatedUser() | 202 | person, person_id, account_id = self.makePopulatedUser() |
737 | 204 | script = self.makeScript([six.ensure_str(person.name)]) | 203 | script = self.makeScript([person.name]) |
738 | 205 | with dbuser('launchpad'): | 204 | with dbuser('launchpad'): |
739 | 206 | self.runScript(script) | 205 | self.runScript(script) |
740 | 207 | self.assertRemoved(account_id, person_id) | 206 | self.assertRemoved(account_id, person_id) |
741 | 208 | 207 | ||
742 | 209 | def test_single_by_email(self): | 208 | def test_single_by_email(self): |
743 | 210 | person, person_id, account_id = self.makePopulatedUser() | 209 | person, person_id, account_id = self.makePopulatedUser() |
745 | 211 | script = self.makeScript([six.ensure_str(person.preferredemail.email)]) | 210 | script = self.makeScript([person.preferredemail.email]) |
746 | 212 | with dbuser('launchpad'): | 211 | with dbuser('launchpad'): |
747 | 213 | self.runScript(script) | 212 | self.runScript(script) |
748 | 214 | self.assertRemoved(account_id, person_id) | 213 | self.assertRemoved(account_id, person_id) |
749 | @@ -227,7 +226,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
750 | 227 | def test_multiple_email_addresses(self): | 226 | def test_multiple_email_addresses(self): |
751 | 228 | person, person_id, account_id = self.makePopulatedUser() | 227 | person, person_id, account_id = self.makePopulatedUser() |
752 | 229 | self.factory.makeEmail('%s@another-domain.test' % person.name, person) | 228 | self.factory.makeEmail('%s@another-domain.test' % person.name, person) |
754 | 230 | script = self.makeScript([six.ensure_str(person.name)]) | 229 | script = self.makeScript([person.name]) |
755 | 231 | with dbuser('launchpad'): | 230 | with dbuser('launchpad'): |
756 | 232 | self.runScript(script) | 231 | self.runScript(script) |
757 | 233 | self.assertRemoved(account_id, person_id) | 232 | self.assertRemoved(account_id, person_id) |
758 | @@ -251,7 +250,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
759 | 251 | snap = self.factory.makeSnap() | 250 | snap = self.factory.makeSnap() |
760 | 252 | snap_build = self.factory.makeSnapBuild(requester=person, snap=snap) | 251 | snap_build = self.factory.makeSnapBuild(requester=person, snap=snap) |
761 | 253 | specification = self.factory.makeSpecification(drafter=person) | 252 | specification = self.factory.makeSpecification(drafter=person) |
763 | 254 | script = self.makeScript([six.ensure_str(person.name)]) | 253 | script = self.makeScript([person.name]) |
764 | 255 | with dbuser('launchpad'): | 254 | with dbuser('launchpad'): |
765 | 256 | self.runScript(script) | 255 | self.runScript(script) |
766 | 257 | self.assertRemoved(account_id, person_id) | 256 | self.assertRemoved(account_id, person_id) |
767 | @@ -271,7 +270,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
768 | 271 | question.addComment(person, "comment") | 270 | question.addComment(person, "comment") |
769 | 272 | removeSecurityProxy(question).status = status | 271 | removeSecurityProxy(question).status = status |
770 | 273 | questions.append(question) | 272 | questions.append(question) |
772 | 274 | script = self.makeScript([six.ensure_str(person.name)]) | 273 | script = self.makeScript([person.name]) |
773 | 275 | with dbuser('launchpad'): | 274 | with dbuser('launchpad'): |
774 | 276 | self.runScript(script) | 275 | self.runScript(script) |
775 | 277 | self.assertRemoved(account_id, person_id) | 276 | self.assertRemoved(account_id, person_id) |
776 | @@ -293,7 +292,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
777 | 293 | question.addComment(person, "comment") | 292 | question.addComment(person, "comment") |
778 | 294 | removeSecurityProxy(question).status = status | 293 | removeSecurityProxy(question).status = status |
779 | 295 | questions[status] = question | 294 | questions[status] = question |
781 | 296 | script = self.makeScript([six.ensure_str(person.name)]) | 295 | script = self.makeScript([person.name]) |
782 | 297 | with dbuser('launchpad'): | 296 | with dbuser('launchpad'): |
783 | 298 | self.runScript(script) | 297 | self.runScript(script) |
784 | 299 | self.assertRemoved(account_id, person_id) | 298 | self.assertRemoved(account_id, person_id) |
785 | @@ -308,7 +307,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
786 | 308 | spec = self.factory.makeSpecification() | 307 | spec = self.factory.makeSpecification() |
787 | 309 | branch = self.factory.makeAnyBranch() | 308 | branch = self.factory.makeAnyBranch() |
788 | 310 | spec.linkBranch(branch, person) | 309 | spec.linkBranch(branch, person) |
790 | 311 | script = self.makeScript([six.ensure_str(person.name)]) | 310 | script = self.makeScript([person.name]) |
791 | 312 | with dbuser('launchpad'): | 311 | with dbuser('launchpad'): |
792 | 313 | self.runScript(script) | 312 | self.runScript(script) |
793 | 314 | self.assertRemoved(account_id, person_id) | 313 | self.assertRemoved(account_id, person_id) |
794 | @@ -331,7 +330,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
795 | 331 | while not job.isDone(): | 330 | while not job.isDone(): |
796 | 332 | job(chunk_size=100) | 331 | job(chunk_size=100) |
797 | 333 | self.assertTrue(person.hasMaintainedPackages()) | 332 | self.assertTrue(person.hasMaintainedPackages()) |
799 | 334 | script = self.makeScript([six.ensure_str(person.name)]) | 333 | script = self.makeScript([person.name]) |
800 | 335 | with dbuser('launchpad'): | 334 | with dbuser('launchpad'): |
801 | 336 | self.runScript(script) | 335 | self.runScript(script) |
802 | 337 | self.assertRemoved(account_id, person_id) | 336 | self.assertRemoved(account_id, person_id) |
803 | @@ -345,7 +344,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
804 | 345 | bugtask = self.factory.makeBugTask(bug=bug, owner=person) | 344 | bugtask = self.factory.makeBugTask(bug=bug, owner=person) |
805 | 346 | person_id = person.id | 345 | person_id = person.id |
806 | 347 | account_id = person.account.id | 346 | account_id = person.account.id |
808 | 348 | script = self.makeScript([six.ensure_str(person.name)]) | 347 | script = self.makeScript([person.name]) |
809 | 349 | with dbuser('launchpad'): | 348 | with dbuser('launchpad'): |
810 | 350 | self.runScript(script) | 349 | self.runScript(script) |
811 | 351 | self.assertRemoved(account_id, person_id) | 350 | self.assertRemoved(account_id, person_id) |
812 | @@ -358,7 +357,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
813 | 358 | self.factory.makeBugWatch(owner=person) | 357 | self.factory.makeBugWatch(owner=person) |
814 | 359 | person_id = person.id | 358 | person_id = person.id |
815 | 360 | account_id = person.account.id | 359 | account_id = person.account.id |
817 | 361 | script = self.makeScript([six.ensure_str(person.name)]) | 360 | script = self.makeScript([person.name]) |
818 | 362 | with dbuser('launchpad'): | 361 | with dbuser('launchpad'): |
819 | 363 | self.runScript(script) | 362 | self.runScript(script) |
820 | 364 | self.assertRemoved(account_id, person_id) | 363 | self.assertRemoved(account_id, person_id) |
821 | @@ -370,7 +369,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
822 | 370 | self.assertTrue(bug.isUserAffected(person)) | 369 | self.assertTrue(bug.isUserAffected(person)) |
823 | 371 | person_id = person.id | 370 | person_id = person.id |
824 | 372 | account_id = person.account.id | 371 | account_id = person.account.id |
826 | 373 | script = self.makeScript([six.ensure_str(person.name)]) | 372 | script = self.makeScript([person.name]) |
827 | 374 | with dbuser('launchpad'): | 373 | with dbuser('launchpad'): |
828 | 375 | self.runScript(script) | 374 | self.runScript(script) |
829 | 376 | self.assertRemoved(account_id, person_id) | 375 | self.assertRemoved(account_id, person_id) |
830 | @@ -382,7 +381,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
831 | 382 | translations_person.translations_relicensing_agreement = True | 381 | translations_person.translations_relicensing_agreement = True |
832 | 383 | person_id = person.id | 382 | person_id = person.id |
833 | 384 | account_id = person.account.id | 383 | account_id = person.account.id |
835 | 385 | script = self.makeScript([six.ensure_str(person.name)]) | 384 | script = self.makeScript([person.name]) |
836 | 386 | with dbuser('launchpad'): | 385 | with dbuser('launchpad'): |
837 | 387 | self.runScript(script) | 386 | self.runScript(script) |
838 | 388 | self.assertRemoved(account_id, person_id) | 387 | self.assertRemoved(account_id, person_id) |
839 | @@ -399,7 +398,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
840 | 399 | person, pofile)) | 398 | person, pofile)) |
841 | 400 | person_id = person.id | 399 | person_id = person.id |
842 | 401 | account_id = person.account.id | 400 | account_id = person.account.id |
844 | 402 | script = self.makeScript([six.ensure_str(person.name)]) | 401 | script = self.makeScript([person.name]) |
845 | 403 | with dbuser('launchpad'): | 402 | with dbuser('launchpad'): |
846 | 404 | self.runScript(script) | 403 | self.runScript(script) |
847 | 405 | self.assertRemoved(account_id, person_id) | 404 | self.assertRemoved(account_id, person_id) |
848 | @@ -413,7 +412,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
849 | 413 | pofile.owner = person | 412 | pofile.owner = person |
850 | 414 | person_id = person.id | 413 | person_id = person.id |
851 | 415 | account_id = person.account.id | 414 | account_id = person.account.id |
853 | 416 | script = self.makeScript([six.ensure_str(person.name)]) | 415 | script = self.makeScript([person.name]) |
854 | 417 | with dbuser('launchpad'): | 416 | with dbuser('launchpad'): |
855 | 418 | self.runScript(script) | 417 | self.runScript(script) |
856 | 419 | self.assertRemoved(account_id, person_id) | 418 | self.assertRemoved(account_id, person_id) |
857 | @@ -429,7 +428,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
858 | 429 | self.assertIsNotNone(ppa.getAuthToken(person)) | 428 | self.assertIsNotNone(ppa.getAuthToken(person)) |
859 | 430 | person_id = person.id | 429 | person_id = person.id |
860 | 431 | account_id = person.account.id | 430 | account_id = person.account.id |
862 | 432 | script = self.makeScript([six.ensure_str(person.name)]) | 431 | script = self.makeScript([person.name]) |
863 | 433 | with dbuser('launchpad'): | 432 | with dbuser('launchpad'): |
864 | 434 | now = get_transaction_timestamp(Store.of(person)) | 433 | now = get_transaction_timestamp(Store.of(person)) |
865 | 435 | self.runScript(script) | 434 | self.runScript(script) |
866 | @@ -557,7 +556,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
867 | 557 | submission_ids[0], get_submission_by_submission_key(keys[0])) | 556 | submission_ids[0], get_submission_by_submission_key(keys[0])) |
868 | 558 | person_id = person.id | 557 | person_id = person.id |
869 | 559 | account_id = person.account.id | 558 | account_id = person.account.id |
871 | 560 | script = self.makeScript([six.ensure_str(person.name)]) | 559 | script = self.makeScript([person.name]) |
872 | 561 | with dbuser('launchpad'): | 560 | with dbuser('launchpad'): |
873 | 562 | self.runScript(script) | 561 | self.runScript(script) |
874 | 563 | self.assertRemoved(account_id, person_id) | 562 | self.assertRemoved(account_id, person_id) |
875 | @@ -584,7 +583,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
876 | 584 | MatchesStructure.byEquality(count=1, viewed_by=other_person))) | 583 | MatchesStructure.byEquality(count=1, viewed_by=other_person))) |
877 | 585 | person_id = person.id | 584 | person_id = person.id |
878 | 586 | account_id = person.account.id | 585 | account_id = person.account.id |
880 | 587 | script = self.makeScript([six.ensure_str(person.name)]) | 586 | script = self.makeScript([person.name]) |
881 | 588 | with dbuser('launchpad'): | 587 | with dbuser('launchpad'): |
882 | 589 | self.runScript(script) | 588 | self.runScript(script) |
883 | 590 | self.assertRemoved(account_id, person_id) | 589 | self.assertRemoved(account_id, person_id) |
884 | @@ -620,7 +619,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
885 | 620 | MatchesStructure.byEquality(owner=other_person))) | 619 | MatchesStructure.byEquality(owner=other_person))) |
886 | 621 | person_id = person.id | 620 | person_id = person.id |
887 | 622 | account_id = person.account.id | 621 | account_id = person.account.id |
889 | 623 | script = self.makeScript([six.ensure_str(person.name)]) | 622 | script = self.makeScript([person.name]) |
890 | 624 | with dbuser('launchpad'): | 623 | with dbuser('launchpad'): |
891 | 625 | self.runScript(script) | 624 | self.runScript(script) |
892 | 626 | self.assertRemoved(account_id, person_id) | 625 | self.assertRemoved(account_id, person_id) |
893 | @@ -634,7 +633,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
894 | 634 | product.active = False | 633 | product.active = False |
895 | 635 | person_id = person.id | 634 | person_id = person.id |
896 | 636 | account_id = person.account.id | 635 | account_id = person.account.id |
898 | 637 | script = self.makeScript([six.ensure_str(person.name)]) | 636 | script = self.makeScript([person.name]) |
899 | 638 | with dbuser('launchpad'): | 637 | with dbuser('launchpad'): |
900 | 639 | self.runScript(script) | 638 | self.runScript(script) |
901 | 640 | self.assertRemoved(account_id, person_id) | 639 | self.assertRemoved(account_id, person_id) |
902 | @@ -652,7 +651,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
903 | 652 | TargetRevisionControlSystems.GIT)] | 651 | TargetRevisionControlSystems.GIT)] |
904 | 653 | person_id = person.id | 652 | person_id = person.id |
905 | 654 | account_id = person.account.id | 653 | account_id = person.account.id |
907 | 655 | script = self.makeScript([six.ensure_str(person.name)]) | 654 | script = self.makeScript([person.name]) |
908 | 656 | with dbuser('launchpad'): | 655 | with dbuser('launchpad'): |
909 | 657 | self.runScript(script) | 656 | self.runScript(script) |
910 | 658 | self.assertRemoved(account_id, person_id) | 657 | self.assertRemoved(account_id, person_id) |
911 | @@ -680,7 +679,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
912 | 680 | result_status=CodeImportResultStatus.SUCCESS) | 679 | result_status=CodeImportResultStatus.SUCCESS) |
913 | 681 | person_id = person.id | 680 | person_id = person.id |
914 | 682 | account_id = person.account.id | 681 | account_id = person.account.id |
916 | 683 | script = self.makeScript([six.ensure_str(person.name)]) | 682 | script = self.makeScript([person.name]) |
917 | 684 | with dbuser('launchpad'): | 683 | with dbuser('launchpad'): |
918 | 685 | self.runScript(script) | 684 | self.runScript(script) |
919 | 686 | self.assertRemoved(account_id, person_id) | 685 | self.assertRemoved(account_id, person_id) |
920 | @@ -708,7 +707,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
921 | 708 | removeSecurityProxy(ppa).owner = other_person | 707 | removeSecurityProxy(ppa).owner = other_person |
922 | 709 | person_id = person.id | 708 | person_id = person.id |
923 | 710 | account_id = person.account.id | 709 | account_id = person.account.id |
925 | 711 | script = self.makeScript([six.ensure_str(person.name)]) | 710 | script = self.makeScript([person.name]) |
926 | 712 | with dbuser('launchpad'): | 711 | with dbuser('launchpad'): |
927 | 713 | self.runScript(script) | 712 | self.runScript(script) |
928 | 714 | self.assertRemoved(account_id, person_id) | 713 | self.assertRemoved(account_id, person_id) |
929 | @@ -719,7 +718,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
930 | 719 | person_id = person.id | 718 | person_id = person.id |
931 | 720 | account_id = person.account.id | 719 | account_id = person.account.id |
932 | 721 | specification = self.factory.makeSpecification(owner=person) | 720 | specification = self.factory.makeSpecification(owner=person) |
934 | 722 | script = self.makeScript([six.ensure_str(person.name)]) | 721 | script = self.makeScript([person.name]) |
935 | 723 | with dbuser('launchpad'): | 722 | with dbuser('launchpad'): |
936 | 724 | self.runScript(script) | 723 | self.runScript(script) |
937 | 725 | self.assertRemoved(account_id, person_id) | 724 | self.assertRemoved(account_id, person_id) |
938 | @@ -738,7 +737,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
939 | 738 | 737 | ||
940 | 739 | person_id = member.id | 738 | person_id = member.id |
941 | 740 | account_id = member.account.id | 739 | account_id = member.account.id |
943 | 741 | script = self.makeScript([six.ensure_str(member.name)]) | 740 | script = self.makeScript([member.name]) |
944 | 742 | with dbuser('launchpad'): | 741 | with dbuser('launchpad'): |
945 | 743 | self.runScript(script) | 742 | self.runScript(script) |
946 | 744 | self.assertRemoved(account_id, person_id) | 743 | self.assertRemoved(account_id, person_id) |
947 | @@ -751,7 +750,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
948 | 751 | owned_team2 = self.factory.makeTeam(name='target2', owner=person) | 750 | owned_team2 = self.factory.makeTeam(name='target2', owner=person) |
949 | 752 | person_id = person.id | 751 | person_id = person.id |
950 | 753 | account_id = person.account.id | 752 | account_id = person.account.id |
952 | 754 | script = self.makeScript([six.ensure_str(person.name)]) | 753 | script = self.makeScript([person.name]) |
953 | 755 | 754 | ||
954 | 756 | # Closing account fails as the user still owns team2 | 755 | # Closing account fails as the user still owns team2 |
955 | 757 | with dbuser('launchpad'): | 756 | with dbuser('launchpad'): |
956 | @@ -776,7 +775,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
957 | 776 | self.assertEqual(token, login_token_set[plaintext_token]) | 775 | self.assertEqual(token, login_token_set[plaintext_token]) |
958 | 777 | person_id = person.id | 776 | person_id = person.id |
959 | 778 | account_id = person.account.id | 777 | account_id = person.account.id |
961 | 779 | script = self.makeScript([six.ensure_str(person.name)]) | 778 | script = self.makeScript([person.name]) |
962 | 780 | with dbuser('launchpad'): | 779 | with dbuser('launchpad'): |
963 | 781 | self.runScript(script) | 780 | self.runScript(script) |
964 | 782 | self.assertRemoved(account_id, person_id) | 781 | self.assertRemoved(account_id, person_id) |
965 | @@ -794,7 +793,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
966 | 794 | [other_request_token], other_person.oauth_request_tokens) | 793 | [other_request_token], other_person.oauth_request_tokens) |
967 | 795 | person_id = person.id | 794 | person_id = person.id |
968 | 796 | account_id = person.account.id | 795 | account_id = person.account.id |
970 | 797 | script = self.makeScript([six.ensure_str(person.name)]) | 796 | script = self.makeScript([person.name]) |
971 | 798 | with dbuser('launchpad'): | 797 | with dbuser('launchpad'): |
972 | 799 | self.runScript(script) | 798 | self.runScript(script) |
973 | 800 | self.assertRemoved(account_id, person_id) | 799 | self.assertRemoved(account_id, person_id) |
974 | @@ -813,7 +812,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
975 | 813 | [other_access_token], other_person.oauth_access_tokens) | 812 | [other_access_token], other_person.oauth_access_tokens) |
976 | 814 | person_id = person.id | 813 | person_id = person.id |
977 | 815 | account_id = person.account.id | 814 | account_id = person.account.id |
979 | 816 | script = self.makeScript([six.ensure_str(person.name)]) | 815 | script = self.makeScript([person.name]) |
980 | 817 | with dbuser('launchpad'): | 816 | with dbuser('launchpad'): |
981 | 818 | self.runScript(script) | 817 | self.runScript(script) |
982 | 819 | self.assertRemoved(account_id, person_id) | 818 | self.assertRemoved(account_id, person_id) |
983 | @@ -828,7 +827,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
984 | 828 | ppa.setProcessors(procs) | 827 | ppa.setProcessors(procs) |
985 | 829 | person_id = person.id | 828 | person_id = person.id |
986 | 830 | account_id = person.account.id | 829 | account_id = person.account.id |
988 | 831 | script = self.makeScript([six.ensure_str(person.name)]) | 830 | script = self.makeScript([person.name]) |
989 | 832 | with dbuser('launchpad'): | 831 | with dbuser('launchpad'): |
990 | 833 | self.assertRaisesWithContent( | 832 | self.assertRaisesWithContent( |
991 | 834 | LaunchpadScriptFailure, | 833 | LaunchpadScriptFailure, |
992 | @@ -851,7 +850,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
993 | 851 | DevNullLogger(), getPubConfig(ppa), None, ppa).deleteArchive() | 850 | DevNullLogger(), getPubConfig(ppa), None, ppa).deleteArchive() |
994 | 852 | person_id = person.id | 851 | person_id = person.id |
995 | 853 | account_id = person.account.id | 852 | account_id = person.account.id |
997 | 854 | script = self.makeScript([six.ensure_str(person.name)]) | 853 | script = self.makeScript([person.name]) |
998 | 855 | with dbuser('launchpad'): | 854 | with dbuser('launchpad'): |
999 | 856 | self.assertRaisesWithContent( | 855 | self.assertRaisesWithContent( |
1000 | 857 | LaunchpadScriptFailure, | 856 | LaunchpadScriptFailure, |
1001 | @@ -873,7 +872,7 @@ class TestCloseAccount(TestCaseWithFactory): | |||
1002 | 873 | store = Store.of(ppa) | 872 | store = Store.of(ppa) |
1003 | 874 | person_id = person.id | 873 | person_id = person.id |
1004 | 875 | account_id = person.account.id | 874 | account_id = person.account.id |
1006 | 876 | script = self.makeScript([six.ensure_str(person.name)]) | 875 | script = self.makeScript([person.name]) |
1007 | 877 | with dbuser('launchpad'): | 876 | with dbuser('launchpad'): |
1008 | 878 | self.runScript(script) | 877 | self.runScript(script) |
1009 | 879 | self.assertRemoved(account_id, person_id) | 878 | self.assertRemoved(account_id, person_id) |
1010 | diff --git a/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt b/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt | |||
1011 | index 1b81c27..d9c465e 100644 | |||
1012 | --- a/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt | |||
1013 | +++ b/lib/lp/registry/stories/gpg-coc/xx-gpg-coc.txt | |||
1014 | @@ -111,7 +111,7 @@ Import the secret keys needed for this test: | |||
1015 | 111 | access the current IGpghandler instance to access this key and decrypt the | 111 | access the current IGpghandler instance to access this key and decrypt the |
1016 | 112 | message. | 112 | message. |
1017 | 113 | 113 | ||
1019 | 114 | >>> body = decrypt_content(cipher_body, six.ensure_str('test')) | 114 | >>> body = decrypt_content(cipher_body, 'test') |
1020 | 115 | 115 | ||
1021 | 116 | Extract the token URL from the email: | 116 | Extract the token URL from the email: |
1022 | 117 | 117 | ||
1023 | @@ -514,7 +514,7 @@ Get the token from the body of the email sent. | |||
1024 | 514 | >>> from_addr, to_addrs, raw_msg = stub.test_emails.pop() | 514 | >>> from_addr, to_addrs, raw_msg = stub.test_emails.pop() |
1025 | 515 | >>> msg = email.message_from_bytes(raw_msg) | 515 | >>> msg = email.message_from_bytes(raw_msg) |
1026 | 516 | >>> cipher_body = msg.get_payload(decode=1) | 516 | >>> cipher_body = msg.get_payload(decode=1) |
1028 | 517 | >>> body = decrypt_content(cipher_body, six.ensure_str('test')) | 517 | >>> body = decrypt_content(cipher_body, 'test') |
1029 | 518 | >>> link = get_token_url_from_bytes(body) | 518 | >>> link = get_token_url_from_bytes(body) |
1030 | 519 | >>> token = re.sub(r'.*token/', '', link) | 519 | >>> token = re.sub(r'.*token/', '', link) |
1031 | 520 | >>> token_url = 'http://launchpad.test/token/%s' % token | 520 | >>> token_url = 'http://launchpad.test/token/%s' % token |
1032 | diff --git a/lib/lp/services/database/doc/enumcol.txt b/lib/lp/services/database/doc/enumcol.txt | |||
1033 | index 4685182..9cb728b 100644 | |||
1034 | --- a/lib/lp/services/database/doc/enumcol.txt | |||
1035 | +++ b/lib/lp/services/database/doc/enumcol.txt | |||
1036 | @@ -85,7 +85,7 @@ You cannot use integers or strings as DBEnum values: | |||
1037 | 85 | ... | 85 | ... |
1038 | 86 | TypeError: Not a DBItem: 2 | 86 | TypeError: Not a DBItem: 2 |
1039 | 87 | 87 | ||
1041 | 88 | >>> t.foo = six.ensure_str("TWO") | 88 | >>> t.foo = "TWO" |
1042 | 89 | Traceback (most recent call last): | 89 | Traceback (most recent call last): |
1043 | 90 | ... | 90 | ... |
1044 | 91 | TypeError: Not a DBItem: 'TWO' | 91 | TypeError: Not a DBItem: 'TWO' |
1045 | diff --git a/lib/lp/services/database/doc/textsearching.txt b/lib/lp/services/database/doc/textsearching.txt | |||
1046 | index 6aa25a7..5ced23b 100644 | |||
1047 | --- a/lib/lp/services/database/doc/textsearching.txt | |||
1048 | +++ b/lib/lp/services/database/doc/textsearching.txt | |||
1049 | @@ -121,7 +121,7 @@ The following examples show the text version of the query using | |||
1050 | 121 | ... "SELECT to_tsvector(%s) @@ ftq(%s)", | 121 | ... "SELECT to_tsvector(%s) @@ ftq(%s)", |
1051 | 122 | ... (text_to_search, search_phrase)) | 122 | ... (text_to_search, search_phrase)) |
1052 | 123 | ... match = result.get_all()[0][0] | 123 | ... match = result.get_all()[0][0] |
1054 | 124 | ... return six.ensure_str("FTI data: %s query: %s match: %s") % ( | 124 | ... return "FTI data: %s query: %s match: %s" % ( |
1055 | 125 | ... ts_vector, ts_query, str(match)) | 125 | ... ts_vector, ts_query, str(match)) |
1056 | 126 | >>> | 126 | >>> |
1057 | 127 | >>> def search_same(text): | 127 | >>> def search_same(text): |
1058 | @@ -248,7 +248,7 @@ Punctuation is handled consistently. If a string containing punctuation | |||
1059 | 248 | appears in an FTI, it can also be passed to ftq(),and a search for this | 248 | appears in an FTI, it can also be passed to ftq(),and a search for this |
1060 | 249 | string finds the indexed text. | 249 | string finds the indexed text. |
1061 | 250 | 250 | ||
1063 | 251 | >>> punctuation = six.ensure_str('\'"#$%*+,./:;<=>?@[\]^`{}~') | 251 | >>> punctuation = '\'"#$%*+,./:;<=>?@[\]^`{}~' |
1064 | 252 | >>> for symbol in punctuation: | 252 | >>> for symbol in punctuation: |
1065 | 253 | ... print(repr(symbol), search_same('foo%sbar' % symbol)) | 253 | ... print(repr(symbol), search_same('foo%sbar' % symbol)) |
1066 | 254 | "'" FTI data: 'bar':2 'foo':1 query: 'foo' & 'bar' match: True | 254 | "'" FTI data: 'bar':2 'foo':1 query: 'foo' & 'bar' match: True |
1067 | diff --git a/lib/lp/services/doc/limitedlist.txt b/lib/lp/services/doc/limitedlist.txt | |||
1068 | index e8bdf08..10f1fed 100644 | |||
1069 | --- a/lib/lp/services/doc/limitedlist.txt | |||
1070 | +++ b/lib/lp/services/doc/limitedlist.txt | |||
1071 | @@ -22,7 +22,7 @@ We can optionally specify the initial content of the sequence. Note that | |||
1072 | 22 | only the last N elements of the second parameter are stored, where N is | 22 | only the last N elements of the second parameter are stored, where N is |
1073 | 23 | the given maximum size of the LimitedList. | 23 | the given maximum size of the LimitedList. |
1074 | 24 | 24 | ||
1076 | 25 | >>> LimitedList(3, (0, six.ensure_str('one'), 2, 3)) | 25 | >>> LimitedList(3, (0, 'one', 2, 3)) |
1077 | 26 | <LimitedList(3, ['one', 2, 3])> | 26 | <LimitedList(3, ['one', 2, 3])> |
1078 | 27 | 27 | ||
1079 | 28 | If the initial content has more elements than the given maximum length, | 28 | If the initial content has more elements than the given maximum length, |
1080 | diff --git a/lib/lp/services/gpg/doc/gpg-encryption.txt b/lib/lp/services/gpg/doc/gpg-encryption.txt | |||
1081 | index b1a1b0c..21da208 100644 | |||
1082 | --- a/lib/lp/services/gpg/doc/gpg-encryption.txt | |||
1083 | +++ b/lib/lp/services/gpg/doc/gpg-encryption.txt | |||
1084 | @@ -57,7 +57,7 @@ cipher constains the encrypted content. | |||
1085 | 57 | Storing the raw password may compromise the security, but is the | 57 | Storing the raw password may compromise the security, but is the |
1086 | 58 | only way we can decrypt the cipher content. | 58 | only way we can decrypt the cipher content. |
1087 | 59 | 59 | ||
1089 | 60 | >>> password = six.ensure_str('test') | 60 | >>> password = 'test' |
1090 | 61 | >>> plain = decrypt_content(cipher, password) | 61 | >>> plain = decrypt_content(cipher, password) |
1091 | 62 | 62 | ||
1092 | 63 | voilá, the same content shows up again. | 63 | voilá, the same content shows up again. |
1093 | @@ -69,7 +69,7 @@ Verify if the encrytion process support passing another charset string | |||
1094 | 69 | 69 | ||
1095 | 70 | >>> content = u'a\xe7ucar' | 70 | >>> content = u'a\xe7ucar' |
1096 | 71 | >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) | 71 | >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) |
1098 | 72 | >>> plain = decrypt_content(cipher, six.ensure_str('test')) | 72 | >>> plain = decrypt_content(cipher, 'test') |
1099 | 73 | >>> print(backslashreplace(plain.decode('iso-8859-1'))) | 73 | >>> print(backslashreplace(plain.decode('iso-8859-1'))) |
1100 | 74 | a\xe7ucar | 74 | a\xe7ucar |
1101 | 75 | 75 | ||
1102 | @@ -85,7 +85,7 @@ Decrypt a unicode content: | |||
1103 | 85 | >>> content = u'a\xe7ucar' | 85 | >>> content = u'a\xe7ucar' |
1104 | 86 | >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) | 86 | >>> cipher = gpghandler.encryptContent(content.encode('iso-8859-1'), key) |
1105 | 87 | >>> cipher = six.ensure_text(cipher) | 87 | >>> cipher = six.ensure_text(cipher) |
1107 | 88 | >>> plain = decrypt_content(cipher, six.ensure_str('test')) | 88 | >>> plain = decrypt_content(cipher, 'test') |
1108 | 89 | Traceback (most recent call last): | 89 | Traceback (most recent call last): |
1109 | 90 | ... | 90 | ... |
1110 | 91 | TypeError: Content must be bytes. | 91 | TypeError: Content must be bytes. |
1111 | @@ -113,7 +113,7 @@ What about a message encrypted for an unknown key. | |||
1112 | 113 | ... =LQK5 | 113 | ... =LQK5 |
1113 | 114 | ... -----END PGP MESSAGE----- | 114 | ... -----END PGP MESSAGE----- |
1114 | 115 | ... """ | 115 | ... """ |
1116 | 116 | >>> plain = decrypt_content(cipher, six.ensure_str('test')) | 116 | >>> plain = decrypt_content(cipher, 'test') |
1117 | 117 | >>> plain is None | 117 | >>> plain is None |
1118 | 118 | True | 118 | True |
1119 | 119 | 119 | ||
1120 | diff --git a/lib/lp/services/gpg/handler.py b/lib/lp/services/gpg/handler.py | |||
1121 | index bad85f1..005ca79 100644 | |||
1122 | --- a/lib/lp/services/gpg/handler.py | |||
1123 | +++ b/lib/lp/services/gpg/handler.py | |||
1124 | @@ -341,8 +341,7 @@ class GPGHandler: | |||
1125 | 341 | # See more information at: | 341 | # See more information at: |
1126 | 342 | # http://pyme.sourceforge.net/doc/gpgme/Generating-Keys.html | 342 | # http://pyme.sourceforge.net/doc/gpgme/Generating-Keys.html |
1127 | 343 | with gpgme_timeline("genkey", name): | 343 | with gpgme_timeline("genkey", name): |
1130 | 344 | result = context.genkey( | 344 | result = context.genkey(signing_only_param % {'name': name}) |
1129 | 345 | six.ensure_str(signing_only_param % {'name': name})) | ||
1131 | 346 | 345 | ||
1132 | 347 | # Right, it might seem paranoid to have this many assertions, | 346 | # Right, it might seem paranoid to have this many assertions, |
1133 | 348 | # but we have to take key generation very seriously. | 347 | # but we have to take key generation very seriously. |
1134 | diff --git a/lib/lp/services/gpg/tests/test_gpghandler.py b/lib/lp/services/gpg/tests/test_gpghandler.py | |||
1135 | index 6dba52c..4072646 100644 | |||
1136 | --- a/lib/lp/services/gpg/tests/test_gpghandler.py | |||
1137 | +++ b/lib/lp/services/gpg/tests/test_gpghandler.py | |||
1138 | @@ -77,9 +77,9 @@ class FakeGenerateKey(Fixture): | |||
1139 | 77 | self.secret_key) | 77 | self.secret_key) |
1140 | 78 | 78 | ||
1141 | 79 | # Fail if the key generation parameters aren't what we expect. | 79 | # Fail if the key generation parameters aren't what we expect. |
1143 | 80 | expected_params = six.ensure_str(signing_only_param % { | 80 | expected_params = signing_only_param % { |
1144 | 81 | "name": imported_key.uids[0].name, | 81 | "name": imported_key.uids[0].name, |
1146 | 82 | }) | 82 | } |
1147 | 83 | if params != expected_params: | 83 | if params != expected_params: |
1148 | 84 | raise ValueError( | 84 | raise ValueError( |
1149 | 85 | "Got params %r, expected %r" % (params, expected_params)) | 85 | "Got params %r, expected %r" % (params, expected_params)) |
1150 | diff --git a/lib/lp/services/librarian/model.py b/lib/lp/services/librarian/model.py | |||
1151 | index 10a387e..6b0ea19 100644 | |||
1152 | --- a/lib/lp/services/librarian/model.py | |||
1153 | +++ b/lib/lp/services/librarian/model.py | |||
1154 | @@ -15,7 +15,6 @@ import hashlib | |||
1155 | 15 | 15 | ||
1156 | 16 | from lazr.delegates import delegate_to | 16 | from lazr.delegates import delegate_to |
1157 | 17 | import pytz | 17 | import pytz |
1158 | 18 | import six | ||
1159 | 19 | from six.moves.urllib.parse import urlparse | 18 | from six.moves.urllib.parse import urlparse |
1160 | 20 | from storm.locals import ( | 19 | from storm.locals import ( |
1161 | 21 | Date, | 20 | Date, |
1162 | @@ -358,7 +357,7 @@ class TimeLimitedToken(StormBase): | |||
1163 | 358 | # allocation the external librarian must be able to serve the file | 357 | # allocation the external librarian must be able to serve the file |
1164 | 359 | # immediately. | 358 | # immediately. |
1165 | 360 | store.commit() | 359 | store.commit() |
1167 | 361 | return six.ensure_str(token) | 360 | return token |
1168 | 362 | 361 | ||
1169 | 363 | @staticmethod | 362 | @staticmethod |
1170 | 364 | def url_to_token_path(url): | 363 | def url_to_token_path(url): |
1171 | diff --git a/lib/lp/services/mail/doc/notification-recipient-set.txt b/lib/lp/services/mail/doc/notification-recipient-set.txt | |||
1172 | index d06e7c4..6ed6b2c 100644 | |||
1173 | --- a/lib/lp/services/mail/doc/notification-recipient-set.txt | |||
1174 | +++ b/lib/lp/services/mail/doc/notification-recipient-set.txt | |||
1175 | @@ -120,7 +120,7 @@ UnknownRecipientError: | |||
1176 | 120 | ... | 120 | ... |
1177 | 121 | lp.services.mail.interfaces.UnknownRecipientError: ... | 121 | lp.services.mail.interfaces.UnknownRecipientError: ... |
1178 | 122 | 122 | ||
1180 | 123 | >>> recipients.getReason(six.ensure_str('no-priv@canonical.com')) | 123 | >>> recipients.getReason('no-priv@canonical.com') |
1181 | 124 | Traceback (most recent call last): | 124 | Traceback (most recent call last): |
1182 | 125 | ... | 125 | ... |
1183 | 126 | lp.services.mail.interfaces.UnknownRecipientError: 'no-priv@canonical.com' | 126 | lp.services.mail.interfaces.UnknownRecipientError: 'no-priv@canonical.com' |
1184 | diff --git a/lib/lp/services/webapp/breadcrumb.py b/lib/lp/services/webapp/breadcrumb.py | |||
1185 | index 1281fe2..eae2074 100644 | |||
1186 | --- a/lib/lp/services/webapp/breadcrumb.py | |||
1187 | +++ b/lib/lp/services/webapp/breadcrumb.py | |||
1188 | @@ -10,7 +10,6 @@ __all__ = [ | |||
1189 | 10 | 'TitleBreadcrumb', | 10 | 'TitleBreadcrumb', |
1190 | 11 | ] | 11 | ] |
1191 | 12 | 12 | ||
1192 | 13 | import six | ||
1193 | 14 | from zope.interface import implementer | 13 | from zope.interface import implementer |
1194 | 15 | 14 | ||
1195 | 16 | from lp.services.webapp import canonical_url | 15 | from lp.services.webapp import canonical_url |
1196 | @@ -77,12 +76,8 @@ class Breadcrumb: | |||
1197 | 77 | return self._detail or self.text | 76 | return self._detail or self.text |
1198 | 78 | 77 | ||
1199 | 79 | def __repr__(self): | 78 | def __repr__(self): |
1200 | 80 | # XXX: salgado, 2009-10-14, http://bugs.python.org/issue5876: In | ||
1201 | 81 | # python 2.5-2.7, the return value of __repr__() may be forced into a | ||
1202 | 82 | # type(str), so we can't include unicode here. | ||
1203 | 83 | text = six.ensure_str(self.text, 'raw-unicode-escape') | ||
1204 | 84 | return "<%s url='%s' text='%s'>" % ( | 79 | return "<%s url='%s' text='%s'>" % ( |
1206 | 85 | self.__class__.__name__, self.url, text) | 80 | self.__class__.__name__, self.url, self.text) |
1207 | 86 | 81 | ||
1208 | 87 | 82 | ||
1209 | 88 | class NameBreadcrumb(Breadcrumb): | 83 | class NameBreadcrumb(Breadcrumb): |
1210 | diff --git a/lib/lp/services/webapp/doc/canonical_url.txt b/lib/lp/services/webapp/doc/canonical_url.txt | |||
1211 | index 90d4df5..60f824a 100644 | |||
1212 | --- a/lib/lp/services/webapp/doc/canonical_url.txt | |||
1213 | +++ b/lib/lp/services/webapp/doc/canonical_url.txt | |||
1214 | @@ -18,8 +18,7 @@ will put in a temporary module. | |||
1215 | 18 | >>> from lp.services.webapp.interfaces import ICanonicalUrlData | 18 | >>> from lp.services.webapp.interfaces import ICanonicalUrlData |
1216 | 19 | >>> from zope.interface import Interface, Attribute, implementer | 19 | >>> from zope.interface import Interface, Attribute, implementer |
1217 | 20 | 20 | ||
1220 | 21 | >>> module = types.ModuleType( | 21 | >>> module = types.ModuleType(factory.getUniqueString().replace('-', '_')) |
1219 | 22 | ... six.ensure_str(factory.getUniqueString().replace('-', '_'))) | ||
1221 | 23 | >>> sys.modules[module.__name__] = module | 22 | >>> sys.modules[module.__name__] = module |
1222 | 24 | 23 | ||
1223 | 25 | >>> class ICountrySet(Interface): | 24 | >>> class ICountrySet(Interface): |
1224 | diff --git a/lib/lp/services/webapp/doc/menus.txt b/lib/lp/services/webapp/doc/menus.txt | |||
1225 | index c1cf9b4..7f910c8 100644 | |||
1226 | --- a/lib/lp/services/webapp/doc/menus.txt | |||
1227 | +++ b/lib/lp/services/webapp/doc/menus.txt | |||
1228 | @@ -561,8 +561,7 @@ First, we define a couple of interfaces, and put them in a temporary module. | |||
1229 | 561 | >>> import sys | 561 | >>> import sys |
1230 | 562 | >>> import types | 562 | >>> import types |
1231 | 563 | 563 | ||
1234 | 564 | >>> module = types.ModuleType( | 564 | >>> module = types.ModuleType(factory.getUniqueString().replace('-', '_')) |
1233 | 565 | ... six.ensure_str(factory.getUniqueString().replace('-', '_'))) | ||
1235 | 566 | >>> sys.modules[module.__name__] = module | 565 | >>> sys.modules[module.__name__] = module |
1236 | 567 | 566 | ||
1237 | 568 | >>> class IThingHavingFacets(Interface): | 567 | >>> class IThingHavingFacets(Interface): |
1238 | diff --git a/lib/lp/services/webapp/doc/test_adapter.txt b/lib/lp/services/webapp/doc/test_adapter.txt | |||
1239 | index abe5036..04378eb 100644 | |||
1240 | --- a/lib/lp/services/webapp/doc/test_adapter.txt | |||
1241 | +++ b/lib/lp/services/webapp/doc/test_adapter.txt | |||
1242 | @@ -211,7 +211,7 @@ timeout by sleeping for 200ms with a 100ms statement timeout: | |||
1243 | 211 | >>> set_request_started() | 211 | >>> set_request_started() |
1244 | 212 | >>> print(current_statement_timeout(store)) | 212 | >>> print(current_statement_timeout(store)) |
1245 | 213 | 100ms | 213 | 100ms |
1247 | 214 | >>> store.execute(six.ensure_str('SELECT pg_sleep(0.200)'), noresult=True) | 214 | >>> store.execute('SELECT pg_sleep(0.200)', noresult=True) |
1248 | 215 | Traceback (most recent call last): | 215 | Traceback (most recent call last): |
1249 | 216 | ... | 216 | ... |
1250 | 217 | lp.services.webapp.adapter.LaunchpadTimeoutError: | 217 | lp.services.webapp.adapter.LaunchpadTimeoutError: |
1251 | @@ -285,7 +285,7 @@ issuing the SQL command as we have exceeded the precision period: | |||
1252 | 285 | This final invokation, we will actually sleep to ensure that the | 285 | This final invokation, we will actually sleep to ensure that the |
1253 | 286 | timeout being reported by PostgreSQL is actually working: | 286 | timeout being reported by PostgreSQL is actually working: |
1254 | 287 | 287 | ||
1256 | 288 | >>> store.execute(six.ensure_str('SELECT pg_sleep(0.2)'), noresult=True) | 288 | >>> store.execute('SELECT pg_sleep(0.2)', noresult=True) |
1257 | 289 | Traceback (most recent call last): | 289 | Traceback (most recent call last): |
1258 | 290 | ... | 290 | ... |
1259 | 291 | lp.services.webapp.adapter.LaunchpadTimeoutError: | 291 | lp.services.webapp.adapter.LaunchpadTimeoutError: |
1260 | diff --git a/lib/lp/services/webapp/publication.py b/lib/lp/services/webapp/publication.py | |||
1261 | index 80effc1..37cd383 100644 | |||
1262 | --- a/lib/lp/services/webapp/publication.py | |||
1263 | +++ b/lib/lp/services/webapp/publication.py | |||
1264 | @@ -17,7 +17,6 @@ from lazr.uri import ( | |||
1265 | 17 | URI, | 17 | URI, |
1266 | 18 | ) | 18 | ) |
1267 | 19 | from psycopg2.extensions import TransactionRollbackError | 19 | from psycopg2.extensions import TransactionRollbackError |
1268 | 20 | import six | ||
1269 | 21 | from six.moves.urllib.parse import quote | 20 | from six.moves.urllib.parse import quote |
1270 | 22 | from storm.database import STATE_DISCONNECTED | 21 | from storm.database import STATE_DISCONNECTED |
1271 | 23 | from storm.exceptions import ( | 22 | from storm.exceptions import ( |
1272 | @@ -422,10 +421,7 @@ class LaunchpadBrowserPublication( | |||
1273 | 422 | return self.constructPageID(context, context.context, names) | 421 | return self.constructPageID(context, context.context, names) |
1274 | 423 | view_names = ':'.join(names) | 422 | view_names = ':'.join(names) |
1275 | 424 | pageid = '%s:%s' % (context_name, view_names) | 423 | pageid = '%s:%s' % (context_name, view_names) |
1280 | 425 | # The view name used in the pageid usually comes from ZCML and so it | 424 | return pageid |
1277 | 426 | # will be a Unicode string, but we want a native string. On Python | ||
1278 | 427 | # 2, to avoid problems we encode it into ASCII. | ||
1279 | 428 | return six.ensure_str(pageid, 'US-ASCII') | ||
1281 | 429 | 425 | ||
1282 | 430 | def callObject(self, request, ob): | 426 | def callObject(self, request, ob): |
1283 | 431 | """See `zope.publisher.interfaces.IPublication`. | 427 | """See `zope.publisher.interfaces.IPublication`. |
1284 | diff --git a/lib/lp/services/webapp/publisher.py b/lib/lp/services/webapp/publisher.py | |||
1285 | index c0f00aa..2f5960d 100644 | |||
1286 | --- a/lib/lp/services/webapp/publisher.py | |||
1287 | +++ b/lib/lp/services/webapp/publisher.py | |||
1288 | @@ -504,8 +504,7 @@ class LaunchpadView(UserAttributeCache): | |||
1289 | 504 | """See IBrowserPublisher.""" | 504 | """See IBrowserPublisher.""" |
1290 | 505 | # By default, a LaunchpadView cannot be traversed through. | 505 | # By default, a LaunchpadView cannot be traversed through. |
1291 | 506 | # Those that can be must override this method. | 506 | # Those that can be must override this method. |
1294 | 507 | raise NotFound( | 507 | raise NotFound(self, name, request=request) |
1293 | 508 | self, six.ensure_str(name, errors='replace'), request=request) | ||
1295 | 509 | 508 | ||
1296 | 510 | @property | 509 | @property |
1297 | 511 | def recommended_canonical_url(self): | 510 | def recommended_canonical_url(self): |
1298 | @@ -964,8 +963,7 @@ class Navigation: | |||
1299 | 964 | """ | 963 | """ |
1300 | 965 | # Avoid circular imports. | 964 | # Avoid circular imports. |
1301 | 966 | if nextobj is None: | 965 | if nextobj is None: |
1304 | 967 | raise NotFound( | 966 | raise NotFound(self.context, name) |
1303 | 968 | self.context, six.ensure_str(name, errors='replace')) | ||
1305 | 969 | elif isinstance(nextobj, redirection): | 967 | elif isinstance(nextobj, redirection): |
1306 | 970 | return RedirectionView( | 968 | return RedirectionView( |
1307 | 971 | nextobj.name, request, status=nextobj.status) | 969 | nextobj.name, request, status=nextobj.status) |
1308 | @@ -1185,7 +1183,7 @@ class RenamedView: | |||
1309 | 1185 | 1183 | ||
1310 | 1186 | def publishTraverse(self, request, name): | 1184 | def publishTraverse(self, request, name): |
1311 | 1187 | """See zope.publisher.interfaces.browser.IBrowserPublisher.""" | 1185 | """See zope.publisher.interfaces.browser.IBrowserPublisher.""" |
1313 | 1188 | raise NotFound(self.context, six.ensure_str(name, errors='replace')) | 1186 | raise NotFound(self.context, name) |
1314 | 1189 | 1187 | ||
1315 | 1190 | def browserDefault(self, request): | 1188 | def browserDefault(self, request): |
1316 | 1191 | """See zope.publisher.interfaces.browser.IBrowserPublisher.""" | 1189 | """See zope.publisher.interfaces.browser.IBrowserPublisher.""" |
1317 | diff --git a/lib/lp/services/webapp/servers.py b/lib/lp/services/webapp/servers.py | |||
1318 | index 32ebf7f..e644e05 100644 | |||
1319 | --- a/lib/lp/services/webapp/servers.py | |||
1320 | +++ b/lib/lp/services/webapp/servers.py | |||
1321 | @@ -870,9 +870,7 @@ class LaunchpadBrowserResponse(NotificationResponse, BrowserResponse): | |||
1322 | 870 | status = 307 | 870 | status = 307 |
1323 | 871 | else: | 871 | else: |
1324 | 872 | status = 303 | 872 | status = 303 |
1328 | 873 | super().redirect( | 873 | super().redirect(str(location), status=status, trusted=trusted) |
1326 | 874 | six.ensure_str(str(location)), | ||
1327 | 875 | status=status, trusted=trusted) | ||
1329 | 876 | 874 | ||
1330 | 877 | 875 | ||
1331 | 878 | def adaptResponseToSession(response): | 876 | def adaptResponseToSession(response): |
1332 | diff --git a/lib/lp/services/webservice/doc/launchpadlib.txt b/lib/lp/services/webservice/doc/launchpadlib.txt | |||
1333 | index 25d2e0b..20288ba 100644 | |||
1334 | --- a/lib/lp/services/webservice/doc/launchpadlib.txt | |||
1335 | +++ b/lib/lp/services/webservice/doc/launchpadlib.txt | |||
1336 | @@ -5,9 +5,7 @@ Just to show that we're actually talking to the appserver, first check to see | |||
1337 | 5 | if a specific user exists... | 5 | if a specific user exists... |
1338 | 6 | 6 | ||
1339 | 7 | >>> browser = Browser() | 7 | >>> browser = Browser() |
1343 | 8 | >>> browser.addHeader( | 8 | >>> browser.addHeader('Authorization', 'Basic foo.bar@canonical.com:test') |
1341 | 9 | ... 'Authorization', | ||
1342 | 10 | ... six.ensure_str('Basic foo.bar@canonical.com:test')) | ||
1344 | 11 | >>> from lp.testing.layers import BaseLayer | 9 | >>> from lp.testing.layers import BaseLayer |
1345 | 12 | >>> root_url = BaseLayer.appserver_root_url() | 10 | >>> root_url = BaseLayer.appserver_root_url() |
1346 | 13 | >>> browser.open(root_url) | 11 | >>> browser.open(root_url) |
1347 | diff --git a/lib/lp/soyuz/scripts/gina/packages.py b/lib/lp/soyuz/scripts/gina/packages.py | |||
1348 | index e8b6dae..15b4a45 100644 | |||
1349 | --- a/lib/lp/soyuz/scripts/gina/packages.py | |||
1350 | +++ b/lib/lp/soyuz/scripts/gina/packages.py | |||
1351 | @@ -110,9 +110,7 @@ def unpack_dsc(package, version, component, distro_name, archive_root): | |||
1352 | 110 | extract_dpkg_source(dsc_path, ".", vendor=distro_name) | 110 | extract_dpkg_source(dsc_path, ".", vendor=distro_name) |
1353 | 111 | except DpkgSourceError as e: | 111 | except DpkgSourceError as e: |
1354 | 112 | if os.path.isdir(source_dir): | 112 | if os.path.isdir(source_dir): |
1358 | 113 | # Coerce to str to avoid https://bugs.python.org/issue24672 on | 113 | shutil.rmtree(source_dir) |
1356 | 114 | # Python 2. | ||
1357 | 115 | shutil.rmtree(six.ensure_str(source_dir)) | ||
1359 | 116 | raise ExecutionError("Error %d unpacking source" % e.result) | 114 | raise ExecutionError("Error %d unpacking source" % e.result) |
1360 | 117 | 115 | ||
1361 | 118 | return source_dir, dsc_path | 116 | return source_dir, dsc_path |
1362 | @@ -149,9 +147,7 @@ def read_dsc(package, version, component, distro_name, archive_root): | |||
1363 | 149 | "No copyright file found for %s in %s" % (package, source_dir)) | 147 | "No copyright file found for %s in %s" % (package, source_dir)) |
1364 | 150 | copyright = b'' | 148 | copyright = b'' |
1365 | 151 | finally: | 149 | finally: |
1369 | 152 | # Coerce to str to avoid https://bugs.python.org/issue24672 on | 150 | shutil.rmtree(source_dir) |
1367 | 153 | # Python 2. | ||
1368 | 154 | shutil.rmtree(six.ensure_str(source_dir)) | ||
1370 | 155 | 151 | ||
1371 | 156 | return dsc, changelog, copyright | 152 | return dsc, changelog, copyright |
1372 | 157 | 153 | ||
1373 | diff --git a/lib/lp/soyuz/scripts/ppareport.py b/lib/lp/soyuz/scripts/ppareport.py | |||
1374 | index c9e106c..e93c85a 100644 | |||
1375 | --- a/lib/lp/soyuz/scripts/ppareport.py | |||
1376 | +++ b/lib/lp/soyuz/scripts/ppareport.py | |||
1377 | @@ -15,7 +15,6 @@ import operator | |||
1378 | 15 | import os | 15 | import os |
1379 | 16 | import sys | 16 | import sys |
1380 | 17 | 17 | ||
1381 | 18 | import six | ||
1382 | 19 | from storm.locals import Join | 18 | from storm.locals import Join |
1383 | 20 | from storm.store import Store | 19 | from storm.store import Store |
1384 | 21 | from zope.component import getUtility | 20 | from zope.component import getUtility |
1385 | @@ -175,7 +174,7 @@ class PPAReportScript(LaunchpadScript): | |||
1386 | 175 | if size <= (threshold * limit): | 174 | if size <= (threshold * limit): |
1387 | 176 | continue | 175 | continue |
1388 | 177 | line = "%s | %d | %d\n" % (canonical_url(ppa), limit, size) | 176 | line = "%s | %d | %d\n" % (canonical_url(ppa), limit, size) |
1390 | 178 | self.output.write(six.ensure_str(line)) | 177 | self.output.write(line) |
1391 | 179 | self.output.write('\n') | 178 | self.output.write('\n') |
1392 | 180 | 179 | ||
1393 | 181 | def reportUserEmails(self): | 180 | def reportUserEmails(self): |
1394 | @@ -188,7 +187,7 @@ class PPAReportScript(LaunchpadScript): | |||
1395 | 188 | for user in sorted_people_to_email: | 187 | for user in sorted_people_to_email: |
1396 | 189 | line = "%s | %s | %s\n" % ( | 188 | line = "%s | %s | %s\n" % ( |
1397 | 190 | user.name, user.displayname, user.preferredemail.email) | 189 | user.name, user.displayname, user.preferredemail.email) |
1399 | 191 | self.output.write(six.ensure_str(line)) | 190 | self.output.write(line) |
1400 | 192 | self.output.write('\n') | 191 | self.output.write('\n') |
1401 | 193 | 192 | ||
1402 | 194 | @cachedproperty | 193 | @cachedproperty |
1403 | diff --git a/lib/lp/soyuz/stories/soyuz/xx-builds-pages.txt b/lib/lp/soyuz/stories/soyuz/xx-builds-pages.txt | |||
1404 | index 6b1ab8c..4c49953 100644 | |||
1405 | --- a/lib/lp/soyuz/stories/soyuz/xx-builds-pages.txt | |||
1406 | +++ b/lib/lp/soyuz/stories/soyuz/xx-builds-pages.txt | |||
1407 | @@ -21,8 +21,7 @@ according to the selected buildstate, by default All. | |||
1408 | 21 | ... provide only part of the required arguments to enable filter by | 21 | ... provide only part of the required arguments to enable filter by |
1409 | 22 | ... name. | 22 | ... name. |
1410 | 23 | ... """ | 23 | ... """ |
1413 | 24 | ... assert six.ensure_str( | 24 | ... assert '<input type="submit" value="Filter" />' in contents |
1412 | 25 | ... '<input type="submit" value="Filter" />') in contents | ||
1414 | 26 | ... | 25 | ... |
1415 | 27 | ... field_state = find_tag_by_id(contents, 'build_state') is not None | 26 | ... field_state = find_tag_by_id(contents, 'build_state') is not None |
1416 | 28 | ... field_name = find_tag_by_id(contents, 'build_text') is not None | 27 | ... field_name = find_tag_by_id(contents, 'build_text') is not None |
1417 | diff --git a/lib/lp/translations/model/pomsgid.py b/lib/lp/translations/model/pomsgid.py | |||
1418 | index 85bcd87..5f38c08 100644 | |||
1419 | --- a/lib/lp/translations/model/pomsgid.py | |||
1420 | +++ b/lib/lp/translations/model/pomsgid.py | |||
1421 | @@ -50,5 +50,5 @@ class POMsgID(StormBase): | |||
1422 | 50 | Func('sha1', POMsgID.msgid) == | 50 | Func('sha1', POMsgID.msgid) == |
1423 | 51 | Func('sha1', six.ensure_text(key))).one() | 51 | Func('sha1', six.ensure_text(key))).one() |
1424 | 52 | if r is None: | 52 | if r is None: |
1426 | 53 | raise NotFoundError(six.ensure_str(key, errors='replace')) | 53 | raise NotFoundError(key) |
1427 | 54 | return r | 54 | return r |
1428 | diff --git a/lib/lp/translations/model/potranslation.py b/lib/lp/translations/model/potranslation.py | |||
1429 | index b342098..9c01c45 100644 | |||
1430 | --- a/lib/lp/translations/model/potranslation.py | |||
1431 | +++ b/lib/lp/translations/model/potranslation.py | |||
1432 | @@ -51,7 +51,7 @@ class POTranslation(StormBase): | |||
1433 | 51 | if r is not None: | 51 | if r is not None: |
1434 | 52 | return r | 52 | return r |
1435 | 53 | else: | 53 | else: |
1437 | 54 | raise NotFoundError(six.ensure_str(key, errors='replace')) | 54 | raise NotFoundError(key) |
1438 | 55 | 55 | ||
1439 | 56 | @classmethod | 56 | @classmethod |
1440 | 57 | def getOrCreateTranslation(cls, key): | 57 | def getOrCreateTranslation(cls, key): |
1441 | diff --git a/lib/lp/translations/stories/standalone/xx-language.txt b/lib/lp/translations/stories/standalone/xx-language.txt | |||
1442 | index 438f687..0476573 100644 | |||
1443 | --- a/lib/lp/translations/stories/standalone/xx-language.txt | |||
1444 | +++ b/lib/lp/translations/stories/standalone/xx-language.txt | |||
1445 | @@ -274,9 +274,8 @@ Changing values to correct content works: | |||
1446 | 274 | >>> admin_browser.getControl('ISO 639').value = 'bars' | 274 | >>> admin_browser.getControl('ISO 639').value = 'bars' |
1447 | 275 | >>> admin_browser.getControl('English name').value = 'Changed field' | 275 | >>> admin_browser.getControl('English name').value = 'Changed field' |
1448 | 276 | >>> spokenin_control = admin_browser.getControl(name='field.countries') | 276 | >>> spokenin_control = admin_browser.getControl(name='field.countries') |
1452 | 277 | >>> spokenin_control.getControl( | 277 | >>> spokenin_control.getControl('Argentina').selected = False |
1453 | 278 | ... six.ensure_str('Argentina')).selected = False | 278 | >>> spokenin_control.getControl('France').selected = True |
1451 | 279 | >>> spokenin_control.getControl(six.ensure_str('France')).selected = True | ||
1454 | 280 | >>> admin_browser.getControl('Admin Language').click() | 279 | >>> admin_browser.getControl('Admin Language').click() |
1455 | 281 | >>> print(admin_browser.url) | 280 | >>> print(admin_browser.url) |
1456 | 282 | http://translations.launchpad.test/+languages/bars | 281 | http://translations.launchpad.test/+languages/bars |
1457 | diff --git a/lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt b/lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt | |||
1458 | index c049b94..804cd1c 100644 | |||
1459 | --- a/lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt | |||
1460 | +++ b/lib/lp/translations/stories/standalone/xx-translationmessage-translate.txt | |||
1461 | @@ -331,7 +331,7 @@ Now, we will check suggestions in this form. | |||
1462 | 331 | 331 | ||
1463 | 332 | Check that suggestions come in from other contexts: | 332 | Check that suggestions come in from other contexts: |
1464 | 333 | 333 | ||
1466 | 334 | >>> six.ensure_str("Suggested in") in browser.contents | 334 | >>> "Suggested in" in browser.contents |
1467 | 335 | True | 335 | True |
1468 | 336 | 336 | ||
1469 | 337 | >>> find_tag_by_id(browser.contents, 'msgset_143_es_suggestion_697_0') | 337 | >>> find_tag_by_id(browser.contents, 'msgset_143_es_suggestion_697_0') |
1470 | @@ -340,16 +340,15 @@ Check that suggestions come in from other contexts: | |||
1471 | 340 | Check that no other suggestions are presented (since no others are | 340 | Check that no other suggestions are presented (since no others are |
1472 | 341 | relevant for this message): | 341 | relevant for this message): |
1473 | 342 | 342 | ||
1475 | 343 | >>> six.ensure_str("Suggested by") in browser.contents | 343 | >>> "Suggested by" in browser.contents |
1476 | 344 | False | 344 | False |
1477 | 345 | 345 | ||
1479 | 346 | >>> six.ensure_str("Used in") in browser.contents | 346 | >>> "Used in" in browser.contents |
1480 | 347 | False | 347 | False |
1481 | 348 | 348 | ||
1482 | 349 | Check for the translator note: | 349 | Check for the translator note: |
1483 | 350 | 350 | ||
1486 | 351 | >>> note = six.ensure_str( | 351 | >>> note = "This is an example of commenttext for a multiline" |
1485 | 352 | ... "This is an example of commenttext for a multiline") | ||
1487 | 353 | >>> note in browser.contents | 352 | >>> note in browser.contents |
1488 | 354 | True | 353 | True |
1489 | 355 | 354 | ||
1490 | @@ -410,7 +409,7 @@ And submit it. | |||
1491 | 410 | Now, we check that the translation we are going to add is not yet in the | 409 | Now, we check that the translation we are going to add is not yet in the |
1492 | 411 | form, so we can check later that it's added as a suggestion: | 410 | form, so we can check later that it's added as a suggestion: |
1493 | 412 | 411 | ||
1495 | 413 | >>> six.ensure_str('foo!!') in fast_submission.contents | 412 | >>> 'foo!!' in fast_submission.contents |
1496 | 414 | False | 413 | False |
1497 | 415 | 414 | ||
1498 | 416 | Now, we update the translation in slow_submission. | 415 | Now, we update the translation in slow_submission. |
1499 | diff --git a/lib/lp/translations/stories/translations/xx-translations.txt b/lib/lp/translations/stories/translations/xx-translations.txt | |||
1500 | index 9c26cb1..ee8309a 100644 | |||
1501 | --- a/lib/lp/translations/stories/translations/xx-translations.txt | |||
1502 | +++ b/lib/lp/translations/stories/translations/xx-translations.txt | |||
1503 | @@ -94,7 +94,7 @@ page, and that it has all the data we are expecting, in terms of languages. | |||
1504 | 94 | >>> from lp.testing.pages import extract_url_parameter | 94 | >>> from lp.testing.pages import extract_url_parameter |
1505 | 95 | >>> browser.open('http://translations.launchpad.test/ubuntu/hoary/' | 95 | >>> browser.open('http://translations.launchpad.test/ubuntu/hoary/' |
1506 | 96 | ... '+translations') | 96 | ... '+translations') |
1508 | 97 | >>> six.ensure_str('Translation status by language') in browser.contents | 97 | >>> 'Translation status by language' in browser.contents |
1509 | 98 | True | 98 | True |
1510 | 99 | >>> print(browser.getLink('Catalan').url) | 99 | >>> print(browser.getLink('Catalan').url) |
1511 | 100 | http://translations.launchpad.test/ubuntu/hoary/+lang/ca | 100 | http://translations.launchpad.test/ubuntu/hoary/+lang/ca |
1512 | @@ -113,7 +113,7 @@ put Afrihili into the list of "preferred languages". | |||
1513 | 113 | >>> browser.addHeader('Accept-Language', 'en-us,en;q=0.7,afh;q=0.3') | 113 | >>> browser.addHeader('Accept-Language', 'en-us,en;q=0.7,afh;q=0.3') |
1514 | 114 | >>> browser.open('http://translations.launchpad.test/ubuntu/hoary/' | 114 | >>> browser.open('http://translations.launchpad.test/ubuntu/hoary/' |
1515 | 115 | ... '+translations') | 115 | ... '+translations') |
1517 | 116 | >>> six.ensure_str('Translation status by language') in browser.contents | 116 | >>> 'Translation status by language' in browser.contents |
1518 | 117 | True | 117 | True |
1519 | 118 | >>> print(browser.getLink('Catalan').url) | 118 | >>> print(browser.getLink('Catalan').url) |
1520 | 119 | http://translations.launchpad.test/ubuntu/hoary/+lang/ca | 119 | http://translations.launchpad.test/ubuntu/hoary/+lang/ca |
1521 | @@ -130,9 +130,9 @@ pofile) for evolution-2.2 | |||
1522 | 130 | >>> browser.open( | 130 | >>> browser.open( |
1523 | 131 | ... 'http://translations.launchpad.test/ubuntu/hoary/+lang/hr' | 131 | ... 'http://translations.launchpad.test/ubuntu/hoary/+lang/hr' |
1524 | 132 | ... '?batch=2') | 132 | ... '?batch=2') |
1526 | 133 | >>> six.ensure_str('Croatian') in browser.contents | 133 | >>> 'Croatian' in browser.contents |
1527 | 134 | True | 134 | True |
1529 | 135 | >>> six.ensure_str('Translatable templates') in browser.contents | 135 | >>> 'Translatable templates' in browser.contents |
1530 | 136 | True | 136 | True |
1531 | 137 | >>> print(browser.getLink('evolution-2.2').url) # noqa | 137 | >>> print(browser.getLink('evolution-2.2').url) # noqa |
1532 | 138 | http://translations.launchpad.test/ubuntu/hoary/+source/evolution/+pots/evolution-2.2/hr/+translate | 138 | http://translations.launchpad.test/ubuntu/hoary/+source/evolution/+pots/evolution-2.2/hr/+translate |
1533 | @@ -173,7 +173,7 @@ And finally, we will get pmount. | |||
1534 | 173 | 173 | ||
1535 | 174 | With its latest translator. | 174 | With its latest translator. |
1536 | 175 | 175 | ||
1538 | 176 | >>> six.ensure_str('Edgar Bursic') in browser.contents | 176 | >>> 'Edgar Bursic' in browser.contents |
1539 | 177 | True | 177 | True |
1540 | 178 | 178 | ||
1541 | 179 | Last translator | 179 | Last translator |
1542 | @@ -213,7 +213,7 @@ file): | |||
1543 | 213 | batch=10 | 213 | batch=10 |
1544 | 214 | >>> print(extract_url_parameter(browser.url, 'show')) | 214 | >>> print(extract_url_parameter(browser.url, 'show')) |
1545 | 215 | show=untranslated | 215 | show=untranslated |
1547 | 216 | >>> six.ensure_str('10.') in browser.contents | 216 | >>> '10.' in browser.contents |
1548 | 217 | True | 217 | True |
1549 | 218 | 218 | ||
1550 | 219 | If everything works out ok, that means that DummyPOFile has actually | 219 | If everything works out ok, that means that DummyPOFile has actually |
1551 | @@ -225,9 +225,7 @@ Finally, lets also check that translated entries show up as well. | |||
1552 | 225 | >>> browser.getControl('Change').click() | 225 | >>> browser.getControl('Change').click() |
1553 | 226 | >>> print(extract_url_parameter(browser.url, 'show')) | 226 | >>> print(extract_url_parameter(browser.url, 'show')) |
1554 | 227 | show=translated | 227 | show=translated |
1558 | 228 | >>> six.ensure_str( | 228 | >>> "There are no messages that match this filtering." in browser.contents |
1556 | 229 | ... "There are no messages that match this filtering.") in ( | ||
1557 | 230 | ... browser.contents) | ||
1559 | 231 | True | 229 | True |
1560 | 232 | 230 | ||
1561 | 233 | Links to filtered pages | 231 | Links to filtered pages |
1562 | @@ -386,20 +384,20 @@ should see Catalan in the list. | |||
1563 | 386 | >>> browser.open( | 384 | >>> browser.open( |
1564 | 387 | ... 'http://translations.launchpad.test/ubuntu/hoary/+source/' | 385 | ... 'http://translations.launchpad.test/ubuntu/hoary/+source/' |
1565 | 388 | ... 'evolution/+translations') | 386 | ... 'evolution/+translations') |
1567 | 389 | >>> six.ensure_str('Catalan') in browser.contents | 387 | >>> 'Catalan' in browser.contents |
1568 | 390 | True | 388 | True |
1569 | 391 | 389 | ||
1570 | 392 | But also, he doesn't want to see other languages in the list. So, he | 390 | But also, he doesn't want to see other languages in the list. So, he |
1571 | 393 | shouldn't see eg. Japanese. | 391 | shouldn't see eg. Japanese. |
1572 | 394 | 392 | ||
1574 | 395 | >>> six.ensure_str('Japanese') in browser.contents | 393 | >>> 'Japanese' in browser.contents |
1575 | 396 | False | 394 | False |
1576 | 397 | 395 | ||
1577 | 398 | Next, if he chooses to view all the languages, he should see Japanese | 396 | Next, if he chooses to view all the languages, he should see Japanese |
1578 | 399 | among the languages on the page. | 397 | among the languages on the page. |
1579 | 400 | 398 | ||
1580 | 401 | >>> browser.getLink('View template & all languages...').click() | 399 | >>> browser.getLink('View template & all languages...').click() |
1582 | 402 | >>> six.ensure_str('Japanese') in browser.contents | 400 | >>> 'Japanese' in browser.contents |
1583 | 403 | True | 401 | True |
1584 | 404 | 402 | ||
1585 | 405 | So, everything is fine, and Carlos can sleep calmly. | 403 | So, everything is fine, and Carlos can sleep calmly. |
1586 | diff --git a/scripts/list-team-members b/scripts/list-team-members | |||
1587 | index 507d590..b7a7e61 100755 | |||
1588 | --- a/scripts/list-team-members | |||
1589 | +++ b/scripts/list-team-members | |||
1590 | @@ -8,8 +8,6 @@ import _pythonpath # noqa: F401 | |||
1591 | 8 | import logging | 8 | import logging |
1592 | 9 | import sys | 9 | import sys |
1593 | 10 | 10 | ||
1594 | 11 | import six | ||
1595 | 12 | |||
1596 | 13 | from lp.registry.scripts.listteammembers import ( | 11 | from lp.registry.scripts.listteammembers import ( |
1597 | 14 | NoSuchTeamError, | 12 | NoSuchTeamError, |
1598 | 15 | process_team, | 13 | process_team, |
1599 | @@ -55,7 +53,7 @@ class ListTeamMembersScript(LaunchpadScript): | |||
1600 | 55 | except NoSuchTeamError: | 53 | except NoSuchTeamError: |
1601 | 56 | raise LaunchpadScriptFailure("No such team: %s" % teamname) | 54 | raise LaunchpadScriptFailure("No such team: %s" % teamname) |
1602 | 57 | for detail in sorted(member_details): | 55 | for detail in sorted(member_details): |
1604 | 58 | print(six.ensure_str(detail)) | 56 | print(detail) |
1605 | 59 | 57 | ||
1606 | 60 | 58 | ||
1607 | 61 | if __name__ == '__main__': | 59 | if __name__ == '__main__': |
LGTM 👍