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

Make python3 compatible #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

miriam-rittenberg
Copy link

No description provided.

@jdreed
Copy link
Member

jdreed commented Aug 29, 2020

Also +1, though the same caveat applies that it's been over 3 years since I had a working build environment for Debathena.

Thanks for doing this work, great to see new folks committing!

else:
return text[0:maxlen-1] + '…'
# python 2 can't concatenate unicode and str-containing-unicode
return str(text[0:maxlen-1]) + '…'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure I understand what's going on here. Looking at the code and the comment, it seems like '...' is str-containing-unicode for python2, and text[0:maxlen-1] is unicode, so we have to force it to string in order to get the concatenation to work? (This also has the side effect of making truncate_column() always return a str.) But how would text[0:maxlen-1] end up being unicode?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

text[0:maxlen-1] is unicode because of the changes I made to python-discuss. In python3 the str does nothing, and in python2 I believe it was a str before I changed anything in python-discuss, so I don't think making it always return a str changes anything.

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.

3 participants