add command to convert wl2 to wl1
[redakcja.git] / apps / catalogue / management / commands / wl2_to_wl1.py
1 # -*- coding: utf-8 -*-
2 from os.path import basename
3
4 from django.core.management.base import BaseCommand
5
6 from catalogue.xml_tools import wl2_to_wl1
7
8
9 class Command(BaseCommand):
10     help = 'Converts a lesson XML from WL2 to WL1'
11     args = 'filename'
12
13     def handle(self, filename, *args, **options):
14         slug = basename(filename).split('.')[0]
15         print wl2_to_wl1(open(filename).read(), slug)