Skip to content

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

@djay

Description

@djay

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions