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
0555ebc4
Commit
0555ebc4
authored
Jan 16, 2013
by
Ashley Penney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bunch of fixes to how I do if/else checks, fix a typo in Command and
repair the for filename part of sftp.
parent
378b1ff0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
19 deletions
+16
-19
common/djangoapps/student/management/commands/pearson_export_cdd.py
+6
-8
common/djangoapps/student/management/commands/pearson_export_ead.py
+7
-8
common/djangoapps/student/management/commands/pearson_transfer.py
+3
-3
No files found.
common/djangoapps/student/management/commands/pearson_export_cdd.py
View file @
0555ebc4
...
...
@@ -44,7 +44,7 @@ class Command(BaseCommand):
default
=
False
,
help
=
'Retrieve the destination to export to from django? True/False'
),
make_option
(
'--destination'
,
action
=
'store
_true
'
,
action
=
'store'
,
dest
=
'destination'
,
default
=
None
,
help
=
'Where to store the exported files'
)
...
...
@@ -61,24 +61,22 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# used in the system.
if
options
[
'dest-from-settings'
]
is
True
:
if
settings
.
PEARSON
[
LOCAL_EXPORT
]
:
if
'dest-from-settings'
in
options
:
if
LOCAL_EXPORT
in
settings
.
PEARSON
:
dest
=
settings
.
PEARSON
[
LOCAL_EXPORT
]
else
:
raise
CommandError
(
'--dest-from-settings was enabled but the'
'PEARSON[LOCAL_EXPORT] setting was not set.'
)
elif
options
[
'destination'
]
:
elif
'destination'
in
options
:
dest
=
options
[
'destination'
]
else
:
raise
Com
am
ndError
(
'--destination or --dest-from-settings must be used'
)
raise
Com
ma
ndError
(
'--destination or --dest-from-settings must be used'
)
if
not
os
.
path
.
isdir
(
dest
):
os
.
makedirs
(
dest
)
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
else
:
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"cdd-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
# strings must be in latin-1 format. CSV parser will
# otherwise convert unicode objects to ascii.
...
...
common/djangoapps/student/management/commands/pearson_export_ead.py
View file @
0555ebc4
...
...
@@ -30,7 +30,7 @@ class Command(BaseCommand):
default
=
False
,
help
=
'Retrieve the destination to export to from django? True/False'
),
make_option
(
'--destination'
,
action
=
'store
_true
'
,
action
=
'store'
,
dest
=
'destination'
,
default
=
None
,
help
=
'Where to store the exported files'
),
...
...
@@ -55,22 +55,21 @@ class Command(BaseCommand):
# Name will use timestamp -- this is UTC, so it will look funny,
# but it should at least be consistent with the other timestamps
# used in the system.
if
options
[
'dest-from-settings'
]
is
True
:
if
settings
.
PEARSON
[
LOCAL_EXPORT
]
:
if
'dest-from-settings'
in
options
:
if
LOCAL_EXPORT
in
settings
.
PEARSON
:
dest
=
settings
.
PEARSON
[
LOCAL_EXPORT
]
else
:
raise
CommandError
(
'--dest-from-settings was enabled but the'
'PEARSON[LOCAL_EXPORT] setting was not set.'
)
elif
options
[
'destination'
]
:
elif
destinations
in
options
:
dest
=
options
[
'destination'
]
else
:
raise
Com
am
ndError
(
'--destination or --dest-from-settings must be used'
)
raise
Com
ma
ndError
(
'--destination or --dest-from-settings must be used'
)
if
not
os
.
path
.
isdir
(
dest
):
os
.
makedirs
(
dest
)
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
else
:
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
destfile
=
os
.
path
.
join
(
dest
,
uploaded_at
.
strftime
(
"ead-
%
Y
%
m
%
d-
%
H
%
M
%
S.dat"
))
dump_all
=
kwargs
[
'dump_all'
]
...
...
common/djangoapps/student/management/commands/pearson_transfer.py
View file @
0555ebc4
...
...
@@ -14,7 +14,7 @@ class Command(BaseCommand):
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'--mode'
,
action
=
'store
_true
'
,
action
=
'store'
,
dest
=
'mode'
,
default
=
'both'
,
help
=
'mode is import, export, or both'
),
...
...
@@ -55,11 +55,11 @@ class Command(BaseCommand):
password
=
settings
.
PEARSON
[
SFTP_PASSWORD
])
sftp
=
paramiko
.
SFTPClient
.
from_transport
(
t
)
if
os
.
path
.
isdir
(
files_from
):
for
file
in
os
.
listdir
(
files_from
):
for
file
name
in
os
.
listdir
(
files_from
):
sftp
.
put
(
files_from
+
'/'
+
filename
,
files_to
+
'/'
+
filename
)
else
:
for
file
in
sftp
.
listdir
(
files_from
):
for
file
name
in
sftp
.
listdir
(
files_from
):
sftp
.
get
(
files_from
+
'/'
+
filename
,
files_to
+
'/'
+
filename
)
except
:
...
...
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