collective / collective/collective.exportimport
On import ModifiedDate datestring its timezone is not recognised
- Dominant language
- Python
- Stars
- 19
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in src/collective/exportimport/import_content.py around line 215 and inspect the date handling for the exported value shown here. Compare the AT export behavior with the DX import path and review the modified_date_parser branch and issue #7. Done means agreeing on the affected scope and successfully importing the affected content without the timezone traceback.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100