Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML export of TextLine field that has List or Dict stored in it can't be reimorted #31

Open
djay opened this issue Nov 12, 2019 · 0 comments

Comments

@djay
Copy link
Member

djay commented Nov 12, 2019

It's not clear if this is a bug in supermodel or querywidget but there are places in plone where Lists are stored in TextLine fields and plone allows this. This creates a problem for supermodel import/export because it converts based on the schema not the object stored.

you can see an exmaple in plone/plone.formwidget.querystring#21

One possible solution is to export based on the object stored not the schema and import based on the XML rather the schema. So a List stored in the TextLine will be exported as a List not as its python string representation. During import it will be stored as a List despite the schema saying it expects a string.

However this will only work for certain types since the current format doesn't store type. For example there is no way to tell the difference between a list of ints vis a list of strings. or a list vs a set if the schema is being ignored. So to make it work robustly you'd likely need to store the field type in the XML or use json encoding, at least in cases the schema is being ignored

@djay djay changed the title types are converted to string if TextLine used XML export of TextLine field that has List or Dict stored in it can't be reimorted Nov 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants