Skip to content

Commit

Permalink
* Minor fixes in documentation, examples and CHANGELOG was out of sync
Browse files Browse the repository at this point in the history
* Completing a recurring task having a naïve or floating DTSTART would cause a runtime error
  • Loading branch information
tobixen committed Oct 1, 2023
1 parent 5ec1a1a commit 7b511f0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,17 @@ This project should more or less adhere to [Semantic Versioning](https://semver.

## [unreleased]

Very minor bugfixes
Some bugfixes

### Fixes

* Some parts of the library would throw OverflowError on very weird dates/timestamps. Now those are converted to the minimum or maximum accepted date/timestamp. Credits to github user @tamarinvs19 in https://github.com/python-caldav/caldav/pull/327
* `DAVResponse.davclient` was always set to None, now it may be set to the `DAVClient` instance. Credits to github user @sobolevn in https://github.com/python-caldav/caldav/pull/323
* `DAVResponse.davclient` was always set to None, now it may be set to the `DAVClient` instance. Credits to github user @sobolevn in https://github.com/python-caldav/caldav/pull/323
* `examples/sync_examples.py`, the sync token needs to be saved to the database (credits to Savvas Giannoukas)
* bugfixes in `set_relations`, credits to github user @Zocker1999NET in https://github.com/python-caldav/caldav/pull/335 and https://github.com/python-caldav/caldav/pull/333
* dates that are off the scale are converted to `min_date` and `max_date` (and logging en error) rather than throwing OverflowError, credits to github user @tamarinvs19 in https://github.com/python-caldav/caldav/pull/327
* completing a recurring task with a naïve or floating `DTSTART` would cause a runtime error

## [1.3.6] - 2023-07-20

Expand Down
7 changes: 7 additions & 0 deletions caldav/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -2580,6 +2580,13 @@ def _next(self, ts=None, i=None, dtstart=None, rrule=None, by=None, no_count=Tru
dtstart = ts or datetime.now()
else:
dtstart = ts or datetime.now() - self._get_duration(i)
## dtstart should be compared to the completion timestamp, which
## is set in UTC in the complete() method. However, dtstart
## may be a naïve or a floating timestamp
## (TODO: what if it's a date?)
## (TODO: we need test code for those corner cases!)
if hasattr(dtstart, "astimezone"):
dtstart = dtstart.astimezone(timezone.utc)
if not ts:
ts = dtstart
## Counting is taken care of other places
Expand Down
6 changes: 2 additions & 4 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ until it's tested.
Python2 has been unlikely to work for some time due to lack of testing
and due to dependencies on other libraries that doesn't support
python2. Python2 is officially not supported starting from version
1.0 - however, code for supporting python2 will only be cleaned
properly away in version 1.1 (and may be postponed if anyone
protests).
1.0.

Please report issues if you have problems running the caldav library
with old python versions. If it's easy to find a work-around I will
Expand Down Expand Up @@ -374,7 +372,7 @@ Here are some known issues:

* radicale will auto-create a calendar if one tries to access a calendar that does not exist. The normal method of accessing a list of the calendars owned by the user seems to fail.

Some notes on Caldav URLs
Some notes on CalDAV URLs
=========================

CalDAV URLs can be quite confusing, some software requires the URL to the calendar, other requires the URL to the principal. The Python CalDAV library does support accessing calendars and principals using such URLs, but the recommended practice is to configure up the CalDAV root URL and tell the library to find the principal and calendars from that. Typical examples of CalDAV URLs:
Expand Down
2 changes: 2 additions & 0 deletions examples/sync_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
delete_event_from_database(event)
else:
update_event_in_database(event)
save_sync_token_to_database(my_updated_events.sync_token)

## USE CASE #2, approach #2, using my_events.sync(). Ref
## https://github.com/python-caldav/caldav/issues/122 this may be
Expand All @@ -50,6 +51,7 @@
update_event_in_database(event)
for event in deleted:
delete_event_in_database(event)
save_sync_token_to_database(my_events.sync_token)

## ... but the approach above gets a bit tricky when the server is
## rebooted/restarted. It may be possible to save the etags in the
Expand Down

0 comments on commit 7b511f0

Please sign in to comment.