fix None handling in filters
parent
50075efcfb
commit
07ae8164cd
|
@ -1,5 +1,5 @@
|
||||||
# pyruse is intended as a replacement to both fail2ban and epylog
|
# pyruse is intended as a replacement to both fail2ban and epylog
|
||||||
# Copyright © 2017 Y. Gablin
|
# Copyright © 2017–2018 Y. Gablin
|
||||||
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
|
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
|
||||||
from pyruse import base
|
from pyruse import base
|
||||||
|
|
||||||
|
@ -10,4 +10,4 @@ class Filter(base.Filter):
|
||||||
self.value = args["value"]
|
self.value = args["value"]
|
||||||
|
|
||||||
def filter(self, entry):
|
def filter(self, entry):
|
||||||
return entry.get(self.field, None) == self.value
|
return entry[self.field] == self.value if self.field in entry else False
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# pyruse is intended as a replacement to both fail2ban and epylog
|
# pyruse is intended as a replacement to both fail2ban and epylog
|
||||||
# Copyright © 2017 Y. Gablin
|
# Copyright © 2017–2018 Y. Gablin
|
||||||
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
|
# Full licensing information in the LICENSE file, or gnu.org/licences/gpl-3.0.txt if the file is missing.
|
||||||
from pyruse import base
|
from pyruse import base
|
||||||
|
|
||||||
|
@ -10,4 +10,4 @@ class Filter(base.Filter):
|
||||||
self.value = args["value"]
|
self.value = args["value"]
|
||||||
|
|
||||||
def filter(self, entry):
|
def filter(self, entry):
|
||||||
return entry.get(self.field, None) >= self.value
|
return entry[self.field] >= self.value if self.field in entry else False
|
||||||
|
|
Loading…
Reference in New Issue