collective.exportimport
collective.exportimport copied to clipboard
On import ModifiedDate datestring its timezone is not recognised
Copying this issue from what I wrote on community.plone.org to keep the list of possible switched/fixes central on github.
While importing an exported contenttype from Plone 4/AT to Plone 5.2 DX, the import routine gives a traceback on:
https://github.com/collective/collective.exportimport/blob/6e36de1702508486c76f479d887c368042acb0e1/src/collective/exportimport/import_content.py#L215
The problem is the timezone part of the date string the exported modified date is u'2011-10-13T13:49:57+01:00' with a : separator in the timezone. strptime on Python 3 expects 0100. My work around so far has been simple and is on https://github.com/collective/collective.exportimport/tree/modified_date_parser . Use dateutil to parse the string on import.
However:
- dateutil its parser is advanced magic, you can't/don't even pass a format string.
- Should we maybe fix this on export of Archetypes content instead of enhancing the import
- Are there maybe other small deviations in the date export and is it depended on locale or just a difference between AT/DX serialisers?
If this is specific to AT, this fix could be added/combined with other small tweaks to make the AT export more compatible with DX import and put behind a checkbox/switch as discussed in #7.