moo.core.models.object.Object

class moo.core.models.object.Object(id, name, unique_name, obvious, placement_prep, placement_target, owner, location, site, _initialized)
__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

add_alias(alias)

Add an alias to this object if it does not already exist.

add_parent(parent)

Add a parent to this object's inheritance chain.

add_verb(*names[, code, owner, repo, ...])

Create or replace a Verb on this object.

adelete([using, keep_parents])

allow(accessor, permission)

Allow a certain object or group to do something on this object.

arefresh_from_db([using, fields])

asave([force_insert, force_update, using, ...])

can_caller(permission, subject)

Check if the current caller has permission for something.

check(**kwargs)

clean()

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields.

clean_fields([exclude])

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

clear_placement()

Remove placement without touching the obvious field.

contains(obj)

Check if this object contains the given object anywhere in its content tree.

date_error_message(lookup_type, field_name, ...)

delete(*args, **kwargs)

deny(accessor, permission)

Deny a certain object or group from doing something on this object.

find(name[, exclude_hidden_placement])

Find contents by the given name or alias.

from_db(db, field_names, values)

full_clean([exclude, validate_unique, ...])

Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model.

get_ancestors()

Get the ancestor tree for this object as a QuerySet ordered shallowest-first.

get_constraints()

get_contents()

Get the content tree for this object as a QuerySet ordered shallowest-first.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

get_descendents()

Get the descendent tree for this object as a QuerySet ordered shallowest-first.

get_property(name[, recurse, original])

Retrieve a Property instance defined on this Object.

get_property_objects(name[, ...])

Like get_property(), but when the stored value is a list of Objects, returns them via a single bulk IN query with optional prefetches instead of the N individual get() calls that moojson.loads() would issue.

get_verb(name[, recurse, allow_ambiguous, ...])

Retrieve a specific Verb instance defined on this Object.

has_property(name[, recurse])

Check if a particular Property is defined on this object.

has_verb(name[, recurse])

Check if a particular Verb is defined on this object.

invoke_verb(name, *args, **kwargs)

Invoke a Verb defined on the given object, traversing the inheritance tree until it's found.

is_a(obj)

Check if this object is a child of the provided object.

is_allowed(permission, subject[, fatal])

Check if this object is allowed to perform an action on an object.

is_connected()

Check if this object is a player avatar that is currently connected.

is_hidden_placement()

True for prepositions that hide the item in tell_contents (under, behind).

is_named(name)

Check if this object has a name or alias that matches the given name.

is_placed()

True if this object has an active placement.

is_player()

Check if this object is a player avatar.

is_wizard()

Check if this object is a wizard player avatar.

owns(subject)

Convenience method to check if the subject is owned by self

prepare_database_save(field)

refresh_from_db([using, fields])

Reload field values from the database.

remove_parent(parent)

Remove a parent from this object's inheritance chain.

save(*args, **kwargs)

Save the current instance.

save_base([raw, force_insert, force_update, ...])

Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too.

serializable_value(field_name)

Return the value of the field name for this instance.

set_placement(prep, target)

Set placement prep and target atomically.

set_property(name, value[, inherit_owner, owner])

Create or update a Property on this object.

unique_error_message(model_class, unique_check)

validate_constraints([exclude])

validate_unique([exclude])

Check unique constraints on the model and raise ValidationError if any failed.

Attributes

acl

Accessor to the related objects manager on the reverse side of a many-to-one relation.

aliases

Accessor to the related objects manager on the reverse side of a many-to-one relation.

ancestor_cache

Accessor to the related objects manager on the reverse side of a many-to-one relation.

ancestor_descendants

Accessor to the related objects manager on the reverse side of a many-to-one relation.

children

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

contents

Accessor to the related objects manager on the reverse side of a many-to-one relation.

global_objects

id

A wrapper for a deferred-loading field.

kind

location

The location of this object.

location_id

name

The canonical name of the object

objects

obvious

This object should be obvious among a group.

owner

The owner of this object.

owner_id

parents

The parents of this object.

pk

placed_objects

Accessor to the related objects manager on the reverse side of a many-to-one relation.

placement

Return (prep, target) tuple, or None if not placed (or target deleted).

placement_prep

The preposition describing where this object is placed (e.g. "on", "under").

placement_target

The object this is placed on/under/behind.

placement_target_id

player_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

properties

Accessor to the related objects manager on the reverse side of a many-to-one relation.

received_messages

Accessor to the related objects manager on the reverse side of a many-to-one relation.

rights

Accessor to the related objects manager on the reverse side of a many-to-one relation.

sent_messages

Accessor to the related objects manager on the reverse side of a many-to-one relation.

site

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

site_id

unique_name

If True, this object is the only object with this name

verbs

Accessor to the related objects manager on the reverse side of a many-to-one relation.