Browse Source

fix None handling in filters

master
Yves G 3 years ago
parent
commit
07ae8164cd
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      pyruse/filters/filter_equals.py
  2. +2
    -2
      pyruse/filters/filter_greaterOrEquals.py

+ 2
- 2
pyruse/filters/filter_equals.py View File

@ -1,5 +1,5 @@
# 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.
from pyruse import base
@ -10,4 +10,4 @@ class Filter(base.Filter):
self.value = args["value"]
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

+ 2
- 2
pyruse/filters/filter_greaterOrEquals.py View File

@ -1,5 +1,5 @@
# 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.
from pyruse import base
@ -10,4 +10,4 @@ class Filter(base.Filter):
self.value = args["value"]
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…
Cancel
Save