Merge lp:~cjwatson/lazr.restful/py3-no-str-decode into lp:lazr.restful

Proposed by Colin Watson
Status: Merged
Merged at revision: 261
Proposed branch: lp:~cjwatson/lazr.restful/py3-no-str-decode
Merge into: lp:lazr.restful
Diff against target: 13 lines (+1/-2)
1 file modified
src/lazr/restful/example/base/interfaces.py (+1/-2)
To merge this branch: bzr merge lp:~cjwatson/lazr.restful/py3-no-str-decode
Reviewer Review Type Date Requested Status
Ioana Lasc (community) Approve
Review via email: mp+390204@code.launchpad.net

Commit message

Avoid calling str.decode on Python 3.

Description of the change

Cuisine.FRANCAISE was being initialised using str.decode, which won't work on Python 3. We could use bytes.decode instead, but in this case it's simpler and clearer to just use Unicode strings directly.

To post a comment you must log in.
Revision history for this message
Ioana Lasc (ilasc) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/lazr/restful/example/base/interfaces.py'
2--- src/lazr/restful/example/base/interfaces.py 2020-02-04 21:53:16 +0000
3+++ src/lazr/restful/example/base/interfaces.py 2020-09-02 22:44:02 +0000
4@@ -71,8 +71,7 @@
5 VEGETARIAN = Item("Vegetarian", "Vegetarian cooking")
6 AMERICAN = Item("American", "Traditional American cooking")
7 DESSERT = Item("Dessert", "Desserts")
8- FRANCAISE = Item("Fran\xc3\xa7aise".decode("utf-8"),
9- "Cuisine fran\xc3\xa7aise".decode("utf-8"))
10+ FRANCAISE = Item(u"Fran\xe7aise", u"Cuisine fran\xe7aise")
11
12
13 class IHasGet(Interface):

Subscribers

People subscribed via source and target branches