-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving to Python3 #247
Moving to Python3 #247
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few places need attention, but no blockers.
.travis.yml
Outdated
@@ -1,6 +1,6 @@ | |||
language: python | |||
python: | |||
- "2.7" | |||
- "3.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bump to 3.7
hgtv/uploads.py
Outdated
tempfile = StringIO(buf=request.stream.read()) | ||
if hasattr(request, 'content'): | ||
tempfile = BytesIO(request.content) | ||
elif hasattr(request, 'read'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be else
, or you could end up with no tempfile
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this entire block could be better. We shouldn't be doing guesswork here.
@@ -32,7 +32,7 @@ def channel_edit(channel): | |||
if channel.userid == current_auth.user.userid: | |||
form.type.choices = [(1, CHANNEL_TYPE[1])] | |||
else: | |||
choices = CHANNEL_TYPE.items() | |||
choices = list(CHANNEL_TYPE.items()) # requires list() | |||
choices.pop(0) | |||
choices.pop(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment explaining why the first two items are being popped?
hgtv/views/video.py
Outdated
@@ -155,11 +154,11 @@ def process_slides(video): | |||
raise DataProcessingError("Unable to resolve the URL") | |||
elif parsed.netloc in ['speakerdeck.com', 'www.speakerdeck.com']: | |||
try: | |||
r = urllib2.urlopen('https://speakerdeck.com/oembed.json?url=%s' % video.slides_url) | |||
r = urllib.request.urlopen('https://speakerdeck.com/oembed.json?url=%s' % video.slides_url) | |||
jsondata = json.loads(r.read()) | |||
r.close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separately, this block should switch to requests.
Related to hasgeek/hgapp#39