[Zope] strange script behaviour
J. Cameron Cooper
jccooper at jcameroncooper.com
Mon Jan 26 13:11:41 EST 2004
Marie Robichon wrote:
> Hi everyone,
>
> I have a script that loops thru' formulator and creates the insert sql
> string (with a view to creating the sqlMethod on the fly). When I
> come to multicheckbox fields I want enter the selected values into my
> db column by separating them with a semi-colon. However when I want
> to do this part of the script :
>
> if field.meta_type=='MultiCheckBoxField':
> sql=sql+"<dtml-in " + field.id + ">\n"
> sql=sql+"<dtml-var sequence-item>;"
> sql=sql+"</dtml-in>,"
>
> the '/' of the </dtml-in> prevents the string from being rendered
> properly and results in the following (and none of the line breaks
> appear):
>
> ....
> values (, , , , , , , , , , , , , , , , ;,, ;,, , , , , ;, ;,, , , , ,
> , , ;,, , , , , )
>
> However if I remove the '<' of the </dtml-in> and leave it '/dtml-in>,
> the string renders ok:
>
> ....
> values
> (<dtml-sqlvar nom type=string >,
> <dtml-in prestataire>
> <dtml-var sequence-item>;/dtml-in>,
>
> I don't understand at all since all I am doing is concatenating strings.
Are you viewing it in a browser only? It's possible that the browser is
seeing HTML-ish code and (properly) ignoring all the tags, as they mean
nothing to it. Try a "view source" and see if it's really being rendered
properly or not.
Otherwise, maybe you ran afoul of Python escaping rules (though I don't
see where.) Do some tests at the Python console to find out.
--jcc
--
"My point and period will be throughly wrought,
Or well or ill, as this day's battle's fought."
More information about the Zope
mailing list