Skip to content

Commit

Permalink
ZO-4687: Make date_last_modified independent of DAV server
Browse files Browse the repository at this point in the history
  • Loading branch information
louika committed Feb 16, 2024
1 parent 76787d3 commit 4a7a133
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/docs/changelog/ZO-4687.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ZO-4687: Make date_last_modified independent of DAV server
6 changes: 6 additions & 0 deletions core/src/zeit/cms/checkout/manager.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import grokcore.component as grok
import pendulum
import zope.app.locking.interfaces
import zope.cachedescriptors.property
import zope.component
Expand Down Expand Up @@ -133,11 +134,13 @@ def checkin(self, event=True, semantic_change=None, ignore_conflicts=False, publ
self.context.uniqueId, 'Cannot checkin: %s' % reason
)
workingcopy = self.context.__parent__

sc = zeit.cms.content.interfaces.ISemanticChange(self.context)
if semantic_change is None:
semantic_change = sc.has_semantic_change
if semantic_change:
sc.update()

if event:
zope.event.notify(
zeit.cms.checkout.interfaces.BeforeCheckinEvent(
Expand All @@ -164,6 +167,9 @@ def checkin(self, event=True, semantic_change=None, ignore_conflicts=False, publ
else:
msg = _('Checked in')
zeit.objectlog.interfaces.ILog(added).log(msg)
dc = zope.dublincore.interfaces.IDCTimes(added)
if not publishing:
dc.modified = pendulum.now()
lockable = zope.app.locking.interfaces.ILockable(added, None)
# Since publishing starts and ends with its own lock()/unlock(), it
# would be premature to already unlock during the cycle() step.
Expand Down
7 changes: 6 additions & 1 deletion core/src/zeit/cms/content/dublincore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import pendulum
import zope.dublincore.interfaces

from zeit.cms.content.interfaces import WRITEABLE_LIVE
import zeit.cms.content.dav
import zeit.cms.interfaces
import zeit.cms.repository.interfaces
import zeit.cms.workingcopy.interfaces

Expand All @@ -15,7 +17,10 @@ class RepositoryDCTimes(zeit.cms.content.dav.DAVPropertiesAdapter):
zope.dublincore.interfaces.IDCTimes['created'], 'DAV:', 'creationdate'
)
modified = zeit.cms.content.dav.DAVProperty(
zope.dublincore.interfaces.IDCTimes['modified'], 'DAV:', 'getlastmodified'
zope.dublincore.interfaces.IDCTimes['modified'],
zeit.cms.interfaces.DOCUMENT_SCHEMA_NS,
'date-last-modified',
writeable=WRITEABLE_LIVE,
)


Expand Down

0 comments on commit 4a7a133

Please sign in to comment.