pimutils / pimutils/khal

On new event, with -i flag, daterange parsing error shouldn't wipe the whole event

Open
#789 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

beginner friendly lv: easy type: bug
Dominant language
Python
Stars
3.1k
Forks
233
Avg merge
1h 44m
Merged PRs (30d)
1

Description

If I screw up the datetime range when adding a new event, khal should...

  1. give me a clue about what was wrong with the range given (same as #786 ), and also
  2. give me a chance to revise the datetime range, without starting over.

Right now if I screw up, I have to add the whole event from scratch:

amanda@mona:~$ khal new -i
calendar: logistics
summary: Coffee w/Somebody at a Place
datetime range: tuesday 13:30 - 14:30
Traceback (most recent call last):
File "/usr/local/bin/khal", line 11, in
sys.exit(main_khal())
File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/amanda/.local/lib/python3.5/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/amanda/.local/lib/python3.5/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/amanda/.local/lib/python3.5/site-packages/khal/cli.py", line 396, in new
format=format,
File "/home/amanda/.local/lib/python3.5/site-packages/khal/controllers.py", line 301, in new_interactive
daterange, conf['locale'], adjust_reasonably=True)
File "/home/amanda/.local/lib/python3.5/site-packages/khal/utils.py", line 438, in guessrangefstr
raise ValueError('Could not parse {} as a daterange'.format(daterange))
ValueError: Could not parse tuesday 13:30 - 14:30 as a daterange
amanda@mona:~$

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at khal/controllers.py in new_interactive, which calls khal/utils.py:guessrangefstr; the command entry point is khal/cli.py. Reproduce the invalid datetime range with khal new -i, then verify that the range error is explained and the existing event fields remain available for another range attempt.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.