mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fix bug with combination of yield and return
Thanks van Rossum!
This commit is contained in:
parent
841318208d
commit
3aca7e247a
1 changed files with 11 additions and 12 deletions
|
|
@ -186,20 +186,19 @@ class Discover(object):
|
||||||
raise InvalidXMLResponse('Couldn\'t find home-set.')
|
raise InvalidXMLResponse('Couldn\'t find home-set.')
|
||||||
return urlparse.urljoin(response.url, rv.text)
|
return urlparse.urljoin(response.url, rv.text)
|
||||||
|
|
||||||
def find_collections(self, url=None):
|
def find_collections(self):
|
||||||
if url is None:
|
|
||||||
rv = None
|
rv = None
|
||||||
try:
|
try:
|
||||||
rv = list(self.find_collections(''))
|
rv = list(self._find_collections_impl(''))
|
||||||
except (HTTPError, exceptions.Error):
|
except (HTTPError, exceptions.Error):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if rv:
|
if rv:
|
||||||
yield from rv
|
return rv
|
||||||
return
|
|
||||||
dav_logger.debug('Given URL is not a homeset URL')
|
dav_logger.debug('Given URL is not a homeset URL')
|
||||||
return self.find_collections(self.find_home())
|
return self._find_collections_impl(self.find_home())
|
||||||
|
|
||||||
|
def _find_collections_impl(self, url):
|
||||||
headers = self.session.get_default_headers()
|
headers = self.session.get_default_headers()
|
||||||
headers['Depth'] = '1'
|
headers['Depth'] = '1'
|
||||||
r = self.session.request('PROPFIND', url, headers=headers,
|
r = self.session.request('PROPFIND', url, headers=headers,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue