Skip to content

Commit

Permalink
Merge 1133f7a into 16804ec
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Dec 2, 2016
2 parents 16804ec + 1133f7a commit b67844e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ There's a frood who really knows where his towel is.
1.3b2 (unreleased)
^^^^^^^^^^^^^^^^^^

- Use DateTime object instead of string of timestamp to represent image modified date (fixes `#686`_).
[rodfersou]

- Fixed adding a 'more' link in list tiles.
Previously you could select an item to use as 'more' link,
but it did not stick. [maurits]
Expand Down Expand Up @@ -157,3 +160,4 @@ Previous entries can be found in the HISTORY.rst file.
.. _`#608`: https://github.com/collective/collective.cover/issues/608
.. _`#641`: https://github.com/collective/collective.cover/issues/641
.. _`#651`: https://github.com/collective/collective.cover/issues/651
.. _`#686`: https://github.com/collective/collective.cover/issues/686
7 changes: 5 additions & 2 deletions src/collective/cover/browser/scaling.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from Acquisition import aq_base
from collective.cover.tiles.base import IPersistentCoverTile
from DateTime import DateTime
from persistent.dict import PersistentDict
from plone.app.uuid.utils import uuidToObject
from plone.namedfile.interfaces import INamedImage
Expand Down Expand Up @@ -158,10 +159,12 @@ def modified(self):
name='images',
default=None)
return base_scales and base_scales.modified()
mtime = ''
mtime = DateTime(0)
for k, v in self.context.data.items():
if INamedImage.providedBy(v):
mtime += self.context.data.get('{0}_mtime'.format(k), '')
image_time = self.context.data.get('{0}_mtime'.format(k), DateTime(0))
if image_time > mtime:
mtime = image_time

return mtime

Expand Down
8 changes: 3 additions & 5 deletions src/collective/cover/tiles/data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-

from collective.cover.tiles.base import IPersistentCoverTile
from DateTime import DateTime
from persistent.dict import PersistentDict
from plone.namedfile.interfaces import INamedImage
from plone.tiles.data import PersistentTileDataManager
Expand All @@ -10,8 +10,6 @@
from zope.lifecycleevent import ObjectModifiedEvent
from zope.schema import getFields

import time


@adapter(IPersistentCoverTile)
class PersistentCoverTileDataManager(PersistentTileDataManager):
Expand Down Expand Up @@ -52,9 +50,9 @@ def set(self, data):
data[k] != self.annotations[self.key][k])):
# set modification time of the image
notify(Purge(self.tile))
data[mtime_key] = repr(time.time())
data[mtime_key] = DateTime()
else:
data[mtime_key] = self.annotations[self.key].get(mtime_key, '')
data[mtime_key] = self.annotations[self.key].get(mtime_key, DateTime(0))

self.annotations[self.key] = PersistentDict(data)
notify(ObjectModifiedEvent(self.context))

0 comments on commit b67844e

Please sign in to comment.