[twill] Multiple submit buttons

Titus Brown titus at caltech.edu
Sat Dec 10 16:17:55 PST 2005


applied; thanks!

On Thu, Dec 08, 2005 at 12:56:16AM +0100, Tom Parker wrote:
-> Forms sometimes come with multiple submit buttons. Sometimes they're the 
-> same, sometimes they're different. Often, a group of submit buttons will 
-> be repeated in different places on a form. Which 'blah' button you press 
-> generally doesn't matter, and can be checked by testing the name and 
-> value fields. I've attached a patch to modify the 
-> '_all_the_same_checkbox' function in browser.py to also check submit 
-> buttons. In order to facilitate this, and also to make things a bit 
-> safer for the 'checkbox' and 'hidden' fields already handled, it has 
-> been renamed to '_all_the_same_control' and the 'value' field of the 
-> control is checked as well as the 'name' field.
-> 
-> Patch was generated from 'darcs send -o patch.txt'.
-> 
-> Tom Parker

-> 
-> New patches:
-> 
-> [Add submit buttons to multiple identical control checks
-> palfrey at tevp.net**20051207235131] {
-> hunk ./twill/browser.py 331
-> -    def _all_the_same_checkbox(self, matches):
-> +    def _all_the_same_control(self, matches):
-> hunk ./twill/browser.py 333
-> +		value = None
-> hunk ./twill/browser.py 335
-> -            if match.type not in ['checkbox', 'hidden']:
-> +            if match.type not in ['checkbox', 'hidden', 'submit']:
-> hunk ./twill/browser.py 339
-> +				value = match.value
-> hunk ./twill/browser.py 341
-> -                if match.name != name:
-> +                if match.name != name or match.value!= value:
-> hunk ./twill/browser.py 358
-> -                or self._all_the_same_checkbox(matches)):
-> +                or self._all_the_same_control(matches)):
-> hunk ./twill/browser.py 384
-> -                    or self._all_the_same_checkbox(matches)):
-> +                    or self._all_the_same_control(matches)):
-> }
-> 
-> Context:
-> 
-> [bumped version number to 0.8.1a5
-> titus at caltech.edu**20051206190234] 
-> [extensions now twill.extensions; added sureshvv's stuff in as match_parse extension
-> titus at caltech.edu**20051206185654] 
-> [incr to a4
-> titus at caltech.edu**20051206075655] 
-> [fixed problems with 'title'
-> titus at caltech.edu**20051206075117] 
-> [formfile now uses 'rb' to open files
-> titus at caltech.edu**20051204012030] 
-> [updated to a2
-> titus at caltech.edu**20051204010621] 
-> [updated form tests a bit; ChangeLog
-> titus at caltech.edu**20051204005839] 
-> [Allow multiple checkbox form fields with same name.
-> tv at debian.org**20051202083503
->  
->  Nevow formless adds hidden fields with False values
->  to ensure it gets something back, even if the button
->  was not checked.
-> ] 
-> [Avoid untrue error message when no clickies are found.
-> tv at debian.org**20051202113037
->  
->  Used to set found_multiple even when clickies==[],
->  which lead to error message "multiple matches to ..",
->  when the right error message was "no field matches ..".
-> ] 
-> [updated to a1
-> titus at caltech.edu**20051204003107] 
-> [fixed form sub/referer issue
-> titus at caltech.edu**20051204002550] 
-> [more cleanup
-> titus at caltech.edu**20051203233950] 
-> [removed HTMLParser.py
-> titus at caltech.edu**20051203233547] 
-> [whoops; added wsgi_intercept
-> titus at caltech.edu**20051203233146] 
-> [fixed tests when run as scripts; renamed myhttplib to wsgi_intercept, used latest wsgi_intercept code
-> titus at caltech.edu**20051203233124] 
-> [minor changes to README
-> titus at caltech.edu**20051203231157] 
-> [minor cleanup fostered by pychecker
-> titus at caltech.edu**20051203231050] 
-> [fixed tests so that they work with latest version of nose
-> titus at caltech.edu**20051203231017] 
-> [updated version to 0.8.1, prophylactically
-> titus at caltech.edu**20051129085140] 
-> [added ctb-notes
-> titus at caltech.edu**20051129084743] 
-> [TAG release-0.8
-> titus at caltech.edu**20051129084656] 
-> Patch bundle hash:
-> 1f5c7361691b03bc110ae5d6a3532b8576bd0884

-> _______________________________________________
-> twill mailing list
-> twill at lists.idyll.org
-> http://lists.idyll.org/listinfo/twill




More information about the twill mailing list