1 # -*- coding: utf-8 -*-
3 from slughifi import slughifi
4 from django.core.management import setup_environ
5 from wolnelektury import settings
7 setup_environ(settings)
9 from catalogue.models import Tag
12 doc = etree.parse('rodziny.xml')
14 for element in doc.findall('//span'):
15 themes = [s.strip() for s in element.text.split(',')]
21 Tag.objects.get(slug=slughifi(theme))
23 link = etree.SubElement(element, 'a', href=u'/katalog/%s' % slughifi(theme))
28 print "Pomijam %s" % slughifi(theme)
33 doc.write('ok.xml', xml_declaration=False, pretty_print=True, encoding='utf-8')