retain raw filter str on filt objects

This commit is contained in:
Maximilian Hils 2014-11-22 15:27:43 +01:00
parent ec23594191
commit f7c5385679
2 changed files with 7 additions and 5 deletions

View File

@ -343,7 +343,9 @@ bnf = _make()
def parse(s):
try:
return bnf.parseString(s, parseAll=True)[0]
filt = bnf.parseString(s, parseAll=True)[0]
filt.pattern = s
return filt
except pp.ParseException:
return None
except ValueError:

View File

@ -346,11 +346,13 @@ class State(object):
# These are compiled filt expressions:
self._limit = None
self.intercept = None
self._limit_txt = None
@property
def limit_txt(self):
return self._limit_txt
if self.filt:
return self.filt.pattern
else:
return None
def flow_count(self):
return len(self._flow_list)
@ -407,10 +409,8 @@ class State(object):
if not f:
return "Invalid filter expression."
self._limit = f
self._limit_txt = txt
else:
self._limit = None
self._limit_txt = None
self.recalculate_view()
def set_intercept(self, txt):