mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Don't consume iterator twice
This commit is contained in:
parent
07de8a0cc4
commit
6fd5f0aaa9
1 changed files with 4 additions and 2 deletions
|
|
@ -301,8 +301,9 @@ class DavStorage(Storage):
|
||||||
return item, etag
|
return item, etag
|
||||||
|
|
||||||
def get_multi(self, hrefs):
|
def get_multi(self, hrefs):
|
||||||
|
hrefs = set(hrefs)
|
||||||
href_xml = []
|
href_xml = []
|
||||||
for href in uniq(hrefs):
|
for href in hrefs:
|
||||||
if href != self._normalize_href(href):
|
if href != self._normalize_href(href):
|
||||||
raise exceptions.NotFoundError(href)
|
raise exceptions.NotFoundError(href)
|
||||||
href_xml.append('<D:href>{}</D:href>'.format(href))
|
href_xml.append('<D:href>{}</D:href>'.format(href))
|
||||||
|
|
@ -334,7 +335,6 @@ class DavStorage(Storage):
|
||||||
raw = raw.decode(response.encoding)
|
raw = raw.decode(response.encoding)
|
||||||
if isinstance(etag, bytes):
|
if isinstance(etag, bytes):
|
||||||
etag = etag.decode(response.encoding)
|
etag = etag.decode(response.encoding)
|
||||||
rv.append((href, Item(raw), etag))
|
|
||||||
try:
|
try:
|
||||||
hrefs_left.remove(href)
|
hrefs_left.remove(href)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
@ -344,6 +344,8 @@ class DavStorage(Storage):
|
||||||
else:
|
else:
|
||||||
dav_logger.warning('Server sent unsolicited item: {}'
|
dav_logger.warning('Server sent unsolicited item: {}'
|
||||||
.format(href))
|
.format(href))
|
||||||
|
else:
|
||||||
|
rv.append((href, Item(raw), etag))
|
||||||
for href in hrefs_left:
|
for href in hrefs_left:
|
||||||
raise exceptions.NotFoundError(href)
|
raise exceptions.NotFoundError(href)
|
||||||
return rv
|
return rv
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue