Re: supermodel + schemaeditor: trailing line field in Choice values entered

Steve McMahon <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <CAOqzbgiwgtu0BXMPw-Obfk6woELSfzFjguap28V98CdM57Kwjg@mail.gmail.com>
Choice 1 (schemaeditor strips) seems like the best of both worlds: it
avoids likely bad input from TTW users while allowing someone who's editing
XML to shoot themselves if they wish.


On Mon, Dec 23, 2013 at 10:15 AM, Sean Upton <[email protected]> wrote:

> On Mon, Dec 23, 2013 at 10:53 AM, Sean Upton <[email protected]> wrote:
> > Folks,
> >
> > plone.supermodel chokes parsing schema created by plone.schemaeditor
> > when Choice field is input with one or more trailing line feeds at the
> > end of the values.
> >
> > This leads to serialized XML that looks like:
> >
> >       <values>
> >         <element>A</element>
> >         <element>B</element>
> >         <element></element>
> >       </values>
> >
> > Attempting to parse this breaks every time on
> > ChoiceHandler._constructField() trying to deal with a NoneType value.
> > http://pastie.org/8571776
> >
> > Where should I look to fix this, in supermodel, schemaeditor, or both?
> >
> >   (1) schemaeditor should strip() the input.
> >
> >   (2) supermodel should, on export, omit blank terms.
> >
> >   (3) supermodel should, on import, ignore NoneType values
>
> Another wrinkle to #2/#3: IIRC, zope.schema vocabularies support empty
> strings as a valid term.  Not sure what to do with that, but err on
> the side of allowing it.  Instead of having the term parsed into a
> None value, parse it to ''?
>
> Sean
>
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics
> Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Plone-developers mailing list
> Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/plone-developers
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk

_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.