diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-07-14 11:11:41 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-07-14 11:11:41 +1200 |
commit | 97b2e6d958a691060746b530219bf15a0bede1ae (patch) | |
tree | 6287a9c3b1994c64213dfbee7e62dd36d8492fec /mitmproxy/console/options.py | |
parent | c52d567b4360ebbaa63918beb16a5f78649309a5 (diff) | |
download | mitmproxy-97b2e6d958a691060746b530219bf15a0bede1ae.tar.gz mitmproxy-97b2e6d958a691060746b530219bf15a0bede1ae.tar.bz2 mitmproxy-97b2e6d958a691060746b530219bf15a0bede1ae.zip |
Add a .setter helper to Options
This returns a function that sets a named attribute, and is handy for
event-driven code like mitmproxy console.
Diffstat (limited to 'mitmproxy/console/options.py')
-rw-r--r-- | mitmproxy/console/options.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/mitmproxy/console/options.py b/mitmproxy/console/options.py index 331c28a5..f6342814 100644 --- a/mitmproxy/console/options.py +++ b/mitmproxy/console/options.py @@ -153,7 +153,6 @@ class Options(urwid.WidgetWrap): def clearall(self): self.master.anticache = False - self.master.anticomp = False self.master.killextra = False self.master.showhost = False self.master.refresh_server_playback = True @@ -163,8 +162,11 @@ class Options(urwid.WidgetWrap): self.master.set_ignore_filter([]) self.master.set_tcp_filter([]) self.master.scripts = [] - self.master.set_stickyauth(None) self.master.set_stickycookie(None) + + self.master.options.stickyauth = None + self.master.options.anticomp = False + self.master.state.default_body_view = contentviews.get("Auto") signals.update_settings.send(self) @@ -263,7 +265,7 @@ class Options(urwid.WidgetWrap): signals.status_prompt.send( prompt = "Sticky auth filter", text = self.master.options.stickyauth, - callback = self.master.set_stickyauth + callback = self.master.options.setter("stickyauth") ) def sticky_cookie(self): |