Re: listfield in code source
Andy Altepeter <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Organization | Bethel University |
| Message-ID | <[email protected]> |
After further digging, I the cause of the '\n' stripping in code sources is in
SilvaDocument/transform/ObjectParser.py.
In parse(self, source, fix), if the type is not unicode the string is parsed
into a dom using xml.dom.minidom.
Apparrently, minidom does not support newlines in attributes. This can be
tested using the following simple script:
import xml.dom.minidom
document = """\
<text attr1="link
link2">blah
</text>
"""
dom = xml.dom.minidom.parseString(document)
print dom.documentElement.getAttribute('attr1')
At this point I'm at a loss about where to go from here. I don't think there
is anything I can do about this.
Is there any other way I could get a list of lines from a code source in kupu?
Thanks,
Andy
On Friday 03 February 2006 9:24 am, Andy Altepeter wrote:
> Hi,
>
> I have a list field in an external source that requires newlines to be
> present (each line is a separate item). In the forms-based editor,
> newlines are retained when the source is saved. However in kupu, the
> newlines are stripped, which breaks this code source.
>
> Is there any way to work around this? I could probably detect where the
> newlines are "supposed" to be, and insert them on save, but how do I do
> this? Is it possible to use an external validator method in formulator to
> change the value of a field before it is saved?
>
> I could put the newline detection in the rendering script, but then the
> list field in kupu would show one long line instead of multiple items.
>
> I have tried using a multi list field as well, but it behaves in the same
> manner.
>
> Thanks for the assistance,
> Andy
> _______________________________________________
> silva-dev mailing list
> [email protected]
> https://infrae.com/mailman/listinfo/silva-dev