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

Method create

aleph/model/entity.py:71–80  ·  view source on GitHub ↗
(cls, data, collection, sign=True, role_id=None)

Source from the content-addressed store, hash-verified

69
70 @classmethod
71 def create(cls, data, collection, sign=True, role_id=None):
72 entity = cls()
73 entity_id = data.get("id") or make_textid()
74 if not registry.entity.validate(entity_id):
75 raise InvalidData(gettext("Invalid entity ID"))
76 entity.id = collection.ns.sign(entity_id)
77 entity.collection_id = collection.id
78 entity.role_id = role_id
79 entity.update(data, collection, sign=sign)
80 return entity
81
82 @classmethod
83 def by_id(cls, entity_id, collection=None):

Callers

nothing calls this directly

Calls 4

make_textidFunction · 0.90
validateMethod · 0.80
getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected