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
a5f9989c
Commit
a5f9989c
authored
Sep 26, 2013
by
Weblate
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
1a9dc60e
937246ea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
8 deletions
+10
-8
accounts/models.py
accounts/models.py
+10
-8
No files found.
accounts/models.py
View file @
a5f9989c
...
@@ -31,8 +31,7 @@ from registration.signals import user_registered
...
@@ -31,8 +31,7 @@ from registration.signals import user_registered
from
django.contrib.sites.models
import
Site
from
django.contrib.sites.models
import
Site
from
django.utils
import
translation
as
django_translation
from
django.utils
import
translation
as
django_translation
from
django.template.loader
import
render_to_string
from
django.template.loader
import
render_to_string
from
django.core.mail
import
EmailMultiAlternatives
from
django.core.mail
import
EmailMultiAlternatives
,
mail_admins
from
django.core.mail
import
mail_admins
from
south.signals
import
post_migrate
from
south.signals
import
post_migrate
...
@@ -160,12 +159,12 @@ def notify_new_comment(unit, comment, user, report_source_bugs):
...
@@ -160,12 +159,12 @@ def notify_new_comment(unit, comment, user, report_source_bugs):
'comment'
:
comment
,
'comment'
:
comment
,
'subproject'
:
unit
.
translation
.
subproject
,
'subproject'
:
unit
.
translation
.
subproject
,
},
},
from_email
=
user
.
email
,
user
=
user
,
)
)
def
send_notification_email
(
language
,
email
,
notification
,
translation_obj
,
def
send_notification_email
(
language
,
email
,
notification
,
translation_obj
,
context
=
None
,
headers
=
None
,
from_email
=
None
):
context
=
None
,
headers
=
None
,
user
=
None
):
'''
'''
Renders and sends notification email.
Renders and sends notification email.
'''
'''
...
@@ -201,7 +200,7 @@ def send_notification_email(language, email, notification, translation_obj,
...
@@ -201,7 +200,7 @@ def send_notification_email(language, email, notification, translation_obj,
context
[
'subject_template'
]
=
subject_template
context
[
'subject_template'
]
=
subject_template
# Render subject
# Render subject
subject
=
render_to_string
(
subject_template
,
context
)
subject
=
render_to_string
(
subject_template
,
context
)
.
strip
()
# Render body
# Render body
body
=
render_to_string
(
body_template
,
context
)
body
=
render_to_string
(
body_template
,
context
)
...
@@ -213,21 +212,24 @@ def send_notification_email(language, email, notification, translation_obj,
...
@@ -213,21 +212,24 @@ def send_notification_email(language, email, notification, translation_obj,
headers
[
'Precedence'
]
=
'bulk'
headers
[
'Precedence'
]
=
'bulk'
headers
[
'X-Mailer'
]
=
'Weblate %s'
%
weblate
.
VERSION
headers
[
'X-Mailer'
]
=
'Weblate %s'
%
weblate
.
VERSION
# Reply to header
if
user
is
not
None
:
headers
[
'Reply-To'
]
=
user
.
email
if
email
==
'ADMINS'
:
if
email
==
'ADMINS'
:
# Special handling for ADMINS
# Special handling for ADMINS
mail_admins
(
mail_admins
(
subject
.
strip
()
,
subject
,
body
,
body
,
html_message
=
html_body
html_message
=
html_body
)
)
else
:
else
:
# Create message
# Create message
email
=
EmailMultiAlternatives
(
email
=
EmailMultiAlternatives
(
settings
.
EMAIL_SUBJECT_PREFIX
+
subject
.
strip
()
,
settings
.
EMAIL_SUBJECT_PREFIX
+
subject
,
body
,
body
,
to
=
[
email
],
to
=
[
email
],
headers
=
headers
,
headers
=
headers
,
from_email
=
from_email
,
)
)
email
.
attach_alternative
(
email
.
attach_alternative
(
html_body
,
html_body
,
...
...
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