Commit 96d94674 authored by fred's avatar fred
Browse files

also load 'events' rubrique of spip, to create more news

parent 5f1e9840
......@@ -108,13 +108,29 @@ class Command(BaseCommand):
for article_xml in root.iter('spip_articles'):
if not article_xml.find('id_rubrique').text in emission_rubric_ids:
if article_xml.find('id_rubrique').text == '65':
pass # rubric for events, handle with care
elif not article_xml.find('id_rubrique').text in emission_rubric_ids:
article = Article()
for attr in ('id_rubrique', 'id_article', 'titre', 'surtitre',
'soustitre', 'descriptif', 'chapo', 'texte',
'date_redac', 'statut'):
'date_redac', 'statut', 'date'):
setattr(article, attr, article_xml.find(attr).text)
if article.id_rubrique == '65':
# this is an event, they get a special handling, to be
# merged with newsitems
if article.statut not in ('publie', 'prop'):
breve = Breve()
breve.id_breve = '0%s' % article.id_article
breve.titre = article.titre
breve.texte = article.texte
breve.date_heure =
breves[breve.id_breve] = breve
if article.statut != 'publie':
article.mots_cles = []
......@@ -139,14 +155,17 @@ class Command(BaseCommand):
for spip_url_xml in root.iter('spip_urls'):
id_objet = spip_url_xml.find('id_objet').text
url = spip_url_xml.find('url').text
if spip_url_xml.find('type').text == 'article' and id_objet in articles:
articles[spip_url_xml.find('id_objet').text].url = spip_url_xml.find('url').text
articles[id_objet].url = url
elif spip_url_xml.find('type').text == 'article' and ('0%s' % id_objet) in breves:
breves['0' + id_objet].url = url
elif spip_url_xml.find('type').text == 'rubrique' and id_objet in rubrics:
rubrics[spip_url_xml.find('id_objet').text].url = spip_url_xml.find('url').text
rubrics[id_objet].url = url
elif spip_url_xml.find('type').text == 'mot' and id_objet in keywords:
keywords[spip_url_xml.find('id_objet').text].url = spip_url_xml.find('url').text
keywords[id_objet].url = url
elif spip_url_xml.find('type').text == 'breve' and id_objet in breves:
breves[spip_url_xml.find('id_objet').text].url = spip_url_xml.find('url').text
breves[id_objet].url = url
for spip_doc_xml in root.iter('spip_documents'):
id_document = spip_doc_xml.find('id_document').text
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment