# Buggy code
def keypress(self, key, editor):
    if key in "rRe":
        signals.status_message.send(
            self, message="Press enter to edit this field.", expire=1000
        )
        return
    elif key == "m_select":
        editor.master.view_grideditor(
            self.subeditor(
                editor.master,
                editor.walker.get_current_value(),
                editor.set_subeditor_value,
                editor.walker.focus,
                editor.walker.focus_col,
            )
        )
    else:
        return key


# Traceback (AttributeError)
Traceback (most recent call last):
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/master.py", line 216, in run
self.loop.run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 278, in run
self._run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 376, in _run
self.event_loop.run()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 682, in run
self._loop()
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 719, in _loop
self._watch_files[fd]()
File "/home/user/venv/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
event_loop, callback, self.get_available_raw_input())
File "/home/user/venv/lib/python3.5/site-packages/urwid/raw_display.py", line 493, in parse_input
callback(processed, processed_codes)
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 403, in _update
self.process_input(keys)
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 503, in process_input
k = self._topmost_widget.keypress(self.screen_size, k)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 303, in keypress
k
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/keymap.py", line 130, in handle
return self.executor(b.command)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/commandexecutor.py", line 17, in __call__
ret = self.master.commands.call(cmd)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 221, in call
return self.call_args(parts[0], parts[1:])
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 212, in call_args
return self.commands[path].call(args)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 101, in call
ret = self.func(*pargs)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/command.py", line 251, in wrapper
return function(*args, **kwargs)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/consoleaddons.py", line 174, in nav_select
self.master.inject_key("m_select")
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/master.py", line 181, in inject_key
self.loop.process_input([key])
File "/home/user/venv/lib/python3.5/site-packages/urwid/main_loop.py", line 503, in process_input
k = self._topmost_widget.keypress(self.screen_size, k)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 299, in keypress
k = super().keypress(size, k)
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 1128, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 2269, in keypress
key = w.keypress((mc,) + size[1:], key)
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/window.py", line 36, in keypress
ret = super().keypress(size, key)
File "/home/user/venv/lib/python3.5/site-packages/urwid/container.py", line 1128, in keypress
return self.body.keypress( (maxcol, remaining), key )
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/grideditor/base.py", line 356, in keypress
elif column.keypress(key, self) and not self.handle_key(key):
File "/mnt/c/Users/user/git/mitmproxy/mitmproxy/tools/console/grideditor/col_subgrid.py", line 30, in keypress
editor.master.view_grideditor(
AttributeError: 'ConsoleMaster' object has no attribute 'view_grideditor'

# Fixed code
def keypress(self, key, editor):
    if key in "rRe":
        signals.status_message.send(
            self, message="Press enter to edit this field.", expire=1000
        )
        return
    elif key == "m_select":
        self.subeditor.grideditor = editor
        editor.master.switch_view("edit_focus_setcookie_attrs")
    else:
        return key