[CalendarServer-changes] [9749] CalendarServer/trunk/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Tue Aug 28 08:28:11 PDT 2012
Revision: 9749
http://trac.macosforge.org/projects/calendarserver/changeset/9749
Author: sagen at apple.com
Date: 2012-08-28 08:28:09 -0700 (Tue, 28 Aug 2012)
Log Message:
-----------
Remove code which tries to find icons we haven't used in a couple years anyway
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/mail.py
CalendarServer/trunk/twistedcaldav/test/test_mail.py
Modified: CalendarServer/trunk/twistedcaldav/mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/mail.py 2012-08-27 14:31:35 UTC (rev 9748)
+++ CalendarServer/trunk/twistedcaldav/mail.py 2012-08-28 15:28:09 UTC (rev 9749)
@@ -29,7 +29,6 @@
from cStringIO import StringIO
-from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@@ -1405,32 +1404,6 @@
formattedFrom, recipient, addressWithToken))
- def getIconPath(self, details, canceled, language='en'):
- iconDir = config.Scheduling.iMIP.MailIconsDirectory.rstrip("/")
-
- if canceled:
- iconName = "canceled.png"
- iconPath = os.path.join(iconDir, iconName)
- if os.path.exists(iconPath):
- return iconPath
- else:
- return None
-
- else:
- month = int(details['month'])
- day = int(details['day'])
- with translationTo(language) as trans:
- monthName = trans.monthAbbreviation(month)
- iconName = "%02d.png" % (day,)
- iconPath = os.path.join(iconDir, monthName.encode("utf-8"), iconName)
- if not os.path.exists(iconPath):
- # Try the generic (numeric) version
- iconPath = os.path.join(iconDir, "%02d" % (month,), iconName)
- if not os.path.exists(iconPath):
- return None
- return iconPath
-
-
def generateEmail(self, inviteState, calendar, orgEmail, orgCN,
attendees, fromAddress, replyToAddress, toAddress,
language='en'):
@@ -1483,18 +1456,16 @@
details = self.getEventDetails(calendar, language=language)
canceled = (calendar.propertyValue("METHOD") == "CANCEL")
- iconPath = self.getIconPath(details, canceled, language=language)
subjectFormat, labels = localizedLabels(language, canceled, inviteState)
details.update(labels)
details['subject'] = subjectFormat % {'summary' : details['summary']}
- details['iconName'] = iconName = "calicon.png"
plainText = self.renderPlainText(details, (orgCN, orgEmail),
attendees, canceled)
- [addIcon, htmlText] = self.renderHTML(details, (orgCN, orgEmail),
+ htmlText = self.renderHTML(details, (orgCN, orgEmail),
attendees, canceled)
msg = MIMEMultipart()
@@ -1520,19 +1491,6 @@
msgHtml = MIMEText(htmlText, "html", "UTF-8")
msgHtmlRelated.attach(msgHtml)
- # an image for html version
- if addIcon and iconPath != None and os.path.exists(iconPath):
-
- with open(iconPath) as iconFile:
- msgIcon = MIMEImage(iconFile.read(),
- _subtype='png;x-apple-mail-type=stationery;name="%s"' %
- (iconName,))
-
- msgIcon.add_header("Content-ID", "<%s>" % (iconName,))
- msgIcon.add_header("Content-Disposition", "inline;filename=%s" %
- (iconName,))
- msgHtmlRelated.attach(msgIcon)
-
calendarText = str(calendar)
# the icalendar attachment
self.log_debug("Mail gateway sending calendar body: %s"
@@ -1584,10 +1542,7 @@
Render HTML message part based on invitation details and a flag
indicating whether the message is a cancellation.
- @return: a 2-tuple of (should add icon (C{bool}), html text (C{str},
- representing utf-8 encoded bytes)). The first element indicates
- whether the MIME generator needs to add a C{cid:} icon image part to
- satisfy the HTML links.
+ @return: html text (C{str}, representing utf-8 encoded bytes)).
"""
orgCN, orgEmail = organizer
@@ -1649,10 +1604,7 @@
flattenString(None, EmailElement()).addCallback(textCollector.append)
htmlText = textCollector[0]
- # If the template refers to an icon in a cid: link, it needs to be added
- # in the MIME.
- addIcon = (htmlTemplate.find("cid:%(iconName)s") != -1)
- return (addIcon, htmlText)
+ return htmlText
def getEventDetails(self, calendar, language='en'):
Modified: CalendarServer/trunk/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_mail.py 2012-08-27 14:31:35 UTC (rev 9748)
+++ CalendarServer/trunk/twistedcaldav/test/test_mail.py 2012-08-28 15:28:09 UTC (rev 9749)
@@ -17,7 +17,6 @@
from cStringIO import StringIO
from twisted.internet.defer import inlineCallbacks
-from twisted.python.filepath import FilePath
from twisted.python.modules import getModule
from twisted.web.template import Element, renderer, flattenString
from twistedcaldav.config import config, ConfigDict
@@ -184,21 +183,6 @@
self.assertEquals(retrieved, token)
-
- def test_iconPath(self):
- iconPath = self.handler.getIconPath({'day':'1', 'month':'1'}, False,
- language='en')
- iconDir = FilePath("/usr/share/caldavd/share/date_icons")
-
- if iconDir.exists():
- if iconDir.child("JAN").child("01.png"):
- monthName = "JAN"
- else:
- monthName = "01"
- monthPath = iconDir.child(monthName)
- self.assertEquals(iconPath, monthPath.child("01.png").path)
-
-
def test_checkDSNFailure(self):
data = {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120828/002147a9/attachment.html>
More information about the calendarserver-changes
mailing list