Skip to content

Commit

Permalink
date_search method is replaced (#236)
Browse files Browse the repository at this point in the history
* date_search is method replaced
  • Loading branch information
yeshwantthota authored Nov 29, 2022
1 parent 495a23b commit 1028f12
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
8 changes: 4 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ Do a date search in a calendar:
.. code-block:: python
events_fetched = my_new_calendar.date_search(
start=datetime(2021, 1, 1), end=datetime(2024, 1, 1), expand=True)
events_fetched = my_new_calendar.search(
start=datetime(2021, 1, 1), end=datetime(2024, 1, 1),event=True, expand=True)
To modify an event:
Expand Down Expand Up @@ -214,9 +214,9 @@ Date_search also works on task lists, but one has to be explicit to get the task
.. code-block:: python
todos = my_new_calendar.date_search(
todos = my_new_calendar.search(
start=datetime(2021, 1, 1), end=datetime(2024, 1, 1),
compfilter='VTODO', expand=True)
compfilter='VTODO',event=True, expand=True)
Mark a task as completed:
Expand Down
13 changes: 7 additions & 6 deletions examples/basic_usage_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@
## (this may fail if the server doesn't support expand)
print("Here is some icalendar data:")
try:
events_fetched = my_new_calendar.date_search(
start=datetime(2021, 5, 16), end=datetime(2024, 1, 1), expand=True
events_fetched = my_new_calendar.search(
start=datetime(2021, 5, 16), end=datetime(2024, 1, 1), event=True, expand=True
)
## Note: obj.data will always return a normal string, with normal line breaks
## obj.wire_data will return a byte string with CRLN
print(events_fetched[0].data)
except:
print("Your calendar server does apparently not support expanded search")
events_fetched = my_new_calendar.date_search(
start=datetime(2020, 5, 16), end=datetime(2024, 1, 1), expand=False
events_fetched = my_new_calendar.search(
start=datetime(2020, 5, 16), end=datetime(2024, 1, 1), event=True, expand=False
)
print(events_fetched[0].data)

Expand Down Expand Up @@ -158,10 +158,11 @@
print(todos[0].data)

## date_search also works on task lists, but one has to be explicit to get them
todos_found = my_new_tasklist.date_search(
todos_found = my_new_tasklist.search(
start=datetime(2021, 1, 1),
end=datetime(2024, 1, 1),
compfilter="VTODO",
todo=True,
journal=True,
expand=True,
)
if not todos_found:
Expand Down
11 changes: 0 additions & 11 deletions tests/test_caldav.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
Tests here communicate with third party servers and/or
internal ad-hoc instances of Xandikos and Radicale, dependent on the
configuration in conf_private.py.
Tests that do not require communication with a working caldav server
belong in test_caldav_unit.py
"""
Expand Down Expand Up @@ -338,9 +337,7 @@
)
class TestScheduling(object):
"""Testing support of RFC6638.
TODO: work in progress. Stalled a bit due to lack of proper testing accounts. I haven't managed to get this test to pass at any systems yet, but I believe the problem is not on the library side.
* icloud: cannot really test much with only one test account
available. I did some testing forth and back with emails sent
to an account on another service through the
Expand All @@ -350,14 +347,12 @@ class TestScheduling(object):
the external party having accepted the calendar invite.
FreeBusy doesn't work. I don't have capacity following up more
right now.
* DAViCal: I have only an old version to test with at the moment,
should look into that. I did manage to send and receive a
calendar invite, but apparently I did not manage to accept the
calendar invite. It should be looked more into. FreeBusy
doesn't work in the old version, probably it works in a newer
version.
* SOGo: Sending a calendar invite, but receiving nothing in the
CalDAV inbox. FreeBusy works somehow, but returns pure
iCalendar data and not XML, I believe that's not according to
Expand Down Expand Up @@ -457,17 +452,13 @@ class RepeatedFunctionalTestsBaseClass(object):
"""This is a class with functional tests (tests that goes through
basic functionality and actively communicates with third parties)
that we want to repeat for all configured caldav_servers.
(what a truely ugly name for this class - any better ideas?)
NOTE: this tests relies heavily on the assumption that we can create
calendars on the remote caldav server, but the RFC says ...
Support for MKCALENDAR on the server is only RECOMMENDED and not
REQUIRED because some calendar stores only support one calendar per
user (or principal), and those are typically pre-created for each
account.
We've had some problems with iCloud and Radicale earlier. Google
still does not support mkcalendar.
"""
Expand Down Expand Up @@ -790,7 +781,6 @@ def testCalendarByFullURL(self):
def testObjectBySyncToken(self):
"""
Support for sync-collection reports, ref https://github.com/python-caldav/caldav/issues/87.
This test is using explicit calls to objects_by_sync_token
"""
self.skip_on_compatibility_flag("no_sync_token")
Expand Down Expand Up @@ -919,7 +909,6 @@ def testObjectBySyncToken(self):
def testSync(self):
"""
Support for sync-collection reports, ref https://github.com/python-caldav/caldav/issues/87.
Same test pattern as testObjectBySyncToken, but exercises the .sync() method
"""
self.skip_on_compatibility_flag("no_sync_token")
Expand Down
1 change: 0 additions & 1 deletion tests/test_caldav_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
communication, and there should be no dependencies on a working caldav
server for the tests in this file. We use the Mock class when needed
to emulate server communication.
"""
import pickle
from datetime import date
Expand Down

0 comments on commit 1028f12

Please sign in to comment.