1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-06-26 16:45:52 +00:00

Python 3 support and minor fixes.

This commit is contained in:
Guillaume Ayoub 2010-01-15 16:04:03 +01:00
parent 4a0d3936e8
commit 4ee09cf817
11 changed files with 66 additions and 70 deletions

View file

@ -24,7 +24,7 @@ iCal parsing functions.
# TODO: Manage filters (see xmlutils)
import calendar
from radicale import calendar
def write_calendar(headers=[
calendar.Header("PRODID:-//Radicale//NONSGML Radicale Server//EN"),
@ -32,14 +32,14 @@ def write_calendar(headers=[
timezones=[], todos=[], events=[]):
"""Create calendar from ``headers``, ``timezones``, ``todos``, ``events``."""
# TODO: Manage encoding and EOL
cal = u"\n".join((
u"BEGIN:VCALENDAR",
u"\n".join([header.text for header in headers]),
u"\n".join([timezone.text for timezone in timezones]),
u"\n".join([todo.text for todo in todos]),
u"\n".join([event.text for event in events]),
u"END:VCALENDAR"))
return u"\n".join([line for line in cal.splitlines() if line])
cal = "\n".join((
"BEGIN:VCALENDAR",
"\n".join([header.text for header in headers]),
"\n".join([timezone.text for timezone in timezones]),
"\n".join([todo.text for todo in todos]),
"\n".join([event.text for event in events]),
"END:VCALENDAR"))
return "\n".join([line for line in cal.splitlines() if line])
def headers(vcalendar):
"""Find Headers items in ``vcalendar``."""