Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor icalendar helpers into their own module #840

Merged
merged 1 commit into from
Sep 16, 2019
Merged
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
9 changes: 5 additions & 4 deletions khal/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
from khal.khalendar.exceptions import DuplicateUid, ReadOnlyCalendarError

from .exceptions import ConfigurationError
from .icalendar import (cal_from_ics, new_event as new_vevent, split_ics,
sort_key as sort_vevent_key)
from .khalendar.vdir import Item
from .terminal import merge_columns
from .utils import cal_from_ics

logger = logging.getLogger('khal')

Expand Down Expand Up @@ -358,7 +359,7 @@ def new_from_args(collection, calendar_name, conf, dtstart=None, dtend=None,
if isinstance(categories, str):
categories = list([category.strip() for category in categories.split(',')])
try:
event = utils.new_event(
event = new_vevent(
locale=conf['locale'], location=location, categories=categories,
repeat=repeat, until=until, alarms=alarms, dtstart=dtstart,
dtend=dtend, summary=summary, description=description, timezone=timezone,
Expand Down Expand Up @@ -554,7 +555,7 @@ def import_ics(collection, conf, ics, batch=False, random_uid=False, format=None
"""
if format is None:
format = conf['view']['event_format']
vevents = utils.split_ics(ics, random_uid, conf['locale']['default_timezone'])
vevents = split_ics(ics, random_uid, conf['locale']['default_timezone'])
for vevent in vevents:
import_event(vevent, collection, conf['locale'], batch, format, env)

Expand Down Expand Up @@ -624,7 +625,7 @@ def print_ics(conf, name, ics, format):

vevents = list()
for uid in events_grouped:
vevents.append(sorted(events_grouped[uid], key=utils.sort_key))
vevents.append(sorted(events_grouped[uid], key=sort_vevent_key))

echo('{} events found in {}'.format(len(vevents), name))
for sub_event in vevents:
Expand Down
Loading