[Python-apps-commits] r14573 - in packages/vdirsyncer/branches/debian/stretch/debian/patches (1 file)

fpytloun-guest at users.alioth.debian.org fpytloun-guest at users.alioth.debian.org
Tue Jan 16 15:04:48 UTC 2018


    Date: Tuesday, January 16, 2018 @ 15:04:40
  Author: fpytloun-guest
Revision: 14573

Add missing file

Added:
  packages/vdirsyncer/branches/debian/stretch/debian/patches/0005-Work-around-Google-Contacts-discovery-bug-564.patch

Added: packages/vdirsyncer/branches/debian/stretch/debian/patches/0005-Work-around-Google-Contacts-discovery-bug-564.patch
===================================================================
--- packages/vdirsyncer/branches/debian/stretch/debian/patches/0005-Work-around-Google-Contacts-discovery-bug-564.patch	                        (rev 0)
+++ packages/vdirsyncer/branches/debian/stretch/debian/patches/0005-Work-around-Google-Contacts-discovery-bug-564.patch	2018-01-16 15:04:40 UTC (rev 14573)
@@ -0,0 +1,71 @@
+From ac662b5c11223157e8a0df8988a1af63a0a4ce82 Mon Sep 17 00:00:00 2001
+From: Markus Unterwaditzer <markus at unterwaditzer.net>
+Date: Mon, 27 Feb 2017 16:06:28 +0100
+Subject: [PATCH] Work around Google Contacts discovery bug (#564)
+
+* Work around Google Contacts discovery bug
+
+* fixup
+
+* changelog
+---
+ vdirsyncer/storage/dav.py    | 20 ++++++++++++++++++--
+ vdirsyncer/storage/google.py |  4 ++++
+ 2 files changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/vdirsyncer/storage/dav.py b/vdirsyncer/storage/dav.py
+index 905c8d0..ed6dd61 100644
+--- a/vdirsyncer/storage/dav.py
++++ b/vdirsyncer/storage/dav.py
+@@ -201,6 +201,23 @@ class Discover(object):
+         dav_logger.debug('Given URL is not a homeset URL')
+         return self._find_collections_impl(self.find_home())
+ 
++    def _check_collection_resource_type(self, response):
++        if self._resourcetype is None:
++            return True
++
++        props = _merge_xml(response.findall(
++            '{DAV:}propstat/{DAV:}prop'
++        ))
++        if not props:
++            dav_logger.debug('Skipping, missing <prop>: %s', response)
++            return False
++        if props.find('{DAV:}resourcetype/' + self._resourcetype) \
++           is None:
++            dav_logger.debug('Skipping, not of resource type %s: %s',
++                             self._resourcetype, response)
++            return False
++        return True
++
+     def _find_collections_impl(self, url):
+         headers = self.session.get_default_headers()
+         headers['Depth'] = '1'
+@@ -209,8 +226,7 @@ class Discover(object):
+         root = _parse_xml(r.content)
+         done = set()
+         for response in root.findall('{DAV:}response'):
+-            props = _merge_xml(response.findall('{DAV:}propstat/{DAV:}prop'))
+-            if props.find('{DAV:}resourcetype/' + self._resourcetype) is None:
++            if not self._check_collection_resource_type(response):
+                 continue
+ 
+             href = response.find('{DAV:}href')
+diff --git a/vdirsyncer/storage/google.py b/vdirsyncer/storage/google.py
+index d6520cc..0dc1173 100644
+--- a/vdirsyncer/storage/google.py
++++ b/vdirsyncer/storage/google.py
+@@ -157,6 +157,10 @@ class GoogleContactsStorage(dav.CardDAVStorage):
+         url = 'https://www.googleapis.com/.well-known/carddav'
+         scope = ['https://www.googleapis.com/auth/carddav']
+ 
++    class discovery_class(dav.CardDAVStorage.discovery_class):
++        # Google CardDAV doesn't return any resourcetype prop.
++        _resourcetype = None
++
+     storage_name = 'google_contacts'
+ 
+     def __init__(self, token_file, client_id, client_secret, **kwargs):
+-- 
+2.14.2
+




More information about the Python-apps-commits mailing list