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

More compatibility changes for Python 3 #17

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix to restore Python 2 compatibility!
Looks like bytes() behaves different in Python 2, so I changed the code to make use of the six library instead.
  • Loading branch information
JordanReiter authored Jul 14, 2016
commit 3f0316dbd96488be149649fbbde6a50fac10492d
4 changes: 3 additions & 1 deletion src/oaipmh/server.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import six

from lxml.etree import ElementTree, Element, SubElement
from lxml import etree
from datetime import datetime
Expand Down Expand Up @@ -260,7 +262,7 @@ def handleRequest(self, request_kw):
new_kw = {}
try:
for key, value in request_kw.items():
new_kw[bytes(key, 'ascii').decode('ascii')] = value
new_kw[six.text_type(key).encode('ascii').decode('ascii')] = value
except UnicodeError:
raise error.BadVerbError(
"Non-ascii keys in request."
Expand Down