Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def userFilter(userSpec, autocompleting, *filters):
from sqlalchemy import and_
return and_(True if userSpec is None else
Users.ID == userSpec if userSpec.isdigit() else
Users.username.ilike(userSpec.replace("_", "\_")+("%" if autocompleting else "")), *filters)
Users.username.ilike(userSpec.replace("_", r"\_")+("%" if autocompleting else "")), *filters)


def userCandidates(userSpec, *filters):
Expand Down
2 changes: 1 addition & 1 deletion endpoints/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def userQuery(domainID=None):
expr = request.args["match"]
fields = set(request.args["matchFields"].split(",")) if "matchFields" in request.args else None
isUnicode = any(ord(c) > 127 for c in expr)
matchexpr = tuple("%"+substr.replace("_", "\_")+"%" for substr in expr.split())
matchexpr = tuple("%"+substr.replace("_", r"\_")+"%" for substr in expr.split())
matchables = Users._meta.matchables if fields is None else (m for m in Users._meta.matchables if m.alias in fields)
targets = []
for prop in matchables:
Expand Down
2 changes: 1 addition & 1 deletion tools/DataModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ def automatch(cls, query, expr, fields=None):
"""Add fuzzy matching to query."""
cls._init()
isUnicode = any(ord(c) > 127 for c in expr)
matchexpr = tuple("%"+substr.replace("_", "\_")+"%" for substr in expr.split())
matchexpr = tuple("%"+substr.replace("_", r"\_")+"%" for substr in expr.split())
matchables = cls._meta.matchables if fields is None else (m for m in cls._meta.matchables if m.alias in fields)
targets = []
for prop in matchables:
Expand Down