Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
email
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cubicweb
cubes
email
Commits
7324eccb0915
Commit
7324eccb0915
authored
15 years ago
by
Sylvain Thénault
Browse files
Options
Downloads
Patches
Plain Diff
use sender from headers if no more linked
parent
56f5e28bb201
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
entities.py
+0
-1
0 additions, 1 deletion
entities.py
views/email.py
+22
-8
22 additions, 8 deletions
views/email.py
with
22 additions
and
9 deletions
entities.py
+
0
−
1
View file @
7324eccb
...
...
@@ -4,7 +4,6 @@
:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__
=
"
restructuredtext en
"
import
re
...
...
This diff is collapsed.
Click to expand it.
views/email.py
+
22
−
8
View file @
7324eccb
...
...
@@ -4,6 +4,8 @@
:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__
=
"
restructuredtext en
"
_
=
unicode
from
logilab.mtconverter
import
html_escape
...
...
@@ -25,7 +27,17 @@
uicfg
.
actionbox_appearsin_addmenu
.
tag_object_of
((
'
EmailThread
'
,
'
forked_from
'
,
'
EmailThread
'
),
True
)
def
formated_sender
(
email
):
if
email
.
sender
:
return
email
.
sender
[
0
].
view
(
'
oneline
'
)
# sender address has been removed, look in email's headers
message
=
email
.
umessage_headers
()
if
message
:
return
html_escape
(
message
.
get
(
'
From
'
))
return
email
.
req
.
_
(
'
unknown sender
'
)
class
EmailPrimaryView
(
primary
.
PrimaryView
):
__select__
=
implements
(
'
Email
'
)
def
render_entity_attributes
(
self
,
entity
):
...
...
@@ -28,8 +40,8 @@
class
EmailPrimaryView
(
primary
.
PrimaryView
):
__select__
=
implements
(
'
Email
'
)
def
render_entity_attributes
(
self
,
entity
):
self
.
field
(
'
from
'
,
entity
.
sender
[
0
].
view
(
'
oneline
'
))
self
.
field
(
'
from
'
,
formated_sender
(
entity
))
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
))
...
...
@@ -74,5 +86,4 @@
def
cell_call
(
self
,
row
,
col
,
contexteid
=
None
):
entity
=
self
.
entity
(
row
,
col
)
sender
=
entity
.
sender
[
0
]
self
.
w
(
u
'
<div class=
"
email
"
>
'
)
...
...
@@ -78,5 +89,6 @@
self
.
w
(
u
'
<div class=
"
email
"
>
'
)
self
.
w
(
u
'
<i>%s %s</i>
'
%
(
self
.
req
.
_
(
'
email_date
'
),
self
.
format_date
(
entity
.
date
,
time
=
True
)))
if
contexteid
!=
sender
.
eid
:
self
.
w
(
u
'
<i>%s %s</i>
'
%
(
self
.
req
.
_
(
'
email_date
'
),
self
.
format_date
(
entity
.
date
,
time
=
True
)))
sender
=
entity
.
senderaddr
if
sender
is
None
or
contexteid
!=
sender
.
eid
:
self
.
w
(
u
'
<b>%s</b> %s
'
...
...
@@ -82,6 +94,6 @@
self
.
w
(
u
'
<b>%s</b> %s
'
%
(
self
.
req
.
_
(
'
email_from
'
),
sender
.
view
(
'
oneline
'
)))
%
(
self
.
req
.
_
(
'
email_from
'
),
formated_sender
(
entity
)))
if
contexteid
not
in
(
r
.
eid
for
r
in
entity
.
recipients
):
recipients
=
'
,
'
.
join
(
r
.
view
(
'
oneline
'
)
for
r
in
entity
.
recipients
)
self
.
w
(
u
'
<b>%s</b> %s
'
%
(
self
.
req
.
_
(
'
email_to
'
),
recipients
))
...
...
@@ -84,9 +96,9 @@
if
contexteid
not
in
(
r
.
eid
for
r
in
entity
.
recipients
):
recipients
=
'
,
'
.
join
(
r
.
view
(
'
oneline
'
)
for
r
in
entity
.
recipients
)
self
.
w
(
u
'
<b>%s</b> %s
'
%
(
self
.
req
.
_
(
'
email_to
'
),
recipients
))
self
.
w
(
u
'
<br/>
\n
<a href=
"
%s
"
>%s</a>
'
%
(
html_escape
(
entity
.
absolute_url
()),
html_escape
(
entity
.
subject
)))
self
.
w
(
u
'
<br/>
\n
<a href=
"
%s
"
>%s</a>
'
%
(
html_escape
(
entity
.
absolute_url
()),
html_escape
(
entity
.
subject
)))
self
.
w
(
u
'
</div>
'
)
...
...
@@ -95,6 +107,7 @@
id
=
'
outofcontext
'
title
=
_
(
'
out of context
'
)
class
EmailInContextView
(
EmailOneLineView
):
"""
short view inside the context of the email
"""
id
=
'
incontext
'
...
...
@@ -115,6 +128,7 @@
item_vid
=
'
outofcontext
'
class
EmailThreadPrimaryView
(
primary
.
PrimaryView
):
__select__
=
implements
(
'
EmailThread
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment