Anonymized ID mapping fixups
Fixups to Nate's anonymized id mapper, repairing pep8 and pylint errors, and rebasing on recent master.
This commit is contained in:
@@ -1,19 +1,34 @@
|
||||
# -*- coding: utf8 -*-
|
||||
"""Dump username,unique_id_for_user pairs as CSV.
|
||||
|
||||
Give instructors easy access to the mapping from anonymized IDs to user IDs
|
||||
with a simple Django management command to generate a CSV mapping. To run, use
|
||||
the following:
|
||||
|
||||
rake django-admin[anonymized_id_mapping,x,y,z]
|
||||
|
||||
[Naturally, substitute the appropriate values for x, y, and z. (I.e.,
|
||||
lms, dev, and MITx/6.002x/Circuits)]"""
|
||||
|
||||
import csv
|
||||
import sys
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from student.models import unique_id_for_user
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
"""Add our handler to the space where django-admin looks up commands."""
|
||||
|
||||
# It appears that with the way Rake invokes these commands, we can't
|
||||
# have more than one arg passed through...annoying.
|
||||
args = ("course_id", )
|
||||
|
||||
help = """
|
||||
Exports a CSV document mapping from a username to the anonymized,
|
||||
unique user ID for every user in the specified course.
|
||||
help = """Export a CSV mapping usernames to anonymized ids
|
||||
|
||||
Exports a CSV document mapping each username in the specified course to
|
||||
the anonymized, unique user ID.
|
||||
"""
|
||||
|
||||
def handle(self, *args, **options):
|
||||
|
||||
Reference in New Issue
Block a user