You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Various unrelated work got a bit mixed up here:
* Work on finding and parsing a config file, including some test code and documentation. Fixes#485
* Brushing up the examples. Fixing test code for some examples. Adding more information on the examples in the documentation. Ref Road Map at #474
* Old test code utilizing vobjects has been rewritten from `obj.instance` to `obj.vobject_instance` to reduce the number of deprecation warnings when running tests
#507
Copy file name to clipboardExpand all lines: CHANGELOG.md
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,25 @@ This project should adhere to [Semantic Versioning](https://semver.org/spec/v2.0
10
10
11
11
### Deprecated
12
12
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.
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. Old test code has been updated to use `.vobject_instance` instead of `.instance`.
14
14
*`calendar.date_search` - use `calendar.search` instead. (this one has been deprecated for a while, but only with info-logging)
15
15
*`davclient.auto_conn` that was introduced just some days ago has already been renamed to `davclient.get_davclient`.
16
16
17
17
### Added
18
18
19
19
*`event.component` is now an alias for `event.icalendar_component`.
20
-
*`get_davclient` (earlier called `auto_conn`) is more complete now - it could already read from test config, now it can read from environment (including environment variable for reading from test config and for locating the config file). While the `auto_conn` itself is tested in the functional tests, the code for reading the config file (and all the corner cases) is not tested. It's allowable with a yaml config file, but the yaml module is not included in the dependencies yet ... so late imports as for now. - https://github.com/python-caldav/caldav/pull/502 - https://github.com/python-caldav/caldav/issues/485
20
+
*`get_davclient` (earlier called `auto_conn`) is more complete now - https://github.com/python-caldav/caldav/pull/502 - https://github.com/python-caldav/caldav/issues/485 - https://github.com/python-caldav/caldav/pull/507
21
+
* It can read from environment (including environment variable for reading from test config and for locating the config file).
22
+
* It can read from a config file. New parameter `check_config_file`, defaults to true
23
+
* It will probe default locations for the config file (`~/.config/caldav/calendar.conf`, `~/.config/caldav/calendar.yaml`, `~/.config/caldav/calendar.json`, `~/.config/calendar.conf`, `/etc/calendar.conf`, `/etc/caldav/calendar.conf` as for now)
24
+
* Improved tests (but no test for inheritance yet).
25
+
* Documentation, linked up from the reference section of the doc.
26
+
* It's allowable with a yaml config file, but the yaml module is not included in the dependencies yet ... so late imports as for now, and the import is wrapped in a try/except-block
27
+
* Looked through and brushed up the examples, two of them are now executed by the unit tests. Added a doc section on the examples.
28
+
29
+
### Fixes
30
+
31
+
* Support for Lark/Feishu got broken in the 1.6-release. Issue found and fixed by Hongbin Yang (github user @zealseeker) in https://github.com/python-caldav/caldav/issues/505 and https://github.com/python-caldav/caldav/pull/506
Copy file name to clipboardExpand all lines: caldav/config.py
+29-8Lines changed: 29 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,6 @@
1
1
importjson
2
+
importlogging
3
+
importos
2
4
3
5
"""
4
6
This configuration parsing code was just copied from my plann library (and will be removed from there at some point in the future). It's lacking tests, documentation and ... generally just lacking.
The :class:`davclient.get_davclient` method (and perhaps in 2.1, also ``davclient.get_calendar``) can read from a config file. It will look for it in the following locations:
7
+
8
+
* ``$HOME/.config/caldav/calendar.conf``
9
+
* ``$HOME/.config/caldav/calendar.yaml``
10
+
* ``$HOME/.config/caldav/calendar.json``
11
+
* ``$HOME/.config/calendar.conf``
12
+
* ``/etc/calendar.conf``
13
+
14
+
The config file has to be valid json or yaml (support for toml and Apple pkl may be considered).
15
+
16
+
The config file is expected to be divided in sections, where each section can describe locations and credentials to a CalDAV server, a CalDAV calendar or a collection of calendars/servers. As of version 2.0, only the first is supported.
17
+
18
+
A config section can be given either through parameters to :class:`davclient.get_davclient` or by enviornment variable ``CALDAV_CONFIG_SECTION``. If no section is given, the ``default`` section is used.
19
+
20
+
Connection parameters
21
+
=====================
22
+
23
+
The section should contain configuration keys and values. All configuration keys starting with ``caldav_`` is considered to be connection parameters and is passed to the DAVClient object. Typically, ``caldav_url``, ``caldav_username`` and ``caldav_password`` should be passed.
24
+
25
+
Calendar parameters
26
+
===================
27
+
28
+
Not implemented yet.
29
+
30
+
Probably in version 2.1 or version 2.2, ``calendar_name``, ``calendar_id`` and ``calendar_url`` can be used to specify a calendar.
31
+
32
+
Inheritance and collections
33
+
===========================
34
+
35
+
A section may ``inherit`` another section. This may typically be used if having several sections in the config file corresponding to the same server/user but different calendars, or several sections corresponding to the same calendar server, but different users.
36
+
37
+
If a section ``contains`` different other sections, it's efficiently a collection of calendars. This is not relevant for 2.0 though.
0 commit comments