Commit 3a7ae6e0 authored by Laure Bourgois's avatar Laure Bourgois
Browse files

adding html_escape to pass test.

parent 03cbdf6d6168
......@@ -31,6 +31,10 @@ class Email(TreeMixIn, AnyEntity):
tree_attribute = 'reply_to'
def parent(self):
"""for breadcrumbs"""
return self.thread
def dc_title(self):
return self.subject
......@@ -115,6 +119,10 @@ class EmailPart(AnyEntity):
def email(self):
return self.reverse_parts[0]
def parent(self):
"""for breadcrumbs"""
def actual_content(self):
"""return content of this part with citations and signature removed
......@@ -2,22 +2,17 @@
from mx.DateTime import now
from cubicweb.devtools.testlib import WebTest, AutomaticWebTest
from cubicweb.devtools.testlib import AutomaticWebTest
class NonRegrViewTests(WebTest):
class AutomaticWebTest(AutomaticWebTest):
def to_test_etypes(self):
return set(('Email', 'EmailPart', 'EmailThread'))
def list_startup_views(self):
return ()
def test_nonregr_threadview(self):
et = self.add_entity('EmailThread', title=u'my et')
ea = self.add_entity('EmailAddress', address=u'')
em_rset = self.execute('INSERT Email E: E subject "yo R&D", E date %(date)s, E messageid "mid", '
'E sender EA, E in_thread ET WHERE ET eid %(et)s, EA eid %(ea)s',
{'et' : et.eid, 'ea' : ea.eid, 'date' : now()})
rset = self.execute('Any E WHERE E eid %(x)s', {'x' : et.eid})
self.view('primary', rset)
self.view('primary', em_rset)
if __name__ == '__main__':
from logilab.common.testlib import unittest_main
......@@ -21,7 +21,7 @@ class EmailPrimaryView(baseviews.PrimaryView):
self.field('to', ', '.join(ea.view('oneline') for ea in entity.recipients))
self.field('cc', ', '.join(ea.view('oneline') for ea in
self.field('subject', entity.subject)
self.field('subject', html_escape(entity.subject))
self.field('date', self.format_date(, time=True))
for part in entity.parts_in_order():
content, mime = part.content, part.content_format
......@@ -38,8 +38,9 @@ class EmailPrimaryView(baseviews.PrimaryView):
# def render_side_related(self, entity, siderelations):
# pass
def content_title(self, entity):
return entity.dc_title()
def render_entity_title(self, entity):
self.w(u'<h1><span class="etype">%s</span> %s</h1>'
% (entity.dc_type().capitalize(), html_escape(entity.dc_title())))
class EmailHeadersView(baseviews.EntityView):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment