mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-28 09:25:50 +00:00
Simplify XML query
This commit is contained in:
parent
51a8312f1e
commit
c1653937d1
1 changed files with 5 additions and 8 deletions
|
|
@ -129,10 +129,9 @@ class Discover(object):
|
|||
data=body, is_subpath=False)
|
||||
root = _parse_xml(response.content)
|
||||
|
||||
for element in root.iter('{*}current-user-principal'):
|
||||
for principal in element.iter(): # should be only one
|
||||
if principal.tag.endswith('href'):
|
||||
yield principal.text
|
||||
for principal in root.iter('{*}current-user-principal/{*}href'):
|
||||
# should be only one
|
||||
yield principal.text
|
||||
|
||||
def find_dav(self):
|
||||
return list(self._find_dav()) or ['']
|
||||
|
|
@ -172,10 +171,8 @@ class Discover(object):
|
|||
is_subpath=False)
|
||||
|
||||
root = etree.fromstring(response.content)
|
||||
for element in root.iter(self._homeset_tag):
|
||||
for homeset in element.iter():
|
||||
if homeset.tag.endswith('href'):
|
||||
yield homeset.text
|
||||
for homeset in root.iter(self._homeset_tag + '/{*}href'):
|
||||
yield homeset.text
|
||||
|
||||
def find_collections(self):
|
||||
for home in itertools.chain(self.find_homes(), ['']):
|
||||
|
|
|
|||
Loading…
Reference in a new issue