mechanize icon indicating copy to clipboard operation
mechanize copied to clipboard

Fix for disabled SubmitControl objects with no value

Open abielr opened this issue 13 years ago • 5 comments

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.

abielr avatar Feb 12 '12 20:02 abielr

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

intgr avatar Mar 03 '13 16:03 intgr

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

jammus avatar Oct 14 '14 14:10 jammus

@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

intgr avatar Oct 14 '14 14:10 intgr

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

b3mb4m avatar Mar 05 '17 12:03 b3mb4m

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)

jamesbroadhead avatar Mar 12 '17 14:03 jamesbroadhead