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

Modernize Python 2 code to prepare for Python 3 #4

Closed
wants to merge 2 commits into from

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Sep 8, 2019

Fixes issues discovered by the flake8 tests running on Travis CI.

Use print() function in both Python 2 and Python 3

  • Legacy print statements are syntax errors in Python 3 but print() function works as expected in both Python 2 and Python 3.

Old style exceptions --> new style for Python 3

  • Old style exceptions are syntax errors in Python 3 but new style exceptions work as expected in both Python 2 and Python 3.

Octal literals must start with 0o in Python 3.

In requirements.txt the ldap module has been a dummy for a long time now. We substitute a newer module for access to MySQL.

In .travis.yml run the Python 3 tests in allow_failures mode until we can get web.py to be Python 3 compatible.

Please test these changes carefully before merging this PR especially in areas related to LDAP and MySQL.

iredmail added a commit that referenced this pull request Sep 9, 2019
Update requirements.txt with correct module names and version numbers.
@iredmail iredmail closed this in 67ee385 Sep 9, 2019
@iredmail
Copy link
Owner

iredmail commented Sep 9, 2019

Thanks @cclauss. :)

  • ldap module should be python-ldap.
  • I use web.py-0.40.dev1 for testing, it partly works with py3.
  • Disabled tests in .travis.yml since unit testing requires a working iRedMail server (with SQL/LDAP service running).

@iredmail
Copy link
Owner

iredmail commented Sep 9, 2019

The plan is making it working with py3 only in the future, no more code for py2+py3 compatible.

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