moo.sdk.objects.create

moo.sdk.objects.create(name, *a, **kw)

Creates and returns a new object whose parents are parents and whose owner is as described below. Provided parents are valid Objects with derive permission, otherwise PermissionError is raised. After the new object is created, its initialize verb, if any, is called with no arguments.

The owner of the new object is either the programmer (if owner is not provided), or the provided owner, if the caller has permission to entrust the object.

If the intended owner of the new object has a property named ownership_quota and the value of that property is an integer, then create() treats that value as a quota. If the quota is less than or equal to zero, then the quota is considered to be exhausted and create() raises QuotaError instead of creating an object. Otherwise, the quota is decremented and stored back into the ownership_quota property as a part of the creation of the new object.

Parameters:
  • name (str) – canonical name

  • owner (Object) – owner of the Object being created

  • location (Object) – where to create the Object

  • parents (list[Object]) – a list of parents for the Object

  • obvious (bool) – whether the object appears in room contents listings (default False)

Returns:

the new object

Return type:

Object

Raises:
  • PermissionError – if the caller is not allowed to derive from the parent

  • QuotaError – if the caller has a quota and it has been exceeded