[twill] Error with showforms again

Titus Brown titus at caltech.edu
Tue Jan 24 11:15:43 PST 2006


-> On this page
-> http://www.playfirst.com/cart.html
-> 
-> I get the following error when I use showforms (with or with out tidy)
-> ERROR:  start of INPUT before start of FORM
-> 
-> Not sure ahy it's balking but would like to know.  Also even a python 
-> workaround would be nice so that I can submit a coupon code

Hi, Peri,

the problem is at line 467, where an <input> is used outside of a form.
I'm not sure how to fix this: you can always edit
twill/wwwsearch/ClientForm.py and replace

	raise ParseError("start of INPUT before start of FORM")

with a 'return', but this isn't a general solution.

I tried putting in the BeautifulSoup parser, but it didn't help things.
(After all, this isn't syntactically incorrect, it's semantically
incorrect!)

Another solution is this change to ClientForm.py:

967,971c967,974
<         try:
<             fp.feed(data)
<         except ParseError, e:
<             e.base_uri = base_uri
<             raise
---
>         for ch in data:
>             try:
>                 fp.feed(ch)
>             except ParseError, e:
>                 print 'PARSE ERROR:', str(e)

This works, but there's no clear provision for patching it into
ClientForm in a subclass, and I doubt John Lee would put it into
the official ClientForm.

Any thoughts on how twill and/or ClientForm should handle this sort of
situation?

thanks,
--titus



More information about the twill mailing list