From 36d19f884c0fae5536c3437b663efb122b0ffc47 Mon Sep 17 00:00:00 2001 From: Luke Plant Date: Sat, 10 Feb 2024 20:40:15 +0000 Subject: [PATCH] Fixed crasher with Django 5.0 --- paypal/pro/helpers.py | 2 +- paypal/standard/forms.py | 2 +- paypal/standard/ipn/tests/test_ipn.py | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/paypal/pro/helpers.py b/paypal/pro/helpers.py index 02a5ec5..f60a6dc 100644 --- a/paypal/pro/helpers.py +++ b/paypal/pro/helpers.py @@ -47,7 +47,7 @@ def paypaltime2datetime(s): return naive else: # TIMESTAMP_FORMAT is UTC - return timezone.make_aware(naive, timezone.utc) + return timezone.make_aware(naive, timezone.timezone.utc) class PayPalError(TypeError): diff --git a/paypal/standard/forms.py b/paypal/standard/forms.py index 7e90712..b60eb61 100644 --- a/paypal/standard/forms.py +++ b/paypal/standard/forms.py @@ -89,7 +89,7 @@ def to_python(self, value): # PST/PDT is 'US/Pacific' dt = pytz.timezone("US/Pacific").localize(dt, is_dst=zone_part == "PDT") if not settings.USE_TZ: - dt = timezone.make_naive(dt, timezone=timezone.utc) + dt = timezone.make_naive(dt, timezone=timezone.timezone.utc) return dt diff --git a/paypal/standard/ipn/tests/test_ipn.py b/paypal/standard/ipn/tests/test_ipn.py index 7a9bbb3..bdf4705 100644 --- a/paypal/standard/ipn/tests/test_ipn.py +++ b/paypal/standard/ipn/tests/test_ipn.py @@ -1,13 +1,12 @@ import locale import unittest -from datetime import datetime +from datetime import datetime, timezone from decimal import Decimal from urllib.parse import urlencode from django.conf import settings from django.test import TestCase from django.test.utils import override_settings -from django.utils import timezone from paypal.standard.ipn.models import PayPalIPN from paypal.standard.ipn.signals import invalid_ipn_received, valid_ipn_received @@ -384,7 +383,6 @@ def test_postback(self): @override_settings(ROOT_URLCONF="paypal.standard.ipn.tests.test_urls") class IPNSimulatorTests(TestCase): - # Some requests, as sent by the simulator. # The simulator itself has bugs. For example, it doesn't send the 'charset'