Exemple #1
0
 def to_entity(content):
     entity = entity_pb2.Entity()
     googledatastore.helper.add_key_path(entity.key, kind,
                                         str(uuid.uuid4()))
     googledatastore.helper.add_properties(entity,
                                           {'content': unicode(content)})
     return entity
Exemple #2
0
    def make_entity(self, content):
        entity = entity_pb2.Entity()
        if self._namespace is not None:
            entity.key.partition_id.namespace_id = self._namespace

        # All entities created will have the same ancestor
        datastore_helper.add_key_path(entity.key, self._kind, self._ancestor,
                                      self._kind, str(uuid.uuid4()))

        datastore_helper.add_properties(entity, {"content": unicode(content)})
        return entity