Browse Source

Pass through datetime, math, re, and time to --pyfilter

master
JustAnotherArchivist 3 years ago
parent
commit
d915a18a40
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      archivebot-jobs

+ 1
- 1
archivebot-jobs View File

@@ -62,7 +62,7 @@ class FilterAction(argparse.Action):
func = compile(values[0], '<pyfilter>', 'eval')
except Exception as e:
parser.error(f'Could not compile filter expression: {type(e).__module__}.{type(e).__name__}: {e!s}')
setattr(namespace, self.dest, lambda job: eval(func, {}, {'job': job}))
setattr(namespace, self.dest, lambda job: eval(func, {k: v for k, v in globals().items() if k in ('datetime', 'math', 're', 'time')}, {'job': job}))
return
global columns
match = re.match(r'^(?P<column>[A-Za-z ]+)(?P<op>[=<>^*$~])(?P<value>.*)$', values[0])


Loading…
Cancel
Save