Thanks, Anthony. Issue submitted.

On Sunday, May 17, 2015 at 10:21:31 PM UTC-5, Anthony wrote:
>
> The problem is that there is an inconsistency with the escaping of regular 
> strings vs. LazyT objects when serializing HTML helpers. When helpers are 
> serialized, all attribute values are passed to gluon.html.xmlescape. In 
> xmlescape, regular strings are ultimately passed to cgi.escape with the 
> "quote" argument set to True. However, LazyT objects are not passed to 
> cgi.escape but instead have their .xml() method called, and that method 
> calls cgi.escape with the "quote" argument set to False. As a result, 
> double quotes are not converted to """. This creates a problem because 
> when helpers are serialized, all attributes are wrapped with double quotes, 
> so you cannot have double quotes within the attribute unless they are HTML 
> encoded. This should probably be considered a bug. Perhaps xmlescape should 
> check for LazyT objects and instead of calling the .xml() method, treat it 
> as a string object.
>
> For now, the workaround is to force the conversion of the LazyT object to 
> a string before passing it as a helper attribute:
>
> textarea = TEXTAREA(_placeholder=str(my_text), ...)
>
> Maybe submit a github issue about this and link to this post.
>
> Anthony
>
> On Sunday, May 17, 2015 at 12:29:00 PM UTC-4, Spokes wrote:
>>
>> I'm attempting to include a relatively lengthy passage of text in a 
>> textarea placeholder; the text contains some terms within double-quotes, 
>> and the text string is passed to current.T(). The problem is that 
>> everything following the first double-quote gets truncated. For example, 
>> let's say this is the text sample, a print statement, for debugging, and 
>> the textarea code:
>>
>> my_text = current.T('this is some \"text\" which contains quotes' \
>>                     + 'the text continues on the next line')
>> print "\nmy_text:", my_text
>> textarea = TEXTAREA(_placeholder = my_text, ...)
>>
>> The output of the print statement will be the full text string. However, 
>> the placeholder within the textarea will be "this is some". Any idea as to 
>> what's going on here, and how to fix it? Thanks.
>>
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to