Skip to content

Fix for disabled SubmitControl objects with no value#58

Open
abielr wants to merge 1 commit into
jjlee:masterfrom
abielr:master
Open

Fix for disabled SubmitControl objects with no value#58
abielr wants to merge 1 commit into
jjlee:masterfrom
abielr:master

Conversation

@abielr

@abielr abielr commented Feb 12, 2012

Copy link
Copy Markdown

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.

… form with 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. 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

intgr commented Mar 3, 2013

Copy link
Copy Markdown

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

@jammus

jammus commented Oct 14, 2014

Copy link
Copy Markdown

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

@intgr

intgr commented Oct 14, 2014

Copy link
Copy Markdown

@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

b3mb4m commented Mar 5, 2017

Copy link
Copy Markdown

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

@jamesbroadhead

jamesbroadhead commented Mar 12, 2017

Copy link
Copy Markdown

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants