Skip to content

Commit

Permalink
Python 3 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bzar committed Jan 4, 2022
1 parent 46a6e10 commit d3ec0b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ckanext/qa/model.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import uuid
import datetime
import six

from sqlalchemy import Column
from sqlalchemy import types
Expand All @@ -15,7 +16,7 @@


def make_uuid():
return unicode(uuid.uuid4())
return six.text_type(uuid.uuid4())


class QA(Base):
Expand All @@ -40,7 +41,7 @@ class QA(Base):

def __repr__(self):
summary = 'score=%s format=%s' % (self.openness_score, self.format)
details = unicode(self.openness_score_reason).encode('unicode_escape')
details = six.text_type(self.openness_score_reason).encode('unicode_escape')
package = model.Package.get(self.package_id)
package_name = package.name if package else '?%s?' % self.package_id
return '<QA %s /dataset/%s/resource/%s %s>' % \
Expand Down
4 changes: 3 additions & 1 deletion ckanext/qa/tests/mock_remote_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
from threading import Thread
from time import sleep
from wsgiref.simple_server import make_server
from functools import reduce
import urllib2
import socket
import six


class MockHTTPServer(object):
Expand Down Expand Up @@ -116,7 +118,7 @@ def __call__(self, environ, start_response):
else:
content = request.str_params.get('content', '')

if isinstance(content, unicode):
if isinstance(content, six.text_type):
raise TypeError("Expected raw byte string for content")

headers = [
Expand Down

0 comments on commit d3ec0b9

Please sign in to comment.