- def build_package(self, zippath, student, verbose):
- with open(zippath, 'w') as outf:
- zipf = zipfile.ZipFile(outf, 'w', zipfile.ZIP_STORED)
-
- for si, section in enumerate(Section.objects.all()):
- li = 1
- for lesson in section.lesson_set.all():
- if lesson.type == 'course':
- prefix = "%d_%s/%02d_%s/" % (
- si, section.slug,
- li, lesson.slug,
- )
- li += 1
- elif lesson.type == 'synthetic':
- prefix = "%d_%s/synteza_%s/" % (
- si, section.slug, lesson.slug)
- else:
- prefix = "%d_%s/%s/" % (
- si, section.slug, lesson.slug)
- lesson.add_to_zip(zipf, student, prefix)
- zipf.close()
-