Skip to content

Commit

Permalink
fix typo in date validation; minor consistency fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikez committed May 22, 2023
1 parent 5f4b943 commit dfba61b
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions things/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def get_tasks( # pylint: disable=R0914
trashed=False,
context_trashed=False,
last=None,
search_query: str = "",
search_query=None,
index="index",
count_only=False,
):
Expand All @@ -228,7 +228,7 @@ def get_tasks( # pylint: disable=R0914
validate("deadline_suppressed", deadline_suppressed, [None, True, False])
validate("start", start, [None] + list(START_TO_FILTER))
validate_date("start_date", start_date)
validate_date("stop_date", start_date)
validate_date("stop_date", stop_date)
validate("status", status, [None] + list(STATUS_TO_FILTER))
validate("trashed", trashed, [None] + list(TRASHED_TO_FILTER))
validate("type", type, [None] + list(TYPE_TO_FILTER))
Expand Down Expand Up @@ -1133,11 +1133,13 @@ def validate_date(parameter, argument):
f"Please see the documentation for `{parameter}` in `things.tasks`."
)

_comparator, isodate = match.groups()
_, isodate = match.groups()
try:
datetime.date.fromisoformat(isodate)
except ValueError as error:
raise ValueError(f"Invalid {parameter} argument: {argument!r}\n{error}") from error
raise ValueError(
f"Invalid {parameter} argument: {argument!r}\n{error}"
) from error


def validate_offset(parameter, argument):
Expand Down

0 comments on commit dfba61b

Please sign in to comment.