aggregator: Escape VERSION and PRODID
authorW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 16:09:04 +0000 (12:09 -0400)
committerW. Trevor King <wking@tremily.us>
Sun, 30 Jun 2013 16:26:18 +0000 (12:26 -0400)
From RFC 5545, sections 3.7.3 (Product Identifier) and 3.7.4
(Version), these are both text fields.

pycalendar/aggregator.py

index 6b611b9ec1fa115a4159fad682f708479bc12c14..8df064b47300de492b51b2da0332eedd1db22422 100644 (file)
@@ -1,5 +1,8 @@
 # Copyright
 
+from . import text as _text
+
+
 class Aggregator (list):
     r"""An iCalendar feed aggregator
 
@@ -74,8 +77,8 @@ class Aggregator (list):
 
     def write(self, stream):
         stream.write('BEGIN:VCALENDAR\r\n')
-        stream.write('VERSION:{}\r\n'.format(self.version))
-        stream.write('PRODID:{}\r\n'.format(self.prodid))
+        stream.write('VERSION:{}\r\n'.format(_text.escape(self.version)))
+        stream.write('PRODID:{}\r\n'.format(_text.escape(self.prodid)))
         for feed in self:
             for entry in feed:
                 entry.write(stream=stream)