--- a/pvl/syslog/filter.py Fri Jan 04 20:49:23 2013 +0200
+++ b/pvl/syslog/filter.py Fri Jan 04 20:50:31 2013 +0200
@@ -15,12 +15,12 @@
self.filters = filters
- def match_prog (self, attr, filter, prog=None) :
+ def match_prog (self, attr, glob, prog=None) :
"""
XXX: Match given prog as glob?
"""
- if not filter :
+ if not glob :
# ignore
return None
@@ -29,7 +29,7 @@
_, prog = os.path.split(prog)
# match
- if fnmatch.fnmatch(prog, filter) :
+ if fnmatch.fnmatch(prog, glob) :
return { attr: prog }
else :
return False
@@ -39,7 +39,7 @@
Match given value against given pattern.
"""
- if not filter :
+ if not regex :
# ignore
return None
@@ -53,12 +53,16 @@
# match
match = regex.match(value)
- if match :
- # as matche-values
- match = match.groupdict()
- match[attr] = value
+ if not match :
+ return None
- return match
+ # as match-values
+ matches = match.groupdict()
+ matches[attr] = match.group(0) # whole match
+
+ # TODO match.expand?
+
+ return matches
def filter (self, item) :
"""