Skip to content

Commit 4f9b489

Browse files
committed
I've grepped for "deprecated" and "legacy" and looked through most of it.
Some of the stuff will be allowed to remain. `calendar.build_date_search_query` was ripped out, despite a lack of proper deprecation notice. `calendar.date_search` is probably used by many, it now has a dprecation notice.
1 parent a79def8 commit 4f9b489

2 files changed

Lines changed: 12 additions & 43 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ This project should adhere to [Semantic Versioning](https://semver.org/spec/v2.0
1010

1111
### Deprecated
1212

13-
* The `event.instance` property currently yields a vobject. For quite many years people have asked for the python vobject library to be replaced with the python icalendar objects, but I haven't been able to do that due to backward compatibility. In version 2.0 deprecation warnings will be given whenever someone uses the `event.instance` property. In 3.0, `event.instance` will yield a `icalendar` instance.
13+
* The `event.instance` property currently yields a vobject. For quite many years people have asked for the python vobject library to be replaced with the python icalendar objects, but I haven't been able to do that due to backward compatibility. In version 2.0 deprecation warnings will be given whenever someone uses the `event.instance` property. In 3.0, perhaps `event.instance` will yield a `icalendar` instance.
14+
* `calendar.date_search` - use `calendar.search` instead. (this one has been deprecated for a while, but only with info-logging)
1415

1516
### Added
1617

@@ -22,9 +23,11 @@ This project should adhere to [Semantic Versioning](https://semver.org/spec/v2.0
2223

2324
### Removed
2425

25-
2* Support for python 3.7 and 3.8
26+
If you disagree with any of this, please raise an issue and I'll consider if it's possible to revert the change.
2627

28+
* Support for python 3.7 and 3.8
2729
* Dependency on the requests library.
30+
* The `calendar.build_date_search_query` was ripped out. (it was deprecated for a while, but only with info-logging - however, this was an obscure internal method, probably not used by anyone?)
2831

2932
## [1.6.0] - 2025-05-30
3033

caldav/collection.py

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import logging
1313
import sys
1414
import uuid
15+
import warnings
1516
from datetime import datetime
1617
from typing import Any
1718
from typing import List
@@ -616,42 +617,6 @@ def calendar_multiget(self, *largs, **kwargs):
616617
"""
617618
return list(self.multiget(*largs, **kwargs))
618619

619-
## TODO: Upgrade the warning to an error (and perhaps critical) in future
620-
## releases, and then finally remove this method completely.
621-
def build_date_search_query(
622-
self,
623-
start,
624-
end: Optional[datetime] = None,
625-
compfilter: Optional[Literal["VEVENT"]] = "VEVENT",
626-
expand: Union[bool, Literal["maybe"]] = "maybe",
627-
):
628-
"""
629-
WARNING: DEPRECATED
630-
"""
631-
## This is dead code. It has no tests. It was made for usage
632-
## by the date_search method, but I've decided not to use it
633-
## there anymore. Most likely nobody is using this, as it's
634-
## sort of an internal method - but for the sake of backward
635-
## compatibility I will keep it for a while. I regret naming
636-
## it build_date_search_query rather than
637-
## _build_date_search_query...
638-
logging.warning(
639-
"DEPRECATION WARNING: The calendar.build_date_search_query method will be removed in caldav library from version 1.0 or perhaps earlier. Use calendar.build_search_xml_query instead."
640-
)
641-
if expand == "maybe":
642-
expand = end
643-
644-
if compfilter == "VEVENT":
645-
comp_class = Event
646-
elif compfilter == "VTODO":
647-
comp_class = Todo
648-
else:
649-
comp_class = None
650-
651-
return self.build_search_xml_query(
652-
comp_class=comp_class, expand=expand, start=start, end=end
653-
)
654-
655620
def date_search(
656621
self,
657622
start: datetime,
@@ -681,9 +646,11 @@ def date_search(
681646
* [CalendarObjectResource(), ...]
682647
683648
"""
684-
## TODO: upgrade to warning and error before removing this method
685-
logging.info(
686-
"DEPRECATION NOTICE: The calendar.date_search method may be removed in release 2.0 of the caldav library. Use calendar.search instead"
649+
## date_search will probably disappear in 3.0
650+
warnings.warn(
651+
"use `calendar.search rather than `calendar.date_search`",
652+
DeprecationWarning,
653+
stacklevel=2,
687654
)
688655

689656
if verify_expand:
@@ -791,8 +758,7 @@ def search(
791758
LEGACY WARNING: the expand attribute currently takes four
792759
possible values - True, False, server and client. The two
793760
latter value were hastily added just prior to launching
794-
version 1.4, the API may be reconsidered and changed without
795-
notice when launching version 2.0
761+
version 1.4, the API may be reconsidered at some point.
796762
797763
Parameters supported:
798764

0 commit comments

Comments
 (0)