Re-3: [Zope] Problem with zope and long strings - SOS
jens.walte at kk.net
jens.walte at kk.net
Mon Aug 9 07:49:21 EDT 2004
Hi,
Zope/Python does not break long strings.
This little PythonScript show's it:
-----------------------------------------------
longstring = ""
x = "1234567890 "
for i in range(1000): longstring+=x
print """<script language="JavaScript">"""
print "alert('%s');" % longstring
print """</script>"""
return printed
-----------------------------------------------
But DTML produces many breaks..
It's nearly unpossible to produce fine DTML-sourcecode
without line breaks.
so use python! ;)
otherwise you can use a visible/hidden <div> to show your error-message.
regards
Jens Walte
-------- Original Message --------
Subject: Re: Re: [Zope] Problem with zope and long strings - SOS (09-Aug-2004 13:07)
From: fowlertrainer at anonym.hu
To: jw at obelix.bb.kk.net
> kepes.krisztian wrote at 2004-8-6 14:41 +0200:
>
> >>My problem is that:
> >>I want to js.alert with long strings.
> >>I create these strings, and the complete js code.
> >>But zope is wrapping my strings like that:
> >>
> >><script>
> >>function aaa{
> >>jscode...
> >>s="xxxxxxx ........
> >>";
> >>jscode...
> >>};
> >></script>
>
> >
> >Usually, Zope does not break lines even when they get long.
> >
> >Note, however, that in some cases you must prevent newlines
> >around DTML constructs as they may end up in the generated code.
> >You can do something like:
> >
> > <dtml-XXXX ...
> > ><dtml-YYYY...>
> >
> >I.e., you put the newline into the DTML construct.
> >The DTML parser does not allow newlines at all places
> >but before the ">" is at least possible.
>
> Sorry, but you are misundertanding me.
> My problem is that:
> I have a webpage that is show the data in table (grid).
> Every data that have error is get a sign with error message.
> Sometimes this message is more than 255 character, so the <img title> is
> cannot show all chars in message.
>
> This is cause that I need to show the error in other format. So I want to
> alert it with javascript (img onclick).
>
> And this time I crashed in zope's "string handling speciality":
>
> When I write this:
>
> jsscript="alert('a long string with many spaces');"
> context.page(param=jsscript)
>
> that zope is separate the lines in ending ' sign like that:
>
> jsscript=alert('a long string with many spaces
> ');
>
>
> In this time the js interpeter is makes errors.
>
> How to I prevent this "wrong working mode" of zope ?
>
> I'm not sure, but I think that short strings are showed/generated also like
>
> the example.
>
> The only solution that I find to I create hidden items without form, and
> the
> items are containing the long strings.
> The JS is get the item that I need, and get the .value, and show it with
> alert.
> But with zope js generating the zope is wrap the lines in ending ' sign.
>
> So that is the problem.
>
> Regards:
> FT
>
>
> _______________________________________________
> Zope maillist - Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
More information about the Zope
mailing list