# HG changeset patch # User Thierry Florac # Date 1539962322 -7200 # Node ID 94a457eeaeaa7ef13fcedab00c8112b5bf394fd7 # Parent 209f64c845d37759ff15b776a554ccce9519da33 Updated TALES 'timestamp' extension to specify ISO output format as option diff -r 209f64c845d3 -r 94a457eeaeaa src/pyams_utils/date.py --- a/src/pyams_utils/date.py Thu Oct 18 14:12:11 2018 +0200 +++ b/src/pyams_utils/date.py Fri Oct 19 17:18:42 2018 +0200 @@ -258,11 +258,15 @@ A PyAMS TALES extension to get timestamp based on last context modification date. """ - def render(self, context=None): + def render(self, context=None, formatting=None): if context is None: context = self.request.context + if formatting == 'iso': + format_func = datetime.isoformat + else: + format_func = datetime.timestamp dc = IZopeDublinCore(context, None) if dc is None: - return datetime.utcnow().timestamp() + return format_func(datetime.utcnow()) else: - return dc.modified.timestamp() + return format_func(dc.modified)