Fix sync state.
This commit is contained in:
parent
aeda06de59
commit
072feed372
1 changed files with 7 additions and 4 deletions
|
@ -251,7 +251,7 @@ class Collection(BaseCollection):
|
||||||
item_history = connection.execute(select_etag_stmt).one_or_none()
|
item_history = connection.execute(select_etag_stmt).one_or_none()
|
||||||
if item_history is not None:
|
if item_history is not None:
|
||||||
exists = True
|
exists = True
|
||||||
cache_etag = item_history.etag,
|
cache_etag = item_history.etag
|
||||||
history_etag = item_history.history_etag
|
history_etag = item_history.history_etag
|
||||||
else:
|
else:
|
||||||
exists = False
|
exists = False
|
||||||
|
@ -376,7 +376,7 @@ class Collection(BaseCollection):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
state_row = connection.execute(select_stmt).one_or_none()
|
state_row = connection.execute(select_stmt).one_or_none()
|
||||||
state = json.loads(state_row.state.decode()) if state_row is not None else {}
|
old_state = json.loads(state_row.state.decode()) if state_row is not None else {}
|
||||||
|
|
||||||
# store new state
|
# store new state
|
||||||
select_new_state = sa.select(
|
select_new_state = sa.select(
|
||||||
|
@ -416,7 +416,9 @@ class BdayCollection(Collection):
|
||||||
R_FMT = (
|
R_FMT = (
|
||||||
(re.compile('^[0-9]{8}$'), '%Y%m%d'),
|
(re.compile('^[0-9]{8}$'), '%Y%m%d'),
|
||||||
(re.compile('^--[0-9]{4}$'), '--%m%d'),
|
(re.compile('^--[0-9]{4}$'), '--%m%d'),
|
||||||
(re.compile('^[0-9]{4}-[0-9]{2}-[0-9]{2}$'), '%Y-%m-%d')
|
(re.compile('^[0-9]{4}-[0-9]{2}-[0-9]{2}$'), '%Y-%m-%d'),
|
||||||
|
(re.compile('^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$'), '%Y-%m-%dT%H:%M:%SZ'),
|
||||||
|
(re.compile('^[0-9]{4}[0-9]{2}[0-9]{2}T[0-9]{2}[0-9]{2}[0-9]{2}Z$'), '%Y%m%dT%H%M%SZ'),
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, storage: "Storage", id: uuid.UUID, path: str, birthday_source: uuid.UUID):
|
def __init__(self, storage: "Storage", id: uuid.UUID, path: str, birthday_source: uuid.UUID):
|
||||||
|
@ -444,6 +446,8 @@ class BdayCollection(Collection):
|
||||||
date = date.replace(year=datetime.datetime.now().year)
|
date = date.replace(year=datetime.datetime.now().year)
|
||||||
date_end = date + datetime.timedelta(days=1)
|
date_end = date + datetime.timedelta(days=1)
|
||||||
cal.add('vevent')
|
cal.add('vevent')
|
||||||
|
cal.vevent_list[-1].add('uid').value = o.uid.value
|
||||||
|
cal.vevent_list[-1].add('dtstamp').value = vobj_str2date(o.rev)
|
||||||
cal.vevent_list[-1].add('summary').value = name
|
cal.vevent_list[-1].add('summary').value = name
|
||||||
cal.vevent_list[-1].add('dtstart').value = date.date()
|
cal.vevent_list[-1].add('dtstart').value = date.date()
|
||||||
cal.vevent_list[-1].add('dtend').value = date_end.date()
|
cal.vevent_list[-1].add('dtend').value = date_end.date()
|
||||||
|
@ -454,7 +458,6 @@ class BdayCollection(Collection):
|
||||||
new_vobject = self._to_calendar_entry(item.vobject_item)
|
new_vobject = self._to_calendar_entry(item.vobject_item)
|
||||||
if new_vobject is None:
|
if new_vobject is None:
|
||||||
return None
|
return None
|
||||||
new_vobject.add('uid').value = item.uid
|
|
||||||
assert item.href is not None
|
assert item.href is not None
|
||||||
return radicale_item.Item(
|
return radicale_item.Item(
|
||||||
collection=self,
|
collection=self,
|
||||||
|
|
Loading…
Reference in a new issue