jjlee / mechanize

Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize .
http://wwwsearch.sourceforge.net/mechanize/
618 stars 123 forks source link

Fix for disabled SubmitControl objects with no value #58

Open abielr opened 12 years ago

abielr commented 12 years ago

Stop mechanize from crashing with an AttributeError when attempting to select a form a SubmitControl that has no value and is also disabled.

When mechanize encounters a SubmitControl with no value (such as an ImageControl) it attempts to set the value to a blank string. This fails if the control is disabled (mechanize raises an AttributeError). This patch temporarily sets disabled to False in this situation and then immediately resets it to True after the blank string has been assigned to value.

intgr commented 11 years ago

Please merge, this is required by musicbrainz-bot (https://github.com/murdos/musicbrainz-bot)

jammus commented 9 years ago

Also having a similar problem. Buttons outside of a form inspected by #select_form are causing errors to be raised.

intgr commented 9 years ago

@jammus Sadly, it's clear by now that Mechanize for Python is not being maintained. This probably won't be fixed unless someone else steps up to the plate. Meanwhile here's a monkey-patch fix that you can use: https://stackoverflow.com/a/15188268

b3mb4m commented 7 years ago

@intgr That's really sad, mechanize "was" good project.Well atleast that fixed mine problem for now

jamesbroadhead commented 7 years ago

Thank you for your contribution to mechanize!

Following the process in #117, future work on mechanize will be occurring here: https://github.com/python-mechanize/mechanize.

Please re-file your PR there (where it will get attention, and hopefully merged)