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
6c1181c7
Commit
6c1181c7
authored
Aug 07, 2014
by
Matt Drayer
Committed by
Jonathan Piacenti
Aug 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mattdrayer/api-migration-logging: Added logging to script exceptions
parent
96eef439
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
lms/djangoapps/api_manager/management/commands/migrate_courseids.py
+12
-0
lms/djangoapps/projects/management/commands/migrate_courseids.py
+15
-0
No files found.
lms/djangoapps/api_manager/management/commands/migrate_courseids.py
View file @
6c1181c7
"""
One-time data migration script -- shoulen't need to run it again
"""
import
logging
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
from
django.test
import
RequestFactory
...
...
@@ -9,6 +11,8 @@ from api_manager import models as api_models
from
api_manager.courseware_access
import
get_course
,
get_course_child
from
opaque_keys
import
InvalidKeyError
log
=
logging
.
getLogger
(
__name__
)
class
Command
(
BaseCommand
):
"""
...
...
@@ -35,6 +39,10 @@ class Command(BaseCommand):
try
:
ccg
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
ccg
.
content_id
)
except
InvalidKeyError
:
log
.
warning
(
'Unable to convert content_id "{}"'
.
format
(
ccg
.
content_id
),
exc_info
=
True
)
pass
# If the key conversion fails it was either a new-style key or junk data
ccg
.
save
()
...
...
@@ -46,5 +54,9 @@ class Command(BaseCommand):
try
:
cmc
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
cmc
.
content_id
)
except
InvalidKeyError
:
log
.
warning
(
'Unable to convert content_id "{}"'
.
format
(
cmc
.
content_id
),
exc_info
=
True
)
pass
# If the key conversion fails it was either a new-style key or junk data
cmc
.
save
()
lms/djangoapps/projects/management/commands/migrate_courseids.py
View file @
6c1181c7
"""
One-time data migration script -- shoulen't need to run it again
"""
import
logging
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
from
django.test
import
RequestFactory
...
...
@@ -9,6 +11,7 @@ from api_manager.courseware_access import get_course, get_course_child
from
opaque_keys
import
InvalidKeyError
from
project.models
import
Project
,
WorkgroupReview
,
WorkgroupSubmissionReview
log
=
logging
.
getLogger
(
__name__
)
class
Command
(
BaseCommand
):
"""
...
...
@@ -27,6 +30,10 @@ class Command(BaseCommand):
try
:
project
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
project
.
content_id
)
except
InvalidKeyError
:
log
.
warning
(
'Unable to convert content_id "{}"'
.
format
(
project
.
content_id
),
exc_info
=
True
)
pass
# If the key conversion fails it was either a new-style key or junk data
project
.
save
()
...
...
@@ -37,6 +44,10 @@ class Command(BaseCommand):
try
:
wr
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
wr
.
content_id
)
except
InvalidKeyError
:
log
.
warning
(
'Unable to convert content_id "{}"'
.
format
(
wr
.
content_id
),
exc_info
=
True
)
pass
# If the key conversion fails it was either a new-style key or junk data
wr
.
save
()
...
...
@@ -47,5 +58,9 @@ class Command(BaseCommand):
try
:
wsr
.
content_id
=
course_key
.
make_usage_key_from_deprecated_string
(
wsr
.
content_id
)
except
InvalidKeyError
:
log
.
warning
(
'Unable to convert content_id "{}"'
.
format
(
wsr
.
content_id
),
exc_info
=
True
)
pass
# If the key conversion fails it was either a new-style key or junk data
wsr
.
save
()
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