Saturday, April 5, 2014

Using caldav 0.2.1 with owncloud DAV services

New version caldav libraries was released recently. It didn't work from the scratch with my owncloud CalDAV. This post shows what I have changed to get it work.
For installation follow my original post.

After installation, you need to change owcal python script and one library. Following code sections show patches in files:

owcal
--- owcal.old   2014-04-05 20:14:47.265281297 +0200
+++ owcal.new   2014-04-05 20:14:20.681836628 +0200
@@ -41,7 +41,7 @@
 #connect to the calendar
 def connect():
        client = caldav.DAVClient(url)
-       principal = caldav.Principal(client, url)
+       principal = caldav.Principal(client)
        calendars = principal.calendars()
        if len(calendars) > 0:
                return (calendars[0], client)

/usr/lib/python2.7/site-packages/caldav-0.2.1-py2.7.egg/caldav/davclient.py
--- davclient.py.old   2014-04-05 20:06:54.039965279 +0200
+++ davclient.py.new        2014-04-05 20:11:35.604478480 +0200
@@ -81,6 +81,9 @@
         # direct, https
         # TODO: we shouldn't use SSL on http://weird.server.example.com:443/
         elif self.url.port == 443 or self.url.scheme == 'https':
+            # krisko: if objectified URL has port None, set it to 443 (https)
+            if self.url.port is None:
+                self.url.port = "443"
             self.handle = httplib.HTTPSConnection(self.url.hostname,
                                                   self.url.port)
         # direct, http

No comments:

Post a Comment