Ronnie has proposed merging lp:~ronnie.vd.c/loco-directory/fixes-671278 into 
lp:loco-directory.

Requested reviews:
  loco-directory-dev (loco-directory-dev)
Related bugs:
  #671278 Unable to subscribe to RSS or iCal feed from Google Calendar
  https://bugs.launchpad.net/bugs/671278


Fixes a bug in ical feed. The description is now conform the RFC2445 
specification, and should be able to import in google calendar

https://bugs.launchpad.net/loco-directory/+bug/671278
-- 
https://code.launchpad.net/~ronnie.vd.c/loco-directory/fixes-671278/+merge/43914
Your team loco-directory-dev is requested to review the proposed merge of 
lp:~ronnie.vd.c/loco-directory/fixes-671278 into lp:loco-directory.
=== modified file 'loco_directory/events/models.py'
--- loco_directory/events/models.py	2010-11-27 03:56:49 +0000
+++ loco_directory/events/models.py	2010-12-16 15:06:29 +0000
@@ -12,6 +12,7 @@
 )
 
 import datetime
+import textwrap
 
 class BaseEvent(models.Model):
     """
@@ -33,15 +34,17 @@
         """
         dtstart = str(self.date_begin).replace(' ','T', 1).replace(':','',2).replace('-','',2)
         dtend = str(self.date_end).replace(' ','T', 1).replace(':','',2).replace('-','',2)
+        desc = str(self.description).replace('\\', r'\\').replace('\n', r'\n').replace(',', r'\,').replace(';', r'\;').replace('"', r'\"')
+        description = '\n'.join(textwrap.wrap(desc, 76, initial_indent='DESCRIPTION:', subsequent_indent=' '))
         return '''BEGIN:VEVENT
 UID:%(id)s
 DTSTART:%(dtstart)sZ
 DTEND:%(dtend)sZ
 CATEGORIES:Ubuntu Loco Team Event
 SUMMARY:%(eventname)s
-DESCRIPTION:%(description)s
+%(description)s
 END:VEVENT
-''' % {'id':self.id, 'dtstart':dtstart, 'dtend':dtend, 'eventname':self.name, 'description': self.description}
+''' % {'id':self.id, 'dtstart':dtstart, 'dtend':dtend, 'eventname':self.name, 'description': description}
 
     def is_past(self):
         return self.date_end > datetime.datetime.today()

_______________________________________________
Mailing list: https://launchpad.net/~loco-directory-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~loco-directory-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to