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
cfd77f61
Commit
cfd77f61
authored
Sep 29, 2017
by
bmedx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update raw sql that uses datetimes to be Django 1.9 compatible
parent
f94558f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
2 deletions
+14
-2
openedx/core/djangoapps/heartbeat/default_checks.py
+1
-1
openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py
+13
-1
No files found.
openedx/core/djangoapps/heartbeat/default_checks.py
View file @
cfd77f61
...
@@ -51,7 +51,7 @@ def check_database():
...
@@ -51,7 +51,7 @@ def check_database():
"""
"""
cursor
=
connection
.
cursor
()
cursor
=
connection
.
cursor
()
try
:
try
:
cursor
.
execute
(
"SELECT
CURRENT_DATE
"
)
cursor
.
execute
(
"SELECT
1
"
)
cursor
.
fetchone
()
cursor
.
fetchone
()
return
'sql'
,
True
,
u'OK'
return
'sql'
,
True
,
u'OK'
except
DatabaseError
as
fail
:
except
DatabaseError
as
fail
:
...
...
openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py
View file @
cfd77f61
...
@@ -30,6 +30,7 @@ import optparse
...
@@ -30,6 +30,7 @@ import optparse
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.conf
import
settings
from
django.conf
import
settings
from
django.db
import
connections
from
django.db
import
connections
from
django.utils
import
timezone
from
opaque_keys.edx.keys
import
CourseKey
from
opaque_keys.edx.keys
import
CourseKey
from
xmodule.modulestore.django
import
modulestore
from
xmodule.modulestore.django
import
modulestore
...
@@ -255,6 +256,17 @@ class Command(BaseCommand):
...
@@ -255,6 +256,17 @@ class Command(BaseCommand):
row_count
=
0
row_count
=
0
for
row
in
self
.
_iterate_results
(
cursor
):
for
row
in
self
.
_iterate_results
(
cursor
):
user_id
,
username
,
email
,
full_name
,
course_id
,
is_opted_in
,
pref_set_datetime
=
row
user_id
,
username
,
email
,
full_name
,
course_id
,
is_opted_in
,
pref_set_datetime
=
row
if
pref_set_datetime
:
# TODO: Remove Django 1.11 upgrade shim
# SHIM: pref_set_datetime.tzinfo should always be None here after the 1.11 upgrade
# As of Django 1.9 datetimes returned from raw sql queries are no longer coerced to being tz aware
# so we correct for that here.
if
pref_set_datetime
.
tzinfo
is
None
or
pref_set_datetime
.
tzinfo
.
utcoffset
(
pref_set_datetime
)
is
None
:
pref_set_datetime
=
timezone
.
make_aware
(
pref_set_datetime
,
timezone
.
utc
)
else
:
pref_set_datetime
=
self
.
DEFAULT_DATETIME_STR
writer
.
writerow
({
writer
.
writerow
({
"user_id"
:
user_id
,
"user_id"
:
user_id
,
"username"
:
username
.
encode
(
'utf-8'
),
"username"
:
username
.
encode
(
'utf-8'
),
...
@@ -264,7 +276,7 @@ class Command(BaseCommand):
...
@@ -264,7 +276,7 @@ class Command(BaseCommand):
"full_name"
:
full_name
.
encode
(
'utf-8'
)
if
full_name
else
''
,
"full_name"
:
full_name
.
encode
(
'utf-8'
)
if
full_name
else
''
,
"course_id"
:
course_id
.
encode
(
'utf-8'
),
"course_id"
:
course_id
.
encode
(
'utf-8'
),
"is_opted_in_for_email"
:
is_opted_in
if
is_opted_in
else
"True"
,
"is_opted_in_for_email"
:
is_opted_in
if
is_opted_in
else
"True"
,
"preference_set_datetime"
:
pref_set_datetime
if
pref_set_datetime
else
self
.
DEFAULT_DATETIME_STR
,
"preference_set_datetime"
:
pref_set_datetime
,
})
})
row_count
+=
1
row_count
+=
1
...
...
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