Skip to content

Quotes in validators break the xml schema-editor with XMLSyntaxError #366

@pbauer

Description

@pbauer

When I add a simple validator to a field in python with quotes:

python: "quote" == True

The validator works but when I then open, edit and save the xml-Schema (using fields/@@modeleditor) the xml is invalid and cannot be saved because the double quotes in the validator close the ones in the xml-schema:

<model xmlns:i18n="http://xml.zope.org/namespaces/i18n" xmlns:marshal="http://namespaces.plone.org/supermodel/marshal" xmlns:form="http://namespaces.plone.org/supermodel/form" xmlns:security="http://namespaces.plone.org/supermodel/security" xmlns:indexer="http://namespaces.plone.org/supermodel/indexer" xmlns:lingua="http://namespaces.plone.org/supermodel/lingua" xmlns:users="http://namespaces.plone.org/supermodel/users" xmlns:easyform="http://namespaces.plone.org/supermodel/easyform" xmlns="http://namespaces.plone.org/supermodel/schema">
  <schema>
    <field name="smailnr" type="zope.schema.TextLine" easyform:TValidator="python: "quote" == True" easyform:serverSide="False" easyform:THidden="False">
      <description/>
      <required>False</required>
      <title>Test</title>
    </field>
  </schema>
</model>

That leads to

XMLSyntaxError: attributes construct error, line 3, column 85

Single quotes work obviously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions