##// 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,7 +71,9 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)
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])
72 77 # body = urllib.parse.urlencode(data)
73 78 h = httplib2.Http()
74 79 response, content = h.request(get_url, method="POST", body=xml)
General Comments 0
You need to be logged in to leave comments. Login now