Show More
@@ -1,4 +1,6 b'' | |||
|
1 | 1 | import xml.etree.ElementTree as et |
|
2 | ||
|
3 | from boards.utils import get_file_mimetype | |
|
2 | 4 | from django.db import transaction |
|
3 | 5 | from boards.models import KeyPair, GlobalId, Signature, Post, Tag |
|
4 | 6 | |
@@ -73,6 +75,21 b' class SyncManager:' | |||
|
73 | 75 | pub_time = et.SubElement(content_tag, TAG_PUB_TIME) |
|
74 | 76 | pub_time.text = str(post.get_pub_time_str()) |
|
75 | 77 | |
|
78 | images = post.images.all() | |
|
79 | attachments = post.attachments.all() | |
|
80 | if len(images) > 0 or len(attachments) > 0: | |
|
81 | attachments_tag = et.SubElement(content_tag, TAG_ATTACHMENTS) | |
|
82 | for image in images: | |
|
83 | mimetype = get_file_mimetype(image.image.file) | |
|
84 | attachment = et.SubElement(attachments_tag, TAG_ATTACHMENT) | |
|
85 | attachment.set(ATTR_MIMETYPE, mimetype) | |
|
86 | attachment.text = image.hash | |
|
87 | for file in attachments: | |
|
88 | mimetype = get_file_mimetype(file.file.file) | |
|
89 | attachment = et.SubElement(attachments_tag, TAG_ATTACHMENT) | |
|
90 | attachment.set(ATTR_MIMETYPE, mimetype) | |
|
91 | attachment.text = file.hash | |
|
92 | ||
|
76 | 93 | signatures_tag = et.SubElement(model, TAG_SIGNATURES) |
|
77 | 94 | post_signatures = post.global_id.signature_set.all() |
|
78 | 95 | if post_signatures: |
General Comments 0
You need to be logged in to leave comments.
Login now