diff --git a/docs/exchangelib/fields.html b/docs/exchangelib/fields.html index ac6784f7..4c364301 100644 --- a/docs/exchangelib/fields.html +++ b/docs/exchangelib/fields.html @@ -626,9 +626,10 @@

Module exchangelib.fields

def __init__(self, *args, **kwargs): # Not all fields assume a default time of 00:00, so make this configurable self._default_time = kwargs.pop("default_time", datetime.time(0, 0)) - super().__init__(*args, **kwargs) # Create internal field to handle datetime-only logic self._datetime_field = DateTimeField(*args, **kwargs) + kwargs.pop("allow_naive", None) + super().__init__(*args, **kwargs) def date_to_datetime(self, value): return self._datetime_field.value_cls.combine(value, self._default_time).replace(tzinfo=UTC) @@ -693,6 +694,10 @@

Module exchangelib.fields

value_cls = EWSDateTime + def __init__(self, *args, **kwargs): + self.allow_naive = kwargs.pop("allow_naive", False) + super().__init__(*args, **kwargs) + def clean(self, value, version=None): if isinstance(value, datetime.datetime): if not value.tzinfo: @@ -714,8 +719,10 @@

Module exchangelib.fields

tz = account.default_timezone log.info("Found naive datetime %s on field %s. Assuming timezone %s", e.local_dt, self.name, tz) return e.local_dt.replace(tzinfo=tz) - # There's nothing we can do but return the naive date. It's better than assuming e.g. UTC. - log.warning("Returning naive datetime %s on field %s", e.local_dt, self.name) + if not self.allow_naive: + # There's nothing we can do but return the naive date. It's better than assuming e.g. UTC. + # Making this a hard error is probably too risky. Warn instead. + log.warning("Returning naive datetime %s on field %s", e.local_dt, self.name) return e.local_dt log.info("Cannot convert value '%s' on field '%s' to type %s", val, self.name, self.value_cls) return None @@ -3063,9 +3070,10 @@

Inherited members

def __init__(self, *args, **kwargs): # Not all fields assume a default time of 00:00, so make this configurable self._default_time = kwargs.pop("default_time", datetime.time(0, 0)) - super().__init__(*args, **kwargs) # Create internal field to handle datetime-only logic self._datetime_field = DateTimeField(*args, **kwargs) + kwargs.pop("allow_naive", None) + super().__init__(*args, **kwargs) def date_to_datetime(self, value): return self._datetime_field.value_cls.combine(value, self._default_time).replace(tzinfo=UTC) @@ -3138,6 +3146,10 @@

Inherited members

value_cls = EWSDateTime + def __init__(self, *args, **kwargs): + self.allow_naive = kwargs.pop("allow_naive", False) + super().__init__(*args, **kwargs) + def clean(self, value, version=None): if isinstance(value, datetime.datetime): if not value.tzinfo: @@ -3159,8 +3171,10 @@

Inherited members

tz = account.default_timezone log.info("Found naive datetime %s on field %s. Assuming timezone %s", e.local_dt, self.name, tz) return e.local_dt.replace(tzinfo=tz) - # There's nothing we can do but return the naive date. It's better than assuming e.g. UTC. - log.warning("Returning naive datetime %s on field %s", e.local_dt, self.name) + if not self.allow_naive: + # There's nothing we can do but return the naive date. It's better than assuming e.g. UTC. + # Making this a hard error is probably too risky. Warn instead. + log.warning("Returning naive datetime %s on field %s", e.local_dt, self.name) return e.local_dt log.info("Cannot convert value '%s' on field '%s' to type %s", val, self.name, self.value_cls) return None diff --git a/docs/exchangelib/index.html b/docs/exchangelib/index.html index ce03f73f..c227954d 100644 --- a/docs/exchangelib/index.html +++ b/docs/exchangelib/index.html @@ -64,7 +64,7 @@

Package exchangelib

from .transport import BASIC, CBA, DIGEST, GSSAPI, NTLM, OAUTH2, SSPI from .version import Build, Version -__version__ = "5.4.1" +__version__ = "5.4.2" __all__ = [ "AcceptItem", @@ -9887,7 +9887,13 @@

Inherited members

def cert_verify(self, conn, url, verify, cert): # pylint: disable=unused-argument # We're overriding a method, so we have to keep the signature - super().cert_verify(conn=conn, url=url, verify=False, cert=cert) + super().cert_verify(conn=conn, url=url, verify=False, cert=cert) + + def get_connection_with_tls_context(self, request, verify, proxies=None, cert=None): + # pylint: disable=unused-argument + # Required for requests >= 2.32.3 + # See: https://github.com/psf/requests/pull/6710 + return super().get_connection_with_tls_context(request=request, verify=False, proxies=proxies, cert=cert)

Ancestors