Show More
@@ -21,7 +21,7 b' class Command(BaseCommand):' | |||||
21 | parser.add_argument('url', type=str, help='Server root url') |
|
21 | parser.add_argument('url', type=str, help='Server root url') | |
22 | parser.add_argument('--global-id', type=str, default='', |
|
22 | parser.add_argument('--global-id', type=str, default='', | |
23 | help='Post global ID') |
|
23 | help='Post global ID') | |
24 | parser.add_argument('--split-query', type=int, |
|
24 | parser.add_argument('--split-query', type=int, default=10, | |
25 | help='Split GET query into separate by the given' |
|
25 | help='Split GET query into separate by the given' | |
26 | ' number of posts in one') |
|
26 | ' number of posts in one') | |
27 |
|
27 | |||
@@ -74,7 +74,7 b' class Command(BaseCommand):' | |||||
74 | else: |
|
74 | else: | |
75 | version = 1 |
|
75 | version = 1 | |
76 | if not exists or global_id.post.version < version: |
|
76 | if not exists or global_id.post.version < version: | |
77 |
logger.debug(' |
|
77 | logger.debug('Processed (+) post {}'.format(global_id)) | |
78 | ids_to_sync.append(global_id) |
|
78 | ids_to_sync.append(global_id) | |
79 | else: |
|
79 | else: | |
80 | logger.debug('* Processed (-) post {}'.format(global_id)) |
|
80 | logger.debug('* Processed (-) post {}'.format(global_id)) |
@@ -1,4 +1,5 b'' | |||||
1 | import xml.etree.ElementTree as et |
|
1 | import xml.etree.ElementTree as et | |
|
2 | import logging | |||
2 |
|
3 | |||
3 | from boards.abstracts.exceptions import SyncException |
|
4 | from boards.abstracts.exceptions import SyncException | |
4 | from boards.models import KeyPair, GlobalId, Signature, Post, Tag |
|
5 | from boards.models import KeyPair, GlobalId, Signature, Post, Tag | |
@@ -53,6 +54,9 b" ID_TYPE_MD5 = 'md5'" | |||||
53 | STATUS_SUCCESS = 'success' |
|
54 | STATUS_SUCCESS = 'success' | |
54 |
|
55 | |||
55 |
|
56 | |||
|
57 | logger = logging.getLogger('boards.sync') | |||
|
58 | ||||
|
59 | ||||
56 | class SyncManager: |
|
60 | class SyncManager: | |
57 | @staticmethod |
|
61 | @staticmethod | |
58 | def generate_response_get(model_list: list): |
|
62 | def generate_response_get(model_list: list): | |
@@ -223,14 +227,14 b' class SyncManager:' | |||||
223 | post, title=title, text=text, pub_time=pub_time, |
|
227 | post, title=title, text=text, pub_time=pub_time, | |
224 | tags=tags, files=files, tripcode=tripcode, |
|
228 | tags=tags, files=files, tripcode=tripcode, | |
225 | version=version) |
|
229 | version=version) | |
226 |
|
|
230 | logger.debug('Parsed updated post {}'.format(global_id)) | |
227 | else: |
|
231 | else: | |
228 | Post.objects.import_post( |
|
232 | Post.objects.import_post( | |
229 | title=title, text=text, pub_time=pub_time, |
|
233 | title=title, text=text, pub_time=pub_time, | |
230 | opening_post=opening_post, tags=tags, |
|
234 | opening_post=opening_post, tags=tags, | |
231 | global_id=global_id, files=files, tripcode=tripcode, |
|
235 | global_id=global_id, files=files, tripcode=tripcode, | |
232 | version=version) |
|
236 | version=version) | |
233 |
|
|
237 | logger.debug('Parsed new post {}'.format(global_id)) | |
234 | else: |
|
238 | else: | |
235 | raise SyncException(EXCEPTION_NODE.format(tag_status.text)) |
|
239 | raise SyncException(EXCEPTION_NODE.format(tag_status.text)) | |
236 |
|
240 |
General Comments 0
You need to be logged in to leave comments.
Login now