Skip to content
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

Merged
merged 4 commits into from
Feb 5, 2020
Merged

Moving to Python3 #247

merged 4 commits into from
Feb 5, 2020

Conversation

iambibhas
Copy link
Contributor

Related to hasgeek/hgapp#39

@iambibhas iambibhas requested a review from jace January 10, 2020 04:00
Copy link
Member

@jace jace left a 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"
Copy link
Member

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'):
Copy link
Member

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.

Copy link
Member

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)
Copy link
Member

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?

@@ -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()
Copy link
Member

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.

@iambibhas iambibhas merged commit 335cf8c into master Feb 5, 2020
@iambibhas iambibhas deleted the py3 branch February 5, 2020 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants