Exemplo n.º 1
0
    def handle(self, *args, **options):

        if options['all']:
            course_keys = [course.id for course in modulestore().get_courses()]
        else:
            course_keys = [CourseKey.from_string(arg) for arg in args]

        if not course_keys:
            logger.fatal('No courses specified.')
            return

        logger.info('Generating course structures for %d courses.',
                    len(course_keys))
        logging.debug(
            'Generating course structure(s) for the following courses: %s',
            course_keys)

        for course_key in course_keys:
            try:
                update_course_structure(course_key)
            except Exception as e:
                logger.error(
                    'An error occurred while generating course structure for %s: %s',
                    unicode(course_key), e)

        logger.info('Finished generating course structures.')
Exemplo n.º 2
0
    def setUp(self):
        super(CourseStructureTests, self).setUp()

        # Ensure course structure exists for the course
        update_course_structure(self.course.id)