[CalendarServer-changes] [7898] CalendarServer/branches/users/glyph/imip-and-admin-html/ twistedcaldav/test/test_mail.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 11 21:39:47 PDT 2011
Revision: 7898
http://trac.macosforge.org/projects/calendarserver/changeset/7898
Author: glyph at apple.com
Date: 2011-08-11 21:39:47 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
thwart the overly-simplistic template parser
Modified Paths:
--------------
CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py
Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py 2011-08-12 04:39:35 UTC (rev 7897)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/twistedcaldav/test/test_mail.py 2011-08-12 04:39:47 UTC (rev 7898)
@@ -586,7 +586,33 @@
["<test><alpha>hello</alpha>world</test>"])
+ def test_templateLoaderWithAttributes(self):
+ """
+ L{StringFormatTemplateLoader.load} will convert a template with
+ C{%(x)s}-format slots inside attributes into t:attr elements containing
+ t:slot slots.
+ """
+ class StubElement(Element):
+ loader = StringFormatTemplateLoader(
+ lambda : StringIO(
+ '<test><alpha beta="before %(slot1)s after">inner</alpha>'
+ '%(other)s</test>'
+ ),
+ "testRenderHere"
+ )
+ @renderer
+ def testRenderHere(self, request, tag):
+ return tag.fillSlots(slot1="hello",
+ other="world")
+ result = []
+ flattenString(None, StubElement()).addCallback(result.append)
+ self.assertEquals(result,
+ ['<test><alpha beta="before hello after">'
+ 'inner</alpha>world</test>'])
+
+
+
def partByType(message, contentType):
"""
Retrieve a MIME part from an L{email.message.Message} based on a content
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/895503f5/attachment-0001.html>
More information about the calendarserver-changes
mailing list