Don't serialize collection for etag
This commit is contained in:
parent
95380c5ce7
commit
debba3c7a1
@ -445,7 +445,10 @@ class BaseCollection:
|
|||||||
@property
|
@property
|
||||||
def etag(self):
|
def etag(self):
|
||||||
"""Encoded as quoted-string (see RFC 2616)."""
|
"""Encoded as quoted-string (see RFC 2616)."""
|
||||||
return get_etag(self.serialize())
|
etag = md5()
|
||||||
|
for item in self.get_all():
|
||||||
|
etag.update((item.href + "/" + item.etag).encode("utf-8"))
|
||||||
|
return '"%s"' % etag.hexdigest()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create_collection(cls, href, collection=None, props=None):
|
def create_collection(cls, href, collection=None, props=None):
|
||||||
@ -1328,10 +1331,7 @@ class Collection(BaseCollection):
|
|||||||
def etag(self):
|
def etag(self):
|
||||||
# reuse cached value if the storage is read-only
|
# reuse cached value if the storage is read-only
|
||||||
if self._writer or self._etag_cache is None:
|
if self._writer or self._etag_cache is None:
|
||||||
etag = md5()
|
self._etag_cache = super().etag
|
||||||
for item in self.get_all():
|
|
||||||
etag.update((item.href + "/" + item.etag).encode("utf-8"))
|
|
||||||
self._etag_cache = '"%s"' % etag.hexdigest()
|
|
||||||
return self._etag_cache
|
return self._etag_cache
|
||||||
|
|
||||||
_lock = threading.Lock()
|
_lock = threading.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user