<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[14962] CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/14962">14962</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2015-07-14 13:58:41 -0700 (Tue, 14 Jul 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Fix iMIP send failures when organizer CN is missing or contains non-ascii characters.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimipoutboundpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/outbound.py</a></li>
<li><a href="#CalendarServertrunktxdavcaldavdatastoreschedulingimiptesttest_outboundpy">CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimipoutboundpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/outbound.py (14961 => 14962)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/outbound.py        2015-07-13 21:16:34 UTC (rev 14961)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/outbound.py        2015-07-14 20:58:41 UTC (rev 14962)
</span><span class="lines">@@ -453,6 +453,8 @@
</span><span class="cx"> orgEmail = organizerMailto[7:]
</span><span class="cx">
</span><span class="cx"> orgCN = calendar.getOrganizerProperty().parameterValue('CN', None)
</span><ins>+ if orgCN:
+ orgCN = orgCN.decode("utf-8")
</ins><span class="cx"> addressWithToken = formattedFrom
</span><span class="cx">
</span><span class="cx"> # At the point we've created the token in the db, which we always
</span><span class="lines">@@ -663,8 +665,9 @@
</span><span class="cx"> # template stuff, and once again, it's just a 'mailto:'.
</span><span class="cx"> # tags.a(href="mailto:"+email)[cn]
</span><span class="cx"> if orgEmail:
</span><del>- details['htmlOrganizer'] = tags.a(href="mailto:%s" % (orgEmail,))(
- orgCN)
</del><ins>+ if not orgCN:
+ orgCN = orgEmail
+ details['htmlOrganizer'] = tags.a(href="mailto:%s" % (orgEmail,))(orgCN)
</ins><span class="cx"> else:
</span><span class="cx"> details['htmlOrganizer'] = orgCN
</span><span class="cx">
</span></span></pre></div>
<a id="CalendarServertrunktxdavcaldavdatastoreschedulingimiptesttest_outboundpy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py (14961 => 14962)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py        2015-07-13 21:16:34 UTC (rev 14961)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/imip/test/test_outbound.py        2015-07-14 20:58:41 UTC (rev 14962)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with "<" and "&"
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-"""
</del><ins>+""".encode("utf-8")
</ins><span class="cx">
</span><span class="cx"> inviteTextNoTimezone = u"""BEGIN:VCALENDAR
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with "<" and "&"
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-"""
</del><ins>+""".encode("utf-8")
</ins><span class="cx">
</span><span class="cx"> inviteTextWithTimezone = u"""BEGIN:VCALENDAR
</span><span class="cx"> VERSION:2.0
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx"> DESCRIPTION:awesome description with "<" and "&"
</span><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-"""
</del><ins>+""".encode("utf-8")
</ins><span class="cx">
</span><span class="cx"> ORGANIZER = "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A"
</span><span class="cx"> ATTENDEE = "mailto:attendee@example.com"
</span><span class="lines">@@ -400,63 +400,63 @@
</span><span class="cx">
</span><span class="cx"> # Update
</span><span class="cx"> (
</span><del>- """BEGIN:VCALENDAR
</del><ins>+ u"""BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> METHOD:REQUEST
</span><span class="cx"> BEGIN:VEVENT
</span><span class="cx"> UID:CFDD5E46-4F74-478A-9311-B3FF905449C3
</span><span class="cx"> DTSTART:20100325T154500Z
</span><span class="cx"> DTEND:20100325T164500Z
</span><del>-ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:
</del><ins>+ATTENDEE;CN=Th\xe9 Attendee;CUTYPE=INDIVIDUAL;PARTSTAT=NEEDS-ACTION;RSVP=TRUE:
</ins><span class="cx"> mailto:attendee@example.com
</span><del>-ATTENDEE;CN=The Organizer;CUTYPE=INDIVIDUAL;EMAIL=organizer@example.com;PAR
</del><ins>+ATTENDEE;CN=Th\xe9 Organizer;CUTYPE=INDIVIDUAL;EMAIL=organizer@example.com;PAR
</ins><span class="cx"> TSTAT=ACCEPTED:urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A
</span><del>-ORGANIZER;CN=The Organizer;EMAIL=organizer@example.com:urn:uuid:C3B38B00-41
</del><ins>+ORGANIZER;CN=Th\xe9 Organizer;EMAIL=organizer@example.com:urn:uuid:C3B38B00-41
</ins><span class="cx"> 66-11DD-B22C-A07C87E02F6A
</span><del>-SUMMARY:testing outbound( ) *update*
</del><ins>+SUMMARY:t\xe9sting outbound( ) *update*
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-""",
</del><ins>+""".encode("utf-8"),
</ins><span class="cx"> "CFDD5E46-4F74-478A-9311-B3FF905449C3",
</span><span class="cx"> "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A",
</span><span class="cx"> "mailto:attendee@example.com",
</span><span class="cx"> "update",
</span><span class="cx"> "organizer@example.com",
</span><del>- "The Organizer",
</del><ins>+ u"Th\xe9 Organizer",
</ins><span class="cx"> [
</span><del>- (u'The Attendee', u'attendee@example.com'),
- (u'The Organizer', u'organizer@example.com')
</del><ins>+ (u'Th\xe9 Attendee', u'attendee@example.com'),
+ (u'Th\xe9 Organizer', u'organizer@example.com')
</ins><span class="cx"> ],
</span><del>- "The Organizer <organizer@example.com>",
- "The Organizer <organizer@example.com>",
</del><ins>+ u"Th\xe9 Organizer <organizer@example.com>",
+ "=?utf-8?q?Th=C3=A9_Organizer_=3Corganizer=40example=2Ecom=3E?=",
</ins><span class="cx"> "attendee@example.com",
</span><span class="cx"> ),
</span><span class="cx">
</span><span class="cx"> # Reply
</span><span class="cx"> (
</span><del>- """BEGIN:VCALENDAR
</del><ins>+ u"""BEGIN:VCALENDAR
</ins><span class="cx"> VERSION:2.0
</span><span class="cx"> METHOD:REPLY
</span><span class="cx"> BEGIN:VEVENT
</span><span class="cx"> UID:DFDD5E46-4F74-478A-9311-B3FF905449C4
</span><span class="cx"> DTSTART:20100325T154500Z
</span><span class="cx"> DTEND:20100325T164500Z
</span><del>-ATTENDEE;CN=The Attendee;CUTYPE=INDIVIDUAL;EMAIL=attendee@example.com;PARTST
</del><ins>+ATTENDEE;CN=Th\xe9 Attendee;CUTYPE=INDIVIDUAL;EMAIL=attendee@example.com;PARTST
</ins><span class="cx"> AT=ACCEPTED:urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A
</span><del>-ORGANIZER;CN=The Organizer;EMAIL=organizer@example.com:mailto:organizer@exam
</del><ins>+ORGANIZER;CN=Th\xe9 Organizer;EMAIL=organizer@example.com:mailto:organizer@exam
</ins><span class="cx"> ple.com
</span><del>-SUMMARY:testing outbound( ) *reply*
</del><ins>+SUMMARY:t\xe9sting outbound( ) *reply*
</ins><span class="cx"> END:VEVENT
</span><span class="cx"> END:VCALENDAR
</span><del>-""",
</del><ins>+""".encode("utf-8"),
</ins><span class="cx"> None,
</span><span class="cx"> "urn:uuid:C3B38B00-4166-11DD-B22C-A07C87E02F6A",
</span><span class="cx"> "mailto:organizer@example.com",
</span><span class="cx"> "reply",
</span><span class="cx"> "organizer@example.com",
</span><del>- "The Organizer",
</del><ins>+ u"Th\xe9 Organizer",
</ins><span class="cx"> [
</span><del>- (u'The Attendee', u'attendee@example.com'),
</del><ins>+ (u'Th\xe9 Attendee', u'attendee@example.com'),
</ins><span class="cx"> ],
</span><span class="cx"> "attendee@example.com",
</span><span class="cx"> "attendee@example.com",
</span><span class="lines">@@ -635,6 +635,48 @@
</span><span class="cx"> self.assertEquals(actualTypes, expectedTypes)
</span><span class="cx">
</span><span class="cx">
</span><ins>+ def test_generateEmail_noOrganizerCN(self):
+ """
+ L{MailHandler.generateEmail} generates a MIME-formatted email when
+ the organizer property has no CN parameter.
+ """
+ calendar = Component.fromString(initialInviteText)
+ _ignore_msgID, msgTxt = self.sender.generateEmail(
+ inviteState='new',
+ calendar=calendar,
+ orgEmail=u"user01@localhost",
+ orgCN=None,
+ attendees=[(u"Us\xe9r One", "user01@localhost"),
+ (u"User 2", "user02@localhost")],
+ fromAddress="user01@localhost",
+ replyToAddress="imip-system@localhost",
+ toAddress="user03@localhost",
+ )
+ message = email.message_from_string(msgTxt)
+ self.assertTrue(message is not None)
+
+
+ def test_generateEmail_noAttendeeCN(self):
+ """
+ L{MailHandler.generateEmail} generates a MIME-formatted email when
+ the attendee property has no CN parameter.
+ """
+ calendar = Component.fromString(initialInviteText)
+ _ignore_msgID, msgTxt = self.sender.generateEmail(
+ inviteState='new',
+ calendar=calendar,
+ orgEmail=u"user01@localhost",
+ orgCN=u"User Z\xe9ro One",
+ attendees=[(None, "user01@localhost"),
+ (None, "user02@localhost")],
+ fromAddress="user01@localhost",
+ replyToAddress="imip-system@localhost",
+ toAddress="user03@localhost",
+ )
+ message = email.message_from_string(msgTxt)
+ self.assertTrue(message is not None)
+
+
</ins><span class="cx"> def test_messageID(self):
</span><span class="cx"> """
</span><span class="cx"> L{SMTPSender.betterMessageID} generates a Message-ID domain matching
</span></span></pre>
</div>
</div>
</body>
</html>