예제 #1
0
def _construct_event(info,
                     locale,
                     defaulttimelen=60,
                     defaultdatelen=1,
                     description=None,
                     location=None,
                     categories=None,
                     repeat=None,
                     until=None,
                     alarm=None,
                     **kwargs):
    info = eventinfofstr(' '.join(info),
                         locale,
                         dt.timedelta(days=1),
                         dt.timedelta(hours=1),
                         adjust_reasonably=True,
                         localize=False)
    if description is not None:
        info["description"] = description
    event = new_event(locale=locale,
                      location=location,
                      categories=categories,
                      repeat=repeat,
                      until=until,
                      alarms=alarm,
                      **info)
    return event
예제 #2
0
 def test_newevent(self, coll_vdirs):
     coll, vdirs = coll_vdirs
     bday = dt.datetime.combine(aday, dt.time.min)
     anend = bday + dt.timedelta(hours=1)
     event = icalendar_helpers.new_event(
         dtstart=bday,
         dtend=anend,
         summary="hi",
         timezone=utils.BERLIN,
         locale=LOCALE_BERLIN,
     )
     event = coll.new_event(event.to_ical(), coll.default_calendar_name)
     assert event.allday is False