Describe encoding of Etag
This commit is contained in:
parent
b85fc5bed6
commit
8d5f2ded42
@ -100,7 +100,11 @@ def load(configuration, logger):
|
|||||||
|
|
||||||
|
|
||||||
def get_etag(text):
|
def get_etag(text):
|
||||||
"""Etag from collection or item."""
|
"""Etag from collection or item.
|
||||||
|
|
||||||
|
Encoded as quoted-string (see RFC 2616).
|
||||||
|
|
||||||
|
"""
|
||||||
etag = md5()
|
etag = md5()
|
||||||
etag.update(text.encode("utf-8"))
|
etag.update(text.encode("utf-8"))
|
||||||
return '"%s"' % etag.hexdigest()
|
return '"%s"' % etag.hexdigest()
|
||||||
@ -205,6 +209,7 @@ class Item:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def etag(self):
|
def etag(self):
|
||||||
|
"""Encoded as quoted-string (see RFC 2616)."""
|
||||||
return get_etag(self.serialize())
|
return get_etag(self.serialize())
|
||||||
|
|
||||||
|
|
||||||
@ -262,6 +267,7 @@ class BaseCollection:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def etag(self):
|
def etag(self):
|
||||||
|
"""Encoded as quoted-string (see RFC 2616)."""
|
||||||
return get_etag(self.serialize())
|
return get_etag(self.serialize())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
Loading…
Reference in New Issue
Block a user