objects – Object definitions

A “DAV object” is anything we get from the caldav server or push into the caldav server, notably principal, calendars and calendar events.

class caldav.objects.DAVObject(client=None, url=None, parent=None, name=None, id=None, **extra)

Base class for all DAV objects. Can be instantiated by a client and an absolute or relative URL, or from the parent object.

children(type=None)

List children, using a propfind (resourcetype) on the parent object, at depth = 1.

delete()

Delete the object.

get_properties(props=[], depth=0)

Get properties (PROPFIND) for this object. Works only for properties, that don’t have complex types.

Parameters:
  • props = [dav.ResourceType(), dav.DisplayName(), ...]
Returns:
  • {proptag: value, ...}
save()

Save the object. This is an abstract method, that all classes derived .from DAVObject implement.

Returns:
  • self
set_properties(props=[])

Set properties (PROPPATCH) for this object.

  • props = [dav.DisplayName(‘name’), ...]
Returns:
  • self
class caldav.objects.Principal(client=None, url=None)

This class represents a DAV Principal. It doesn’t do much, except keep track of the URLs for the calendar-home-set, etc.

calendar(name=None, cal_id=None)

The calendar method will return a calendar object. It will not initiate any communication with the server.

calendars()

Return the principials calendars

make_calendar(name=None, cal_id=None, supported_calendar_component_set=None)

Convenience method, bypasses the self.calendar_home_set object. See CalendarSet.make_calendar for details.

class caldav.objects.Calendar(client=None, url=None, parent=None, name=None, id=None, **extra)

The Calendar object is used to represent a calendar collection. Refer to the RFC for details: http://www.ietf.org/rfc/rfc4791.txt

add_event(ical)

Add a new event to the calendar, with the given ical.

Parameters:
  • ical - ical object (text)
add_journal(ical)

Add a new journal entry to the calendar, with the given ical.

Parameters:
  • ical - ical object (text)
add_todo(ical)

Add a new task to the calendar, with the given ical.

Parameters:
  • ical - ical object (text)

Search events by date in the calendar. Recurring events are expanded if they are occuring during the specified time frame and if an end timestamp is given.

Parameters:
  • start = datetime.today().
  • end = same as above.
  • compfilter = defaults to events only. Set to None to fetch all calendar components.
Returns:
  • [CalendarObjectResource(), ...]
event_by_url(href, data=None)

Returns the event with the given URL

events()

List all events from the calendar.

Returns:
  • [Event(), ...]
freebusy_request(start, end)

Search the calendar, but return only the free/busy information.

Parameters:
  • start = datetime.today().
  • end = same as above.
Returns:
  • [FreeBusy(), ...]
journals()

List all journals from the calendar.

Returns:
  • [Journal(), ...]
object_by_uid(uid, comp_filter=None)

Get one event from the calendar.

Parameters:
  • uid: the event uid
Returns:
  • Event() or None
save()

The save method for a calendar is only used to create it, for now. We know we have to create it when we don’t have a url.

Returns:
  • self
todos(sort_keys=('due', 'priority'), include_completed=False, sort_key=None)

fetches a list of todo events.

Parameters:
  • sort_keys: use this field in the VTODO for sorting (iterable of lower case string, i.e. (‘priority’,’due’)).
  • include_completed: boolean - by default, only pending tasks are listed
  • sort_key: DEPRECATED, for backwards compatibility with version 0.4.
class caldav.objects.Event(client=None, url=None, data=None, parent=None, id=None)

The Event object is used to represent an event (VEVENT).