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
1acf2dbb
Commit
1acf2dbb
authored
Jan 16, 2013
by
Ashley Penney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a dictionary for all the pearson stuff to keep the auth/env stuff
clean.
parent
1d13b1a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
common/djangoapps/student/management/commands/pearson.py
+7
-5
common/djangoapps/student/management/commands/pearson_export_cdd.py
+4
-4
common/djangoapps/student/management/commands/pearson_export_ead.py
+4
-4
No files found.
common/djangoapps/student/management/commands/pearson.py
View file @
1acf2dbb
...
@@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand, CommandError
...
@@ -5,6 +5,7 @@ from django.core.management.base import BaseCommand, CommandError
import
re
import
re
from
dogapi
import
dog_http_api
,
dog_stats_api
from
dogapi
import
dog_http_api
,
dog_stats_api
import
paramiko
import
paramiko
import
boto
dog_http_api
.
api_key
=
settings
.
DATADOG_API
dog_http_api
.
api_key
=
settings
.
DATADOG_API
...
@@ -24,11 +25,11 @@ class Command(BaseCommand):
...
@@ -24,11 +25,11 @@ class Command(BaseCommand):
for
mode
in
args
:
for
mode
in
args
:
if
mode
==
'export'
:
if
mode
==
'export'
:
sftp
(
settings
.
PEARSON
_LOCAL_IMPORT
,
settings
.
PEARSON_SFTP_IMPORT
)
sftp
(
settings
.
PEARSON
[
LOCAL_IMPORT
],
settings
.
PEARSON
[
SFTP_IMPORT
]
)
s3
(
settings
.
PEARSON_LOCAL
,
settings
.
PEARSON
_BUCKET
)
s3
(
settings
.
PEARSON_LOCAL
,
settings
.
PEARSON
[
BUCKET
]
)
elif
mode
==
'import'
:
elif
mode
==
'import'
:
sftp
(
settings
.
PEARSON
_SFTP_EXPORT
,
settings
.
PEARSON_LOCAL_EXPORT
)
sftp
(
settings
.
PEARSON
[
SFTP_EXPORT
],
settings
.
PEARSON
[
LOCAL_EXPORT
]
)
s3
(
settings
.
PEARSON
_LOCAL_EXPORT
,
settings
.
PEARSON_BUCKET
)
s3
(
settings
.
PEARSON
[
LOCAL_EXPORT
],
settings
.
PEARSON
[
BUCKET
]
)
else
:
else
:
print
(
"ERROR: Mode must be export or import."
)
print
(
"ERROR: Mode must be export or import."
)
...
@@ -66,7 +67,8 @@ class Command(BaseCommand):
...
@@ -66,7 +67,8 @@ class Command(BaseCommand):
"""
"""
Upload file to S3
Upload file to S3
"""
"""
s3
=
boto
.
connect_s3
()
s3
=
boto
.
connect_s3
(
settings
.
AWS_ACCESS_KEY_ID
,
settings
.
AWS_SECRET_ACCESS_KEY
)
from
boto.s3.key
import
Key
from
boto.s3.key
import
Key
b
=
s3
.
get_bucket
(
bucket
)
b
=
s3
.
get_bucket
(
bucket
)
k
=
Key
(
b
)
k
=
Key
(
b
)
...
...
common/djangoapps/student/management/commands/pearson_export_cdd.py
View file @
1acf2dbb
...
@@ -48,12 +48,12 @@ class Command(BaseCommand):
...
@@ -48,12 +48,12 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# but it should at least be consistent with the other timestamps
# used in the system.
# used in the system.
if
not
os
.
path
.
isdir
(
settings
.
PEARSON
_LOCAL_EXPORT
):
if
not
os
.
path
.
isdir
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
):
os
.
makedirs
(
settings
.
PEARSON
_LOCAL_EXPORT
)
os
.
makedirs
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
)
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
_LOCAL_EXPORT
,
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
,
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
else
:
else
:
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
_LOCAL_EXPORT
,
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
,
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
...
...
common/djangoapps/student/management/commands/pearson_export_ead.py
View file @
1acf2dbb
...
@@ -50,12 +50,12 @@ class Command(BaseCommand):
...
@@ -50,12 +50,12 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# but it should at least be consistent with the other timestamps
# used in the system.
# used in the system.
if
not
os
.
path
.
isdir
(
settings
.
PEARSON
_LOCAL_EXPORT
):
if
not
os
.
path
.
isdir
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
):
os
.
makedirs
(
settings
.
PEARSON
_LOCAL_EXPORT
)
os
.
makedirs
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
)
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
_LOCAL_EXPORT
,
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
,
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
else
:
else
:
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
_LOCAL_EXPORT
,
destfile
=
os
.
path
.
join
(
settings
.
PEARSON
[
LOCAL_EXPORT
]
,
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
dump_all
=
kwargs
[
'dump_all'
]
dump_all
=
kwargs
[
'dump_all'
]
...
...
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