Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
email
Commits
63dbdeed5b08
Commit
3a7ae6e0
authored
Mar 04, 2009
by
Laure Bourgois
Browse files
adding html_escape to pass test.
parent
03cbdf6d6168
Changes
3
Hide whitespace changes
Inline
Side-by-side
entities.py
View file @
63dbdeed
...
...
@@ -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"""
return
self
.
email
def
actual_content
(
self
):
"""return content of this part with citations and signature removed
...
...
test/test_eemail.py
View file @
63dbdeed
...
...
@@ -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
'a@b.com'
)
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
...
...
views/email.py
View file @
63dbdeed
...
...
@@ -21,7 +21,7 @@ class EmailPrimaryView(baseviews.PrimaryView):
self
.
field
(
'to'
,
', '
.
join
(
ea
.
view
(
'oneline'
)
for
ea
in
entity
.
recipients
))
if
entity
.
cc
:
self
.
field
(
'cc'
,
', '
.
join
(
ea
.
view
(
'oneline'
)
for
ea
in
entity
.
cc
))
self
.
field
(
'subject'
,
entity
.
subject
)
self
.
field
(
'subject'
,
html_escape
(
entity
.
subject
)
)
self
.
field
(
'date'
,
self
.
format_date
(
entity
.
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
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment