Closed milesrichardson closed 8 years ago
FYI, tagging everyone who seems to be maintaining a fork of this project that updated it in the last month (since this is clearly no longer maintained)
@lebouquetin
@soby
@basilfamer
@lullis
@amitmalhotra
@deeGraYve
I will thankfully be retiring my fork when Parse kills off their service.
@milesrichardson how would one go about using your branch? I'm attempting to test parsepy with my parse server
@flooie first remove any existing parsepy install:
pip uninstall parse-rest
Then install my branch directly from my github repo:
pip install git+https://github.com/milesrichardson/ParsePy
Thanks very much! Appreciate the fix; we're working on bringing this up to date.
Major fixes:
batch_save
batch_save
calls response callback on ALL responses, even if some contain errors, and raisesParseBatchError([error1, error2, error3])
with list of all errors encountered during batch operationThe similar pull request from @basilfamer (#136) does NOT work with self-hosted parse-server, because it changes the value of
API_ROOT
after other classes have already set their class properties to the oldAPI_ROOT
, and because it does not support batch_saving (which depends onparse.com
in the URL).My pull request uses an environment variable. If you want to use self hosted parse server, it's this simple:
(If you want to use regular parse.com, just don't set the environment variable, and it will default to parse.com.)
Batch saving/deleting is also supported on self-hosted parse-server.
I also fixed a bug in batching. Previously, when performing
batch_save
on multiple objects, if just ONE of them failed, then the "response callback" for all objects after it would never execute. The result of this is that if youbatch_save
10 objects, and the first 1 of them failed, then the "callback" would not execute on the remaining 9 objects. So for example if you were relying on that callback to set theobjectId
of saved objects, then NONE of the objects in the list would have theirobjectId
set, even though they saved correctly.Now, any errors encountered in a batch operation are appended to a list, and when the batch operation completes, if there were any errors it raises a
ParseBatchError
exception (child ofParseError
) with.message
set to the list of errors. For example:Will raise exception (note the LIST of two errors)
And CRUCIALLY, the
objectId
field of the NON-duplicate object will be correctly set:Whereas prior to my pull request, NONE of the objects would have
objectId
after saving, even though one of them saved correctly: