##// END OF EJS Templates
Added limit option to sync command
neko259 -
r1551:a596995d default
parent child Browse files
Show More
@@ -20,6 +20,9 b' class Command(BaseCommand):'
20 20 parser.add_argument('url', type=str, help='Server root url')
21 21 parser.add_argument('--global-id', type=str, default='',
22 22 help='Post global ID')
23 parser.add_argument('--split-query', type=int,
24 help='Split GET query into separate by the given'
25 ' number of posts in one')
23 26
24 27 def handle(self, *args, **options):
25 28 url = options.get('url')
@@ -68,12 +71,14 b' class Command(BaseCommand):'
68 71 print()
69 72
70 73 if len(ids_to_sync) > 0:
71 xml = GlobalId.objects.generate_request_get(ids_to_sync)
72 # body = urllib.parse.urlencode(data)
73 h = httplib2.Http()
74 response, content = h.request(get_url, method="POST", body=xml)
74 limit = options.get('split_query', len(ids_to_sync))
75 for offset in range(0, len(ids_to_sync), limit):
76 xml = GlobalId.objects.generate_request_get(ids_to_sync[offset:offset+limit0])
77 # body = urllib.parse.urlencode(data)
78 h = httplib2.Http()
79 response, content = h.request(get_url, method="POST", body=xml)
75 80
76 SyncManager.parse_response_get(content, file_url)
81 SyncManager.parse_response_get(content, file_url)
77 82 else:
78 83 print('Nothing to get, everything synced')
79 84 else:
General Comments 0
You need to be logged in to leave comments. Login now