[util] extend global namespace for filter expressions

This commit is contained in:
Mike Fährmann
2017-10-09 22:12:58 +02:00
parent 393755ee94
commit 832b8b76ac

View File

@@ -8,6 +8,7 @@
"""Utility functions and classes"""
import re
import os
import sys
import hmac
@@ -196,7 +197,12 @@ class UniquePredicate():
class FilterPredicate():
"""Predicate; True if evaluating the given expression returns True"""
globalsdict = {"safe_int": safe_int, "datetime": datetime.datetime}
globalsdict = {
"safe_int": safe_int,
"urlsplit": urllib.parse.urlsplit,
"datetime": datetime.datetime,
"re": re,
}
def __init__(self, codeobj):
self.codeobj = codeobj