def getICal(self): """get iCal data """ context = self.context out = StringIO() map = { 'dtstamp': rfc2445dt(DateTime()), 'created': rfc2445dt(DateTime(context.CreationDate())), 'uid': IUUID(context), 'modified': rfc2445dt(DateTime(context.ModificationDate())), 'summary': vformat(context.Title()), 'startdate': rfc2445dt(context.start_date), 'enddate': rfc2445dt(context.end_date), } out.write(ICS_EVENT_START % map) description = context.Description() if description: out.write(foldLine('DESCRIPTION:%s\n' % vformat(description))) location = context.location if location: location = location.encode('utf-8') out.write('LOCATION:%s\n' % vformat(location)) cn = [] contact = context.autoridade if contact: cn.append(contact) if cn: out.write('CONTACT:%s\n' % vformat(', '.join(cn))) url = context.absolute_url() if url: out.write('URL:%s\n' % url) out.write(ICS_EVENT_END) return out.getvalue()
def getVCal(self): """get vCal data """ context = self.context out = StringIO() map = { 'dtstamp': rfc2445dt(DateTime()), 'created': rfc2445dt(DateTime(context.CreationDate())), 'uid': IUUID(context), 'modified': rfc2445dt(DateTime(context.ModificationDate())), 'summary': vformat(context.Title()), 'startdate': rfc2445dt(context.start_date), 'enddate': rfc2445dt(context.end_date), } out.write(VCS_EVENT_START % map) description = context.Description() if description: out.write(foldLine('DESCRIPTION:%s\n' % vformat(description))) location = context.location if location: location = location.encode('utf-8') out.write('LOCATION:%s\n' % vformat(location)) out.write(VCS_EVENT_END) return out.getvalue()
def getVCal(self): """get vCal data """ context = self.context out = StringIO() map = { "dtstamp": rfc2445dt(DateTime()), "created": rfc2445dt(DateTime(context.CreationDate())), "uid": IUUID(context), "modified": rfc2445dt(DateTime(context.ModificationDate())), "summary": vformat(context.Title()), "startdate": rfc2445dt(context.start_date), "enddate": rfc2445dt(context.end_date), } out.write(VCS_EVENT_START % map) description = context.Description() if description: out.write(foldLine("DESCRIPTION:%s\n" % vformat(description))) location = context.location if location: location = location.encode("utf-8") out.write("LOCATION:%s\n" % vformat(location)) out.write(VCS_EVENT_END) return out.getvalue()