mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +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
|
||||
|
||||
def get_multi(self, hrefs):
|
||||
hrefs = set(hrefs)
|
||||
href_xml = []
|
||||
for href in uniq(hrefs):
|
||||
for href in hrefs:
|
||||
if href != self._normalize_href(href):
|
||||
raise exceptions.NotFoundError(href)
|
||||
href_xml.append('<D:href>{}</D:href>'.format(href))
|
||||
|
|
@ -334,7 +335,6 @@ class DavStorage(Storage):
|
|||
raw = raw.decode(response.encoding)
|
||||
if isinstance(etag, bytes):
|
||||
etag = etag.decode(response.encoding)
|
||||
rv.append((href, Item(raw), etag))
|
||||
try:
|
||||
hrefs_left.remove(href)
|
||||
except KeyError:
|
||||
|
|
@ -344,6 +344,8 @@ class DavStorage(Storage):
|
|||
else:
|
||||
dav_logger.warning('Server sent unsolicited item: {}'
|
||||
.format(href))
|
||||
else:
|
||||
rv.append((href, Item(raw), etag))
|
||||
for href in hrefs_left:
|
||||
raise exceptions.NotFoundError(href)
|
||||
return rv
|
||||
|
|
|
|||
Loading…
Reference in a new issue