예제 #1
0
def Delete(key):
  """Clears the value from the datastore."""
  internal_key = _NamespaceKey(key, namespace=datastore_hooks.INTERNAL)
  external_key = _NamespaceKey(key, namespace=datastore_hooks.EXTERNAL)
  ndb.delete_multi([ndb.Key('CachedPickledString', internal_key),
                    ndb.Key('CachedPickledString', external_key)])
  stored_object.Delete(key)
예제 #2
0
  def testDelete_LargeObject_AllEntitiesDeleted(self):
    a_large_string = '0' * 2097152
    new_account = SampleSerializableClass(a_large_string)
    stored_object.Set('chris', new_account)

    stored_object.Delete('chris')

    multipart_entities = stored_object.MultipartEntity.query().fetch()
    self.assertEqual(0, len(multipart_entities))
    part_entities = stored_object.PartEntity.query().fetch()
    self.assertEqual(0, len(part_entities))
예제 #3
0
def Delete(key):
    """Deletes both the internal and external copy of a stored object."""
    internal_key = _NamespaceKey(key, namespace=datastore_hooks.INTERNAL)
    external_key = _NamespaceKey(key, namespace=datastore_hooks.EXTERNAL)
    stored_object.Delete(internal_key)
    stored_object.Delete(external_key)