Index: trac/web/chrome.py
===================================================================
--- trac/web/chrome.py	(revision 3692)
+++ trac/web/chrome.py	(working copy)
@@ -21,7 +21,7 @@
 from markup import Markup
 from markup.builder import tag
 from markup.output import DocType
-from markup.template import TemplateLoader
+from markup.template import TemplateLoader, Template, TextTemplate
 
 from trac import mimeview
 from trac.config import *
@@ -413,26 +413,27 @@
         if req:
             data['MARKUP_DEBUG'] = req.args.get('markup_debug')
 
-    def load_template(self, filename, req=None, data=None):
+    def load_template(self, filename, req=None, data=None, method=None):
         """Retrieve a Template and optionally preset the template data"""
         if req and data:
             self.populate_data(req, data)
         if not self.templateloader:
             self.templateloader = TemplateLoader(self.get_all_templates_dirs(),
                                                  auto_reload=self.auto_reload)
-        return self.templateloader.load(filename)
+        cls = method == 'text' and TextTemplate or Template
+        return self.templateloader.load(filename, cls=cls)
 
     def render_response(self, req, template_name, content_type, data):
-        self.populate_data(req, data)
-
-        stream = self.load_template(template_name).generate(**data)
-
         if content_type is None:
             content_type = 'text/html'
+        doctype = {'text/html': DocType.XHTML_STRICT}.get(content_type)
         method = {'text/html': 'xhtml',
                   'text/plain': 'text'}.get(content_type, 'xml')
-        doctype = {'text/html': DocType.XHTML_STRICT}.get(content_type)
+        
+        template = self.load_template(template_name, req, data, method=method)
+        stream = template.generate(**data)
 
         if method == 'text':
             return stream.render('text')
-        return stream.render(method, doctype=doctype)
+        else:
+            return stream.render(method, doctype=doctype)
Index: trac/notification.py
===================================================================
--- trac/notification.py	(revision 3692)
+++ trac/notification.py	(working copy)
@@ -96,7 +96,8 @@
         self.config = env.config
         self.db = env.get_db_cnx()
 
-        self.template = Chrome(self.env).load_template(self.template_name)
+        self.template = Chrome(self.env).load_template(self.template_name,
+                                                       method='text')
         self.data = {'CRLF': CRLF}
         Chrome(self.env).populate_data(None, self.data)
 
Index: templates/ticket_notify_email.txt
===================================================================
--- templates/ticket_notify_email.txt	(revision 3692)
+++ templates/ticket_notify_email.txt	(working copy)
@@ -1,56 +1,29 @@
-<mail xmlns:py="http://markup.edgewall.org/" py:strip=""><!--!
-
-  Some notes about how to handle white-spaces in text templates:
-
-  - every structure tag should be followed by a comment start: < ! - - !
-
-  - every tag but the first should be preceeded by a comment end: - - >
-
-  - text data following a new line will be inserted either directly,
-    by first ending the comment then placing the content on the same 
-    line, or inserted after a newline, by first closing the comment, 
-    then placing the data on a line of its own.
-
-  - after text data, a comment start should be started on a newline, 
-    which will effectively insert a newline. 
-    Sometimes though this is not wanted, for example when the data
-    itself ends with a newline... (see $changes_body below)
-
--->
 $ticket_body_hdr
 $ticket_props
-<!--! 
-  --><py:choose test="ticket.new"><!--!
-    --><py:when test="True"><!--!
--->
+#choose ticket.new
+  #when True
 $ticket.description
-<!--!
-    --></py:when><!--!
-    --><py:otherwise><!--!
-      --><py:if test="changes_body"><!--!
--->
+  #endwhen
+  #otherwise
+    #if changes_body
 Changes (by $change.author):
 
-$changes_body<!--!
-      --></py:if><!--!
-      --><py:if test="changes_descr"><!--!
--->
+$changes_body
+    #endif
+    #if changes_descr
 $changes_descr
 --
-<!--!
-      --></py:if><!--!
-      --><py:if test="change.comment"><!--!
--->
-Comment<py:if test="not changes_body"> (by $change.author)</py:if>:
+    #endif
+    #if change.comment
 
+Comment${not changes_body and '(by %s)' % change.author or ''}:
+
 $change.comment
-<!--!
-      --></py:if><!--!
-    --></py:otherwise><!--!
-  --></py:choose><!--!
--->
+    #endif
+  #endotherwise
+#endchoose
+
 -- 
 Ticket URL: &lt;$ticket.link&gt;
 $project.name &lt;${abs_href}&gt;
 $project.descr
-</mail>
\ No newline at end of file
