Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
8928ce94
Commit
8928ce94
authored
Aug 27, 2014
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify templates rendering
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
11ea1383
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
weblate/accounts/models.py
weblate/accounts/models.py
+16
-8
No files found.
weblate/accounts/models.py
View file @
8928ce94
...
...
@@ -199,10 +199,10 @@ def send_notification_email(language, email, notification,
if
language
is
not
None
:
django_translation
.
activate
(
language
)
# Template name
s
subject_template
=
'mail/{}_subject.txt'
.
format
(
notification
)
body_template
=
'mail/{}.txt'
.
format
(
notification
)
html_body_template
=
'mail/{}.html'
.
format
(
notification
)
# Template name
context
[
'subject_template'
]
=
'mail/{}_subject.txt'
.
format
(
notification
)
# Adjust context
context
[
'current_site_url'
]
=
get_site_url
()
...
...
@@ -211,15 +211,23 @@ def send_notification_email(language, email, notification,
context
[
'translation_url'
]
=
get_site_url
(
translation_obj
.
get_absolute_url
()
)
context
[
'subject_template'
]
=
subject_template
context
[
'site_title'
]
=
SITE_TITLE
# Render subject
subject
=
render_to_string
(
subject_template
,
context
).
strip
()
subject
=
render_to_string
(
context
[
'subject_template'
],
context
).
strip
()
# Render body
body
=
render_to_string
(
body_template
,
context
)
html_body
=
render_to_string
(
html_body_template
,
context
)
body
=
render_to_string
(
'mail/{}.txt'
.
format
(
notification
),
context
)
html_body
=
render_to_string
(
'mail/{}.html'
.
format
(
notification
),
context
)
# Define headers
headers
[
'Auto-Submitted'
]
=
'auto-generated'
...
...
Write
Preview
Markdown
is supported
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