Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ParsePy
Commits
b3316278
Commit
b3316278
authored
Jul 17, 2014
by
Roman Krejcik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid executing empty batch, it has no effect
parent
84ddd38e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
parse_rest/connection.py
+5
-3
No files found.
parse_rest/connection.py
View file @
b3316278
...
...
@@ -125,9 +125,11 @@ class ParseBatcher(ParseBase):
Given a list of create, update or delete methods to call, call all
of them in a single batch operation.
"""
#accepts also empty list (or generator) - it allows call batch directly
# with query result (eventually empty)
queries
,
callbacks
=
list
(
zip
(
*
[
m
(
batch
=
True
)
for
m
in
methods
]))
or
([],
[])
methods
=
list
(
methods
)
# methods can be iterator
if
not
methods
:
#accepts also empty list (or generator) - it allows call batch directly with query result (eventually empty)
return
queries
,
callbacks
=
list
(
zip
(
*
[
m
(
batch
=
True
)
for
m
in
methods
]))
# perform all the operations in one batch
responses
=
self
.
execute
(
""
,
"POST"
,
requests
=
queries
)
# perform the callbacks with the response data (updating the existing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment