I have registered a behavior which adds a field to my content.
contentmodified = schema.Datetime(
title=_(u'label_contentmodified_date', u'Content Date'),
description=_(
u'help_contentmodified_date',
default=u'This represents the date that the actual content was modified.'
u'Actual content is distinguished by being an update on the default fieldset.'),
required=False
)
It gets assigned like so:
class ContentModification(MetadataBase):
def _get_content_last_modified(self):
return self.context.contentmodified
def _set_content_last_modified(self, value):
self.context.contentmodified = value
contentmodified = property(_get_content_last_modified, _set_content_last_modified)
When I go to assigned it after adapting,
modification_adapter = IContentModification(content, None)
if modification_adapter is not None:
modification_adapter.contentmodified = old_date.asdatetime()
where old_date is a Zope 2 DateTime object, I get the following error:
UnknownTimeZoneError: (UnknownTimeZoneError('GMT-4',), <function _p at 0x23a2e60>, ('GMT-4',))
I have done some searching on the error and found that there is some issue in the pytz package where it may not produce the right outcome when the timezone is formatted as 'GMT-4' rather than 'Etc/GMT-4', but I updated the date directly and still get this error.
I am populating it from an object which I printed out and know is correct:
DateTime('2016/09/28 11:01:6.178786 Etc/GMT-4')
Does anyone know what could be the issue?