Show More
@@ -71,7 +71,9 b' class SyncManager:' | |||||
71 | signatures_tag = et.SubElement(model, TAG_SIGNATURES) |
|
71 | signatures_tag = et.SubElement(model, TAG_SIGNATURES) | |
72 | post_signatures = post.signature.all() |
|
72 | post_signatures = post.signature.all() | |
73 | if post_signatures: |
|
73 | if post_signatures: | |
74 |
signatures = post |
|
74 | signatures = post_signatures | |
|
75 | # TODO Adding signature to a post is not yet added. For now this | |||
|
76 | # block is useless | |||
75 | else: |
|
77 | else: | |
76 | # TODO Maybe the signature can be computed only once after |
|
78 | # TODO Maybe the signature can be computed only once after | |
77 | # the post is added? Need to add some on_save signal queue |
|
79 | # the post is added? Need to add some on_save signal queue | |
@@ -100,7 +102,7 b' class SyncManager:' | |||||
100 | for tag_model in tag_models: |
|
102 | for tag_model in tag_models: | |
101 | tag_content = tag_model.find(TAG_CONTENT) |
|
103 | tag_content = tag_model.find(TAG_CONTENT) | |
102 |
|
104 | |||
103 | valid = SyncManager.verify_model(tag_content, tag_model) |
|
105 | valid = SyncManager._verify_model(tag_content, tag_model) | |
104 |
|
106 | |||
105 | if not valid: |
|
107 | if not valid: | |
106 | raise Exception('Invalid model signature') |
|
108 | raise Exception('Invalid model signature') | |
@@ -128,6 +130,8 b' class SyncManager:' | |||||
128 | # TODO Check that the replied posts are already present |
|
130 | # TODO Check that the replied posts are already present | |
129 | # before adding new ones |
|
131 | # before adding new ones | |
130 |
|
132 | |||
|
133 | # TODO Get images | |||
|
134 | ||||
131 | post = Post.objects.import_post( |
|
135 | post = Post.objects.import_post( | |
132 | title=title, text=text, pub_time=pub_time, |
|
136 | title=title, text=text, pub_time=pub_time, | |
133 | opening_post=opening_post) |
|
137 | opening_post=opening_post) | |
@@ -137,7 +141,7 b' class SyncManager:' | |||||
137 | pass |
|
141 | pass | |
138 |
|
142 | |||
139 | @staticmethod |
|
143 | @staticmethod | |
140 | def verify_model(tag_content, tag_model): |
|
144 | def _verify_model(tag_content, tag_model): | |
141 | """ |
|
145 | """ | |
142 | Verifies all signatures for a single model. |
|
146 | Verifies all signatures for a single model. | |
143 | """ |
|
147 | """ |
General Comments 0
You need to be logged in to leave comments.
Login now