Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
ea053dc1
Commit
ea053dc1
authored
May 16, 2016
by
Brian Fohl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
latest progress
parent
79f44357
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
common/djangoapps/student/views.py
+32
-0
No files found.
common/djangoapps/student/views.py
View file @
ea053dc1
...
...
@@ -6,6 +6,7 @@ import logging
import
uuid
import
json
import
warnings
import
os
from
collections
import
defaultdict
from
urlparse
import
urljoin
...
...
@@ -128,6 +129,10 @@ from openedx.core.djangoapps.credit.email_utils import get_credit_provider_displ
from
openedx.core.djangoapps.user_api.preferences
import
api
as
preferences_api
from
openedx.core.djangoapps.programs.utils
import
get_programs_for_dashboard
# SailThru integration
from
sailthru.sailthru_client
import
SailthruClient
from
sailthru.sailthru_error
import
SailthruClientError
log
=
logging
.
getLogger
(
"edx.student"
)
AUDIT_LOG
=
logging
.
getLogger
(
"audit"
)
...
...
@@ -1488,6 +1493,26 @@ def user_signup_handler(sender, **kwargs): # pylint: disable=unused-argument
log
.
info
(
u'user {} originated from a white labeled "Microsite"'
.
format
(
kwargs
[
'instance'
]
.
id
))
def
add_user_to_sailthru
(
user
):
try
:
sailthru_client
=
SailthruClient
(
os
.
environ
[
'SAILTHRU_API_KEY'
],
os
.
environ
[
'SAILTHRU_API_SECRET'
])
response
=
sailthru_client
.
api_post
(
"user"
,
user
)
except
SailthruClientError
as
e
:
# Handle exceptions
log
.
info
(
"Exception"
)
log
.
info
(
e
)
if
response
.
is_ok
():
body
=
response
.
get_body
()
# handle body which is of type dictionary
log
.
info
(
body
)
else
:
error
=
response
.
get_error
()
log
.
info
(
"Error: "
+
error
.
get_message
())
log
.
info
(
"Status Code: "
+
str
(
response
.
get_status_code
()))
log
.
info
(
"Error Code: "
+
str
(
error
.
get_error_code
()))
def
_do_create_account
(
form
,
custom_form
=
None
):
"""
Given cleaned post variables, create the User and UserProfile objects, as well as the
...
...
@@ -1729,6 +1754,7 @@ def create_account_with_params(request, params):
}
]
if
hasattr
(
settings
,
'MAILCHIMP_NEW_USER_LIST_ID'
):
identity_args
.
append
({
"MailChimp"
:
{
...
...
@@ -1754,6 +1780,12 @@ def create_account_with_params(request, params):
}
)
if
settings
.
FEATURES
.
get
(
'ENABLE_SAILTHRU'
):
sailthru_user
=
{
"id"
:
user
.
email
}
sailthru_user
[
'name'
]
=
profile
.
name
sailthru_user
[
'vars'
]
=
profile
add_user_to_sailthru
(
sailthru_user
)
create_comments_service_user
(
user
)
# Don't send email if we are:
...
...
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