[twill] empty textareas submit newline?

gabor gabor at nekomancer.net
Tue Mar 7 16:28:58 PST 2006


Titus Brown wrote:
> -> i have a simple webpage with a form with a textarea,
> -> like:
> ->      <form action="" method="get">
> ->          <textarea name="teaser" rows="10" cols="40"></textarea>
> ->      </form>
> -> </body>
> -> 
> -> the problem is that when i go there with twill, and do a submit, it 
> -> submits this:
> -> 
> -> textarea.html?teaser=%0A
> -> 
> -> a newline.
> -> 
> -> a different way to reproduce the problem is to simply use "showforms".
> -> and you will see that for all the should-be-empty textareas the content 
> -> is a newline (there is an empty line below the textarea's line).
> -> 
> -> so, is this a bug or i am doing something very stupid :) ?
> 
> Hi, Gabor,
> 
> in a classic example of a not-good situation... the problem lies deeper
> than I'd like to go for the moment.
> 
> First off, the 'handle_data' function of ClientForm.AbstractFormParser
> gets a newline when there's no text there.  This indicates that the
> problem lies somewhere directly in the parsing code, and not in
> logistical code later on.

yes, i also found that..

the problem is that from what i've seen, the AbstractFormParser derives 
from the 'standard' python SGMLParser.

and i created a minimal SGMLParser, and it behaves correctly. it reports 
the textarea with '' (empty string) content.

anyway, it's 1:28AM already. will try to investigate more tomorrow :)

gabor



More information about the twill mailing list