I'm trying to inherit the mechanize class .Browser :
from mechanize import Browser class LLManager(Browser, object): IS_AUTHORIZED = False def __init__(self, login = "", passw = "", *args, **kwargs): super(LLManager, self).__init__(*args, **kwargs) self.set_handle_robots(False) But when I do something like this:
lm["Widget[LinksList]_link_1_title"] = anc The error is:
Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> lm["Widget[LinksList]_link_1_title"] = anc TypeError: 'LLManager' object does not support item assignment And when so:
>>> m.__setitem__("Widget[LinksList]_link_1_title", anc) >>> print lm.form <TextControl(Widget[LinksList]_link_1_title=Джинсовый чел)> <TextControl(Widget[LinksList]_link_1_url=http://)> then it works.
The class __setitem__ method in Browser and above is not overloaded.
Why doesn't my class or instance inherit this method as a parent?
__getitem__and__setitem__, which are not in the entire inheritance chain up to the upper class. - Christ