diff --git a/doc/example.ics b/doc/example.ics deleted file mode 100644 index 079b064..0000000 --- a/doc/example.ics +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN:VCALENDAR -PRODID:-//My calendar product//mxm.dk// -VERSION:2.0 -BEGIN:VEVENT -ATTENDEE;CN=Max Rasmussen;ROLE=REQ-PARTICIPANT:MAILTO:maxm@example.com -ATTENDEE;CN=The Dude;ROLE=REQ-PARTICIPANT:MAILTO:the-dude@example.com -DTEND:20050404T100000Z -DTSTAMP:20050404T001000Z -DTSTART:20050404T080000Z -LOCATION:Odense\, Denmark -ORGANIZER;CN=Max Rasmussen;ROLE=CHAIR:MAILTO:noone@example.com -PRIORITY:5 -SUMMARY:Python meeting about calendaring -UID:20050115T101010/27346262376@mxm.dk -END:VEVENT -END:VCALENDAR diff --git a/doc/example.txt b/doc/example.txt index 7bb6004..85749ed 100644 --- a/doc/example.txt +++ b/doc/example.txt @@ -272,30 +272,13 @@ that can be loaded into the Mozilla calendar >>> cal.add_component(event) Write to disc - >>> import os - >>> directory = os.path.dirname(__file__) + >>> import tempfile, os + >>> directory = tempfile.mkdtemp() >>> f = open(os.path.join(directory, 'example.ics'), 'wb') >>> f.write(cal.as_string()) >>> f.close() - -And that generates this file. - - BEGIN:VCALENDAR - PRODID:-//My calendar product//mxm.dk// - VERSION:2.0 - BEGIN:VEVENT - ATTENDEE:MAILTO:maxm@example.com - ATTENDEE:MAILTO:the-dude@example.com - DTEND:20050404T100000Z - DTSTAMP:20050404T001000Z - DTSTART:20050404T080000Z - LOCATION:Odense, Denmark - ORGANIZER;CN=Max Rasmussen;ROLE=CHAIR:MAILTO:noone@example.com - PRIORITY:5 - SUMMARY:Python meeting about calendaring - UID:20050115T101010/27346262376@mxm.dk - END:VEVENT - END:VCALENDAR + + XXX We should check whether the write succeeded here.. -- diff --git a/src/icalendar/cal.py b/src/icalendar/cal.py index b4cd47b..290ac37 100644 --- a/src/icalendar/cal.py +++ b/src/icalendar/cal.py @@ -511,7 +511,9 @@ class Calendar(Component): 'BEGIN:VEVENT\\r\\nDTSTART:20050404T080000\\r\\nSUMMARY:Python meeting about calendaring\\r\\nUID:42\\r\\nEND:VEVENT\\r\\n' Write to disc - >>> open('test.ics', 'wb').write(cal.as_string()) + >>> import tempfile, os + >>> directory = tempfile.mkdtemp() + >>> open(os.path.join(directory, 'test.ics'), 'wb').write(cal.as_string()) """ name = 'VCALENDAR'