From 36adf7984442db96d8537fc99500bc663e69048b Mon Sep 17 00:00:00 2001 From: Alex Manning Date: Thu, 23 Jun 2022 15:10:41 +0100 Subject: [PATCH] Fix python3.6 bug caused by datetime.date.fromisoformat not existing. --- jasmin_services/api/views.py | 9 +++ poetry.lock | 13 ++++- pyproject.toml | 3 +- requirements.txt | 110 ++++++++--------------------------- 4 files changed, 48 insertions(+), 87 deletions(-) diff --git a/jasmin_services/api/views.py b/jasmin_services/api/views.py index bc4ea8e..e5f3618 100644 --- a/jasmin_services/api/views.py +++ b/jasmin_services/api/views.py @@ -13,6 +13,15 @@ from .. import models from . import serializers +# On python < 3.7 dt.fromisoformat does not exist. +# Instead get it from backports.datetime_fromisoformat +try: + dt.date.fromisoformat("2022-01-01") +except AttributeError: + import backports.datetime_fromisoformat + + backports.datetime_fromisoformat.MonkeyPatch.patch_fromisoformat() + class ServicesViewSet( jasmin_django_utils.api.viewsets.ActionSerializerMixin, diff --git a/poetry.lock b/poetry.lock index ce9b848..b279a91 100644 --- a/poetry.lock +++ b/poetry.lock @@ -34,6 +34,14 @@ docs = ["furo", "sphinx", "zope.interface", "sphinx-notfound-page"] tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "cloudpickle"] tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "cloudpickle"] +[[package]] +name = "backports-datetime-fromisoformat" +version = "1.0.0" +description = "Backport of Python 3.7's datetime.fromisoformat" +category = "main" +optional = false +python-versions = "*" + [[package]] name = "backports.zoneinfo" version = "0.2.1" @@ -954,7 +962,7 @@ tests = ["django-oauth-toolkit", "backports.zoneinfo"] [metadata] lock-version = "1.1" python-versions = "^3.6.8" -content-hash = "283f02e127841dd59dc9338898d8f0e5f207ba2020d0085e9b9306f729e1feab" +content-hash = "254fe28f0e9cfda7d053cbdb997da67f2cb078b7cf46a5a8169711ca90b7944a" [metadata.files] asgiref = [ @@ -969,6 +977,9 @@ attrs = [ {file = "attrs-21.4.0-py2.py3-none-any.whl", hash = "sha256:2d27e3784d7a565d36ab851fe94887c5eccd6a463168875832a1be79c82828b4"}, {file = "attrs-21.4.0.tar.gz", hash = "sha256:626ba8234211db98e869df76230a137c4c40a12d72445c45d5f5b716f076e2fd"}, ] +backports-datetime-fromisoformat = [ + {file = "backports-datetime-fromisoformat-1.0.0.tar.gz", hash = "sha256:9577a2a9486cd7383a5f58b23bb8e81cf0821dbbc0eb7c87d3fa198c1df40f5c"}, +] "backports.zoneinfo" = [ {file = "backports.zoneinfo-0.2.1-cp36-cp36m-macosx_10_14_x86_64.whl", hash = "sha256:da6013fd84a690242c310d77ddb8441a559e9cb3d3d59ebac9aca1a57b2e18bc"}, {file = "backports.zoneinfo-0.2.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:89a48c0d158a3cc3f654da4c2de1ceba85263fafb861b98b59040a5086259722"}, diff --git a/pyproject.toml b/pyproject.toml index a5df0ec..cd15744 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "jasmin-services" -version = "1.1.6" +version = "1.1.7" description = "Django application for managing services, roles and access." authors = ["Matt Pryor "] license = "BSD-3-Clause" @@ -28,6 +28,7 @@ drf-spectacular = {version="^0.22.0", optional = true} drf-spectacular-sidecar = {version="^2022.4.1", optional = true} django-oauth-toolkit = {version = "^1.7.0", optional = true} "backports.zoneinfo" = {version = "^0.2.1", python = "<=3.8", optional = true} +backports-datetime-fromisoformat = {version = "^1.0.0", python = "<3.7"} [tool.poetry.extras] api = ["djangorestframework", "django-filter", "drf-spectacular", "drf-spectacular-sidecar"] diff --git a/requirements.txt b/requirements.txt index 3ecac0b..4e1eae7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,90 +1,30 @@ -asgiref==3.4.1; python_version >= "3.6" \ - --hash=sha256:ffc141aa908e6f175673e7b1b3b7af4fdb0ecb738fc5c8b88f69f055c2415214 \ - --hash=sha256:4ef1ab46b484e3c706329cedeff284a5d40824200638503f5768edb6de7d58e9 -beautifulsoup4==4.11.1; python_full_version >= "3.6.0" and python_version >= "3.6" \ - --hash=sha256:58d5c3d29f5a36ffeb94f02f0d786cd53014cf9b3b3951d42e0080d8a9498d30 \ - --hash=sha256:ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693 -certifi==2022.6.15; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6" \ - --hash=sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412 \ - --hash=sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d -charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3" \ - --hash=sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597 \ - --hash=sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df -django-bootstrap5==21.2; python_version >= "3.6" \ - --hash=sha256:a354789370593dbf3f7cb74c442f2bab231c2327bdf4349475eecebd79bc1025 \ - --hash=sha256:6cd338ac1efb50b451072ab3b25e29e5a5c8366ae734d8b9537015f7972194a9 -django-countries==7.3.2 \ - --hash=sha256:0df6d34193667c2343da8935cbfb8a2bd4fb0c97baf01ac10db4628ba1557a82 \ - --hash=sha256:27fc8a0f66a87c9d839493f3926b4e0f4dd873ef66465aa8cd3e953f99758cc9 -django-markdown-deux==1.0.5 \ - --hash=sha256:5b4a3cd9454af5b4cec0e19151b41d98d09400ddae0688afb81dbf62a4edafff -django-picklefield==3.1; python_version >= "3" \ - --hash=sha256:c786cbeda78d6def2b43bff4840d19787809c8909f7ad683961703060398d356 \ - --hash=sha256:d77c504df7311e8ec14e8b779f10ca6fec74de6c7f8e2c136e1ef60cf955125d -django-polymorphic==3.1.0 \ - --hash=sha256:d6955b5308bf6e41dcb22ba7c96f00b51dfa497a8a5ab1e9c06c7951bf417bf8 \ - --hash=sha256:08bc4f4f4a773a19b2deced5a56deddd1ef56ebd15207bf4052e2901c25ef57e -django==3.2.13; python_version >= "3.6" \ - --hash=sha256:b896ca61edc079eb6bbaa15cf6071eb69d6aac08cce5211583cfb41515644fdf \ - --hash=sha256:6d93497a0a9bf6ba0e0b1a29cccdc40efbfc76297255b1309b3a884a688ec4b6 -idna==3.3; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.5" \ - --hash=sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff \ - --hash=sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d -importlib-metadata==2.1.3; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version < "3.8" and python_version >= "3.6" and python_full_version >= "3.5.0" \ - --hash=sha256:52e65a0856f9ba7ea8f2c4ced253fb6c88d1a8c352cb1e916cff4eb17d5a693d \ - --hash=sha256:02a9f62b02e9b1cc43871809ef99947e8f5d94771392d666ada2cafc4cd09d4f +asgiref==3.4.1; python_version >= "3.6" +backports-datetime-fromisoformat==1.0.0; python_version < "3.7" +beautifulsoup4==4.11.1; python_full_version >= "3.6.0" and python_version >= "3.6" +certifi==2022.6.15; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.6" +charset-normalizer==2.0.12; python_full_version >= "3.6.0" and python_version >= "3" +django-bootstrap5==21.2; python_version >= "3.6" +django-countries==7.3.2 +django-markdown-deux==1.0.5 +django-picklefield==3.1; python_version >= "3" +django-polymorphic==3.1.0 +django==3.2.13; python_version >= "3.6" +idna==3.3; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version >= "3.5" +importlib-metadata==2.1.3; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version < "3.8" and python_version >= "3.6" and python_full_version >= "3.5.0" jasmin-django-utils @ git+https://github.com/cedadev/jasmin-django-utils.git@v1.0.6 jasmin-ldap @ git+https://github.com/cedadev/jasmin-ldap.git@v1.0.0 jasmin-ldap-django @ git+https://github.com/cedadev/jasmin-ldap-django.git@v1.0.1 jasmin-metadata @ git+https://github.com/cedadev/jasmin-metadata.git@v1.0.0 jasmin-notifications @ git+https://github.com/cedadev/jasmin-notifications.git@v1.0.0 -ldap3==2.9.1 \ - --hash=sha256:5ab7febc00689181375de40c396dcad4f2659cd260fc5e94c508b6d77c17e9d5 \ - --hash=sha256:2bc966556fc4d4fa9f445a1c31dc484ee81d44a51ab0e2d0fd05b62cac75daa6 \ - --hash=sha256:5869596fc4948797020d3f03b7939da938778a0f9e2009f7a072ccf92b8e8d70 \ - --hash=sha256:5630d1383e09ba94839e253e013f1aa1a2cf7a547628ba1265cb7b9a844b5687 \ - --hash=sha256:f3e7fc4718e3f09dda568b57100095e0ce58633bcabbed8667ce3f8fbaa4229f -markdown2==2.4.3; python_version >= "3.5" and python_version < "4" \ - --hash=sha256:f344d4adfba5d1de821f7850b36e3507f583468a7eb47e6fa191765ed0b9c66b \ - --hash=sha256:412520c7b6bba540c2c2067d6be3a523ab885703bf6a81d93963f848b55dfb9a -pyasn1==0.4.8 \ - --hash=sha256:fec3e9d8e36808a28efb59b489e4528c10ad0f480e57dcc32b4de5c9d8c9fdf3 \ - --hash=sha256:0458773cfe65b153891ac249bcf1b5f8f320b7c2ce462151f8fa74de8934becf \ - --hash=sha256:5c9414dcfede6e441f7e8f81b43b34e834731003427e5b09e4e00e3172a10f00 \ - --hash=sha256:6e7545f1a61025a4e58bb336952c5061697da694db1cae97b116e9c46abcf7c8 \ - --hash=sha256:39c7e2ec30515947ff4e87fb6f456dfc6e84857d34be479c9d4a4ba4bf46aa5d \ - --hash=sha256:78fa6da68ed2727915c4767bb386ab32cdba863caa7dbe473eaae45f9959da86 \ - --hash=sha256:08c3c53b75eaa48d71cf8c710312316392ed40899cb34710d092e96745a358b7 \ - --hash=sha256:03840c999ba71680a131cfaee6fab142e1ed9bbd9c693e285cc6aca0d555e576 \ - --hash=sha256:7ab8a544af125fb704feadb008c99a88805126fb525280b2270bb25cc1d78a12 \ - --hash=sha256:e89bf84b5437b532b0803ba5c9a5e054d21fec423a89952a74f87fa2c9b7bce2 \ - --hash=sha256:014c0e9976956a08139dc0712ae195324a75e142284d5f87f1a87ee1b068a359 \ - --hash=sha256:99fcc3c8d804d1bc6d9a099921e39d827026409a58f2a720dcdb89374ea0c776 \ - --hash=sha256:aef77c9fb94a3ac588e87841208bdec464471d9871bd5050a287cc9a475cd0ba -python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0") \ - --hash=sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86 \ - --hash=sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9 -pytz==2022.1; python_version >= "3.6" \ - --hash=sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c \ - --hash=sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7 -requests==2.27.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0") \ - --hash=sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d \ - --hash=sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61 -six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" \ - --hash=sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254 \ - --hash=sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926 -soupsieve==2.3.2.post1; python_full_version >= "3.6.0" and python_version >= "3.6" \ - --hash=sha256:3b2503d3c7084a42b1ebd08116e5f81aadfaea95863628c80a3b774a11b7c759 \ - --hash=sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d -sqlparse==0.4.2; python_version >= "3.6" \ - --hash=sha256:48719e356bb8b42991bdbb1e8b83223757b93789c00910a616a071910ca4a64d \ - --hash=sha256:0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae -typing-extensions==4.1.1; python_version < "3.8" and python_version >= "3.6" \ - --hash=sha256:21c85e0fe4b9a155d0799430b0ad741cdce7e359660ccbd8b530613e8df88ce2 \ - --hash=sha256:1a9462dcc3347a79b1f1c0271fbe79e844580bb598bafa1ed208b94da3cdcd42 -urllib3==1.26.9; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" \ - --hash=sha256:44ece4d53fb1706f667c9bd1c648f5469a2ec925fcf3a776667042d645472c14 \ - --hash=sha256:aabaf16477806a5e1dd19aa41f8c2b7950dd3c746362d7e3223dbe6de6ac448e -zipp==3.6.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version < "3.8" and python_version >= "3.6" and python_full_version >= "3.5.0" \ - --hash=sha256:9fe5ea21568a0a70e50f273397638d39b03353731e6cbbb3fd8502a33fec40bc \ - --hash=sha256:71c644c5369f4a6e07636f0aa966270449561fcea2e3d6747b8d23efaa9d7832 +ldap3==2.9.1 +markdown2==2.4.3; python_version >= "3.5" and python_version < "4" +pyasn1==0.4.8 +python-dateutil==2.8.2; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.3.0") +pytz==2022.1; python_version >= "3.6" +requests==2.27.1; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0") +six==1.16.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" +soupsieve==2.3.2.post1; python_full_version >= "3.6.0" and python_version >= "3.6" +sqlparse==0.4.2; python_version >= "3.6" +typing-extensions==4.1.1; python_version < "3.8" and python_version >= "3.6" +urllib3==1.26.9; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0" and python_version < "4" +zipp==3.6.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version < "3.8" and python_version >= "3.6" and python_full_version >= "3.5.0"