@@ -162,26 +162,32 @@ def get_objects(self, object_ids, attributes_to_retrieve=None):
162162 def partialUpdateObject (self , partial_object ):
163163 return self .partial_update_object (partial_object )
164164
165- def partial_update_object (self , partial_object ):
165+ def partial_update_object (self , partial_object , no_create = False ):
166166 """
167167 Update partially an object (only update attributes passed in argument).
168168
169169 @param partial_object contains the object attributes to override, the
170170 object must contains an objectID attribute
171+ @param no_create specifies whether or not a missing object must be
172+ created
171173 """
172174 path = '/%s/partial' % safe (partial_object ['objectID' ])
175+ if no_create :
176+ path += '?createIfNotExists=false'
173177 return self ._req (False , path , 'POST' , data = partial_object )
174178
175179 @deprecated
176180 def partialUpdateObjects (self , objects ):
177181 return self .partial_update_objects (objects )
178182
179- def partial_update_objects (self , objects ):
183+ def partial_update_objects (self , objects , no_create = False ):
180184 """
181185 Partially Override the content of several objects.
182186
183187 @param objects contains an array of objects to update (each object
184188 must contains a objectID attribute)
189+ @param no_create specifies whether or not a missing object must be
190+ created
185191 """
186192 requests = []
187193 for obj in objects :
@@ -190,7 +196,7 @@ def partial_update_objects(self, objects):
190196 'objectID' : obj ['objectID' ],
191197 'body' : obj
192198 })
193- return self .batch (requests )
199+ return self .batch (requests , no_create = no_create )
194200
195201 @deprecated
196202 def saveObject (self , obj ):
@@ -876,11 +882,15 @@ def update_user_key(self, key, obj, validity=None,
876882 path = '/keys/%s' % key
877883 return self ._req (False , path , 'PUT' , data = obj )
878884
879- def batch (self , requests ):
885+ def batch (self , requests , no_create = False ):
880886 """Send a batch requests."""
881887 if isinstance (requests , (list , tuple )):
882888 requests = {'requests' : requests }
883889
890+ path = '/batch'
891+ if no_create :
892+ path += '?createIfNotExists=false'
893+
884894 return self ._req (False , '/batch' , 'POST' , data = requests )
885895
886896 def _req (self , is_search , path , meth , params = None , data = None ):
0 commit comments