[TIP] form field name length limitations and twill

Michał Kwiatkowski constant.beta at gmail.com
Thu Apr 24 15:11:47 PDT 2008

On Fri, Apr 18, 2008 at 8:20 AM, Titus Brown <titus at caltech.edu> wrote:
>  -> Name field in the table will extend to the longest field name. The
>  -> same thing could be done for field id. What about field type and
>  -> value? Think about textareas with long content and newlines, we could
>  -> allow that but it could potentially mess up the table display.
>  Or, we could do a 'showdetail' that takes a form name/number and a
>  regexp and shows full detail for matching fields, including IDs, number,
>  etc.

Finally had some time to work on this. Patch is in the attachment.
Contains the complete implementation with some unit tests. Lacks user
documentation though. I want to get some feedback before adding docs.

Sample usage below. Matching by field id:

>> go http://programming.reddit.com
==> at http://reddit.com/r/programming/
current page: http://reddit.com/r/programming/
>> showformdetails 3 passwd
Controls of form "3" matching "passwd"
## __Name______ __Type___ __ID________ __Value__________________
1  passwd_reg   password  passwd_reg
2  passwd2_reg  password  passwd2_reg

Matching by field value:

>> showformdetails 2 login_main
Controls of form "2" matching "login_main"
## __Name__ __Type__ __ID___ __Value__________________
1  op       hidden   (None)  login_main

Other standard matching methods are also supported, like matching
fields by name or index, see tests for more examples.

I had to do a bit of refactoring to avoid code duplication. I'm not
sure how well twill is covered by tests, but the existing test suite
passes on my computer and manual testing didn't reveal any

-------------- next part --------------
A non-text attachment was scrubbed...
Name: showformdetails-impl-and-tests.patch
Type: text/x-diff
Size: 11814 bytes
Desc: not available
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20080425/bc4b11da/attachment.patch 

More information about the testing-in-python mailing list