'Check that the course has been exported. If not, export it.'

def _ensure_exported(self):

    exported_course_path = os.path.join(self.root_export_dir, self.export_dir)
    if (not (os.path.exists(exported_course_path) and os.path.isdir(exported_course_path))):
        export_course_to_xml(self.store, self.contentstore, self.course.id, self.root_export_dir, self.export_dir)
