Add image path in post data

This commit is contained in:
Emmanuelle Helly 2018-10-05 12:38:25 +02:00
parent 99d5c49286
commit a86c967ae7

View File

@ -112,11 +112,13 @@ def save_post(category, timestamp, admin, form, files):
continue
element = ElementTree.SubElement(tree, key)
element.text = value
if 'image' in files:
post_image = files['image']
filename = secure_filename(post_image.filename)
post_image.save(str(post.parent / filename))
element = ElementTree.SubElement(tree, 'image')
element.text = str(post.parent / filename)
element = ElementTree.SubElement(tree, STATE_PUBLISHED)
element.text = email.utils.formatdate(