-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
Python 3 support #75
Python 3 support #75
Conversation
@@ -41,7 +41,7 @@ def setUpZope(self, app, configurationContext): | |||
class InternalServerErrorService(Service): | |||
|
|||
def __call__(self): | |||
from urllib2 import HTTPError | |||
from six.moves.urllib.error import HTTPError |
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.
We should declare the dependency on six
in setup.py
Tests in py3 are: |
@@ -41,8 +41,9 @@ def traverse(self, path='/plone', accept='application/json', method='GET'): | |||
request.environ['PATH_TRANSLATED'] = path | |||
request.environ['HTTP_ACCEPT'] = accept | |||
request.environ['REQUEST_METHOD'] = method | |||
request._auth = 'Basic %s' % b64encode( | |||
'%s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD)) | |||
auth = '%s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD) |
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.
shouldn't we use .format()
instead?
'%s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD)) | ||
auth = '%s:%s' % (TEST_USER_NAME, TEST_USER_PASSWORD) | ||
b64auth = b64encode(auth.encode('utf8')) | ||
request._auth = 'Basic %s' % b64auth.decode('utf8') |
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.
shouldn't we use .format()
instead?
@@ -32,8 +32,9 @@ def traverse(self, path='/plone', accept='application/json', method='GET'): | |||
request.environ['PATH_TRANSLATED'] = path | |||
request.environ['HTTP_ACCEPT'] = accept | |||
request.environ['REQUEST_METHOD'] = method | |||
request._auth = 'Basic %s' % b64encode( | |||
'%s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)) | |||
auth = '%s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) |
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.
shouldn't we use .format()
instead?
'%s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD)) | ||
auth = '%s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD) | ||
b64auth = b64encode(auth.encode('utf8')) | ||
request._auth = 'Basic %s' % b64auth.decode('utf8') |
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.
shouldn't we use .format()
instead?
this seems to be almost ready now: $ pylint --py3k --disable=no-absolute-import src/plone/rest/
No config file found, using default configuration
------------------------------------
Your code has been rated at 10.00/10
|
Regarding the remaining 8 failures on Plone 5.2 / These aren't Python 3 failures as such, but come from the difference between 7 of the 8 failures are because status
This is because in WSGIPublisher, the The remaining failure is caused by
|
@davisagli or @tschorr could one of you have a look at this? I'm notoriously bad when it comes to understanding the various layers of exception-handling. |
Always when I see Maybe get rid of |
Running
all fail with:
and then there's
|
@tschorr that's because you disabled exception view rendering, which is how plone.rest turns exceptions into JSON responses. I would need to take a closer look at how to fix the problems that @lukasgraf pointed out, but getting rid of exception view rendering is not it. |
@lukasgraf I have reversed the order according to your proposal in https://github.com/zopefoundation/Zope/tree/py3_fix_wsgi_unauthorized and confirm this fixes 7 tests. Tests in Zope all pass with this modification. |
Jenkins looks slightly better using |
Checks for this PR pass now maybe because only Python 2.7 is tested with Travis. I still have the one failing test mentioned by @lukasgraf ("Another exception ...") using Python 3.6. |
@tschorr feel free to add Python 3 to the Travis configuration. |
@tschorr thanks for looking into this! Just to clarify, I'm not necessarily proposing that the order in |
This reverts commit 587b3a6.
@pbauer I see this is hitting plone/plone.protect#74 even though it is using python 2.7.14 (see latest travis https://travis-ci.org/plone/plone.rest/jobs/436770003) Do we need a new release of plone.protect with the latest changes for tests to pass? |
@jensens FYI: you merged this PR even though the Travis build failed. Please keep in mind that plone.rest and plone.restapi are used outside of Plone and for older Plone versions. It is just not sufficient if coredev tests pass. |
No description provided.