Commit 07037b05 authored by fred's avatar fred
Browse files

get breve logo as image if it exists

parent a83f36f6
......@@ -259,6 +259,7 @@ class Command(BaseCommand):
for ext in ('.jpg', '.png', '.gif'):
if os.path.exists('media/IMG/rubon%s%s' % (rubric.id_rubrique, ext)):
image_path = ['media/IMG/rubon%s%s' % (rubric.id_rubrique, ext)]
break
else:
if emission.text:
image_path = re.findall('src="/(media/IMG.*?)"', emission.text, re.DOTALL)
......@@ -348,7 +349,12 @@ class Command(BaseCommand):
newsitem.text = makeHtmlFromSpip(breve.texte,
documents=documents) or None
newsitem.datetime = datetime.strptime(breve.date_heure, '%Y-%m-%d %H:%M:%S')
image_path = re.findall('src="/(media/IMG.*?)"', newsitem.text, re.DOTALL)
for ext in ('.jpg', '.png', '.gif'):
if os.path.exists('media/IMG/breveon%s%s' % (breve.id_breve, ext)):
image_path = ['media/IMG/breveon%s%s' % (breve.id_breve, ext)]
break
else:
image_path = re.findall('src="/(media/IMG.*?)"', newsitem.text, re.DOTALL)
self.set_image(newsitem, image_path)
newsitem.save()
......
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