MCPcopy Create free account
hub / github.com/alephdata/aleph / update

Method update

aleph/model/entity.py:42–56  ·  view source on GitHub ↗
(self, data, collection, sign=True)

Source from the content-addressed store, hash-verified

40 return model.get(self.schema)
41
42 def update(self, data, collection, sign=True):
43 proxy = model.get_proxy(data, cleaned=False)
44 if sign:
45 proxy = collection.ns.apply(proxy)
46 self.schema = proxy.schema.name
47 previous = self.to_proxy()
48 for prop in proxy.schema.properties.values():
49 # Do not allow the user to overwrite hashes because this could
50 # lead to a user accessing random objects.
51 if prop.type == registry.checksum:
52 prev = previous.get(prop)
53 proxy.set(prop, prev, cleaned=True, quiet=True)
54 self.data = proxy.properties
55 self.updated_at = datetime.utcnow()
56 db.session.add(self)
57
58 def to_proxy(self):
59 data = {

Callers 1

createMethod · 0.45

Calls 4

to_proxyMethod · 0.95
addMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected