From f5f46bf0808a5c7d5f9ed89d02a4714bcb66bf43 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 19 Jan 2014 12:43:58 +1300 Subject: Re-enable caching on search. --- libmproxy/console/flowview.py | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'libmproxy/console') diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index 35fc1e43..45d57721 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -1,4 +1,4 @@ -import os, sys +import os, sys, copy import urwid import common, grideditor, contentview from .. import utils, flow, controller @@ -87,9 +87,7 @@ class FlowViewHeader(common.WWrap): class CallbackCache: - #commented decorator because it was breaking search functionality (caching after - # searches.) If it can be made to only cache the first time, it'd be great. - #@utils.LRUCache(200) + @utils.LRUCache(200) def _callback(self, method, *args, **kwargs): return getattr(self.obj, method)(*args, **kwargs) @@ -137,7 +135,6 @@ class FlowView(common.WWrap): limit = sys.maxint else: limit = contentview.VIEW_CUTOFF - description, text_objects = cache.callback( self, "_cached_content_view", viewmode, @@ -145,7 +142,6 @@ class FlowView(common.WWrap): conn.content, limit ) - return (description, text_objects) def cont_view_handle_missing(self, conn, viewmode): @@ -173,14 +169,12 @@ class FlowView(common.WWrap): key = "header", val = "text" ) - if conn.content is not None: override = self.override_get() viewmode = self.viewmode_get(override) msg, body = self.cont_view_handle_missing(conn, viewmode) elif conn.content == flow.CONTENT_MISSING: pass - return headers, msg, body def conn_text_merge(self, headers, msg, body): @@ -188,7 +182,6 @@ class FlowView(common.WWrap): Grabs what is returned by conn_text_raw and merges them all toghether, mainly used by conn_text and search """ - override = self.override_get() viewmode = self.viewmode_get(override) @@ -222,7 +215,6 @@ class FlowView(common.WWrap): """ headers, msg, body = self.conn_text_raw(conn) merged = self.conn_text_merge(headers, msg, body) - return urwid.ListBox(merged) def _tab(self, content, attr): @@ -350,6 +342,7 @@ class FlowView(common.WWrap): i = start_line found = False + text_objects = copy.deepcopy(text_objects) for text_object in text_objects[start_line:]: if i != start_line: start_index = 0 -- cgit v1.2.3