2 # -*- coding: utf-8 -*-
3 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
7 from slughifi import slughifi
8 from django.core.management import setup_environ
9 from wolnelektury import settings
11 setup_environ(settings)
13 from catalogue.models import Tag
16 doc = etree.parse('rodziny.xml')
18 for element in doc.findall('//span'):
19 themes = [s.strip() for s in element.text.split(',')]
25 Tag.objects.get(slug=slughifi(theme))
27 link = etree.SubElement(element, 'a', href=u'/katalog/%s' % slughifi(theme))
32 print "Pomijam %s" % slughifi(theme)
37 doc.write('ok.xml', xml_declaration=False, pretty_print=True, encoding='utf-8')