Skip to content

Commit 6071c3f

Browse files
Revert "Use word-boundary regex to detect now in CEL expressions"
This reverts commit f6b1c39.
1 parent f6b1c39 commit 6071c3f

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

protovalidate/internal/rules.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
import dataclasses
1616
import datetime
17-
import re
1817
import typing
1918
from collections.abc import Callable, Container, Iterable, Mapping
2019

@@ -45,9 +44,6 @@ def _is_repeated(field: descriptor.FieldDescriptor) -> bool:
4544
return field.label == descriptor.FieldDescriptor.LABEL_REPEATED # type: ignore[attr-defined]
4645

4746

48-
_NOW_RE = re.compile(r"\bnow\b")
49-
50-
5147
class CompilationError(Exception):
5248
pass
5349

@@ -417,7 +413,7 @@ def add_rule(
417413
rules = validate_pb2.Rule()
418414
rules.id = expression
419415
rules.expression = expression
420-
if _NOW_RE.search(rules.expression):
416+
if "now" in rules.expression:
421417
self._uses_now = True
422418
ast = env.compile(rules.expression)
423419
prog = env.program(ast, functions=funcs)

0 commit comments

Comments
 (0)