Skip to content

Commit

Permalink
bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
tobixen committed Oct 1, 2023
1 parent ce37482 commit b6fc127
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions plann/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from plann.commands import _select, _edit, _cats, _check_for_panic, _add_todo, _add_event, _agenda, _check_due, _dismiss_panic, _split_huge_tasks, _split_high_pri_tasks, _set_task_attribs
from plann.lib import find_calendars, attr_txt_one, attr_txt_many, attr_time, attr_int, _list, _split_vcal
from plann.timespec import tz
from plann.interactive import _abort
__version__ = metadata["version"]

import click
Expand Down Expand Up @@ -129,10 +130,6 @@ def _set_attr_options_(func, verb, desc=""):
func = click.option(f"--{verb}{foo}", help=f"{desc} ical attribute {foo}", multiple=True)(func)
return func

def _abort(message):
click.echo(message)
raise click.Abort(message)

def _set_attr_options(verb="", desc=""):
return lambda func: _set_attr_options_(func, verb, desc)

Expand Down
2 changes: 1 addition & 1 deletion plann/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from plann.panic_planning import timeline_suggestion
from plann.timespec import _now, _ensure_ts, parse_dt, parse_add_dur, parse_timespec, tz
from plann.lib import _summary, _procrastinate, _relships_by_type, _summary, _relationship_text, _adjust_relations, parentlike, childlike, _remove_reverse_relations, _process_set_arg, attr_txt_one, attr_txt_many, attr_time, attr_int, _set_something, _list, _add_category
from plann.interactive import command_edit, _interactive_ical_edit, _interactive_relation_edit, _set_relations_from_text_list, interactive_split_task, _editor, _command_line_edit, interactive_split_task, _mass_interactive_edit, _get_obj_from_line
from plann.interactive import command_edit, _interactive_ical_edit, _interactive_relation_edit, _set_relations_from_text_list, interactive_split_task, _editor, _command_line_edit, interactive_split_task, _mass_interactive_edit, _get_obj_from_line, _abort

def _select(ctx, interactive=False, mass_interactive=False, **kwargs):
"""
Expand Down
4 changes: 4 additions & 0 deletions plann/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def get_obj(line):
c.load()
_adjust_relations(parent, children)

def _abort(message):
click.echo(message)
raise click.Abort(message)

def _interactive_edit(obj):
if 'BEGIN:VEVENT' in obj.data:
objtype = 'event'
Expand Down
2 changes: 1 addition & 1 deletion plann/timespec.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _ensure_ts(dt):

def parse_dt(input, return_type=None, for_storage=False):
ret = _parse_dt(input, return_type)
if for_storage:
if for_storage and hasattr(ret, "astimezone"):
ret = ret.astimezone(tz.store_timezone)
return ret

Expand Down
2 changes: 2 additions & 0 deletions tests/test_timespec.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def testParseDt(self, input):
else:
assert ts in (
date(2011, 11, 11), date(2012, 12, 12))
ts = parse_dt(input, for_storage=True)
## TODO: asserts

@pytest.mark.parametrize("dt,dur,expected", [
(date(2020,2,20),'1d',date(2020,2,21)),
Expand Down

0 comments on commit b6fc127

Please sign in to comment.