Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for disabled SubmitControl objects with no value #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abielr
Copy link

@abielr abielr commented Feb 12, 2012

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
Copy link

intgr commented Mar 3, 2013

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

@jammus
Copy link

jammus commented Oct 14, 2014

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

@intgr
Copy link

intgr commented Oct 14, 2014

@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
Copy link

b3mb4m commented Mar 5, 2017

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

@jamesbroadhead
Copy link

jamesbroadhead commented Mar 12, 2017

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