diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c3b210..6124b6d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ jobs: test: strategy: matrix: - python-version: ["2.7", "3.8"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] runs-on: ubuntu-latest container: # INFO: python 2 is no longer supported in diff --git a/ckanapi/localckan.py b/ckanapi/localckan.py index 1add7ab..1211329 100644 --- a/ckanapi/localckan.py +++ b/ckanapi/localckan.py @@ -1,4 +1,3 @@ -from cgi import FieldStorage from tempfile import TemporaryFile from ckanapi.errors import CKANAPIError @@ -64,10 +63,13 @@ def call_action(self, action, data_dict=None, context=None, apikey=None, except (AttributeError, IOError): f = _write_temp_file(f) to_close.append(f) - field_storage = FieldStorage() - field_storage.file = f - field_storage.filename = filename - data_dict[fieldname] = field_storage + + from werkzeug.datastructures import FileStorage + + file_storage = FileStorage() + file_storage.stream = f + file_storage.filename = filename + data_dict[fieldname] = file_storage return self._get_action(action)(context, data_dict) finally: diff --git a/setup.py b/setup.py index fa1fa06..77e8356 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ 'simplejson', ] tests_require=[ - 'pyfakefs==3.6.1', + 'pyfakefs==5.3.5', ]