Include VObject version in item cache hash
This commit is contained in:
parent
df5565f237
commit
98caa88a25
@ -43,6 +43,7 @@ from itertools import chain, groupby
|
|||||||
from random import getrandbits
|
from random import getrandbits
|
||||||
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
from tempfile import NamedTemporaryFile, TemporaryDirectory
|
||||||
|
|
||||||
|
import pkg_resources
|
||||||
import vobject
|
import vobject
|
||||||
|
|
||||||
if sys.version_info >= (3, 5):
|
if sys.version_info >= (3, 5):
|
||||||
@ -544,6 +545,8 @@ class BaseCollection:
|
|||||||
class Collection(BaseCollection):
|
class Collection(BaseCollection):
|
||||||
"""Collection stored in several files per calendar."""
|
"""Collection stored in several files per calendar."""
|
||||||
|
|
||||||
|
_item_cache_tag = None
|
||||||
|
|
||||||
def __init__(self, path, principal=None, folder=None):
|
def __init__(self, path, principal=None, folder=None):
|
||||||
# DEPRECATED: Remove useless principal attribute
|
# DEPRECATED: Remove useless principal attribute
|
||||||
if folder is None:
|
if folder is None:
|
||||||
@ -560,6 +563,15 @@ class Collection(BaseCollection):
|
|||||||
self.is_principal = principal
|
self.is_principal = principal
|
||||||
self._meta_cache = None
|
self._meta_cache = None
|
||||||
self._etag_cache = None
|
self._etag_cache = None
|
||||||
|
if self._item_cache_tag is None:
|
||||||
|
try:
|
||||||
|
vobject_version = pkg_resources.require("vobject")[0].version
|
||||||
|
self.logger.debug("VObject version: %r", vobject_version)
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.warning(
|
||||||
|
"VObject version not found: %s", e, exc_info=True)
|
||||||
|
vobject_version = ""
|
||||||
|
Collection._item_cache_tag = vobject_version.encode() + b"\0"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def _get_collection_root_folder(cls):
|
def _get_collection_root_folder(cls):
|
||||||
@ -1015,6 +1027,7 @@ class Collection(BaseCollection):
|
|||||||
# The hash of the component in the file system. This is used to check,
|
# The hash of the component in the file system. This is used to check,
|
||||||
# if the entry in the cache is still valid.
|
# if the entry in the cache is still valid.
|
||||||
input_hash = md5()
|
input_hash = md5()
|
||||||
|
input_hash.update(self._item_cache_tag)
|
||||||
input_hash.update(btext)
|
input_hash.update(btext)
|
||||||
input_hash = input_hash.hexdigest()
|
input_hash = input_hash.hexdigest()
|
||||||
cache_folder = os.path.join(self._filesystem_path, ".Radicale.cache",
|
cache_folder = os.path.join(self._filesystem_path, ".Radicale.cache",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user