<spanid="evennia-objects-manager"></span><h1>evennia.objects.manager<aclass="headerlink"href="#module-evennia.objects.manager"title="Permalink to this headline">¶</a></h1>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.objects.manager.</code><codeclass="sig-name descname">ObjectManager</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectManager"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectManager"title="Permalink to this definition">¶</a></dt>
<emclass="property">class </em><codeclass="sig-prename descclassname">evennia.objects.manager.</code><codeclass="sig-name descname">ObjectDBManager</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="o">*</span><spanclass="n">args</span></em>, <emclass="sig-param"><spanclass="o">**</span><spanclass="n">kwargs</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager"title="Permalink to this definition">¶</a></dt>
<codeclass="sig-name descname">get_object_with_account</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">ostring</span></em>, <emclass="sig-param"><spanclass="n">exact</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_object_with_account"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_object_with_account"title="Permalink to this definition">¶</a></dt>
<dd><p>Search for an object based on its account’s name or dbref.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>ostring</strong> (<em>str</em><em> or </em><em>int</em>) – Search criterion or dbref. Searching
for an account is sometimes initiated by appending an <strong>*</strong> to
the beginning of the search criterion (e.g. in
local_and_global_search). This is stripped here.</p></li>
<li><p><strong>exact</strong> (<em>bool</em><em>, </em><em>optional</em>) – Require an exact account match.</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – Only search among this list of possible
<codeclass="sig-name descname">get_objs_with_key_and_typeclass</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">oname</span></em>, <emclass="sig-param"><spanclass="n">otypeclass_path</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_key_and_typeclass"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_key_and_typeclass"title="Permalink to this definition">¶</a></dt>
<dd><p>Returns objects based on simultaneous key and typeclass match.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>oname</strong> (<em>str</em>) – Object key to search for</p></li>
<li><p><strong>otypeclass_path</strong> (<em>str</em>) – Full Python path to tyepclass to search for</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – Only match among the given list of candidates.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>matches (query)</em>– The matching objects.</p>
<codeclass="sig-name descname">get_objs_with_attr</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">attribute_name</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_attr"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_attr"title="Permalink to this definition">¶</a></dt>
<dd><p>Get objects based on having a certain Attribute defined.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>attribute_name</strong> (<em>str</em>) – Attribute name to search for.</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – Only match among the given list of object
candidates.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>matches (query)</em>– All objects having the given attribute_name defined at all.</p>
<codeclass="sig-name descname">get_objs_with_attr_value</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">attribute_name</span></em>, <emclass="sig-param"><spanclass="n">attribute_value</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">typeclasses</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_attr_value"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_attr_value"title="Permalink to this definition">¶</a></dt>
<dd><p>Get all objects having the given attrname set to the given value.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>attribute_name</strong> (<em>str</em>) – Attribute key to search for.</p></li>
<li><p><strong>attribute_value</strong> (<em>any</em>) – Attribute value to search for. This can also be database
objects.</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – Candidate objects to limit search to.</p></li>
<li><p><strong>typeclasses</strong> (<em>list</em><em>, </em><em>optional</em>) – Python pats to restrict matches with.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>matches (query)</em>– Objects fullfilling both the <strong>attribute_name</strong> and
<strong>attribute_value</strong> criterions.</p>
</dd>
</dl>
<pclass="rubric">Notes</p>
<p>This uses the Attribute’s PickledField to transparently search the database by matching
the internal representation. This is reasonably effective but since Attribute values
cannot be indexed, searching by Attribute key is to be preferred whenever possible.</p>
<codeclass="sig-name descname">get_objs_with_db_property</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">property_name</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_db_property"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_db_property"title="Permalink to this definition">¶</a></dt>
<dd><p>Get all objects having a given db field property.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>property_name</strong> (<em>str</em>) – The name of the field to match for.</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – Only search among th egiven candidates.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>matches (list)</em>– The found matches.</p>
<codeclass="sig-name descname">get_objs_with_db_property_value</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">property_name</span></em>, <emclass="sig-param"><spanclass="n">property_value</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">typeclasses</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_db_property_value"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_db_property_value"title="Permalink to this definition">¶</a></dt>
<dd><p>Get objects with a specific field name and value.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>property_name</strong> (<em>str</em>) – Field name to search for.</p></li>
<li><p><strong>property_value</strong> (<em>any</em>) – Value required for field with <strong>property_name</strong> to have.</p></li>
<li><p><strong>candidates</strong> (<em>list</em><em>, </em><em>optional</em>) – List of objects to limit search to.</p></li>
<li><p><strong>typeclasses</strong> (<em>list</em><em>, </em><em>optional</em>) – List of typeclass-path strings to restrict matches with</p></li>
<codeclass="sig-name descname">get_contents</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">location</span></em>, <emclass="sig-param"><spanclass="n">excludeobj</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_contents"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_contents"title="Permalink to this definition">¶</a></dt>
<dd><p>Get all objects that has a location set to this one.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>location</strong> (<em>Object</em>) – Where to get contents from.</p></li>
<li><p><strong>excludeobj</strong> (<em>Object</em><em> or </em><em>list</em><em>, </em><em>optional</em>) – One or more objects
to exclude from the match.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>contents (query)</em>– Matching contents, without excludeobj, if given.</p>
<codeclass="sig-name descname">get_objs_with_key_or_alias</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">ostring</span></em>, <emclass="sig-param"><spanclass="n">exact</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">typeclasses</span><spanclass="o">=</span><spanclass="default_value">None</span></em><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_key_or_alias"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.get_objs_with_key_or_alias"title="Permalink to this definition">¶</a></dt>
<dd><dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>ostring</strong> (<em>str</em>) – A search criterion.</p></li>
<li><p><strong>exact</strong> (<em>bool</em><em>, </em><em>optional</em>) – Require exact match of ostring
(still case-insensitive). If <strong>False</strong>, will do fuzzy matching
using <strong>evennia.utils.utils.string_partial_matching</strong> algorithm.</p></li>
<li><p><strong>candidates</strong> (<em>list</em>) – Only match among these candidates.</p></li>
<li><p><strong>typeclasses</strong> (<em>list</em>) – Only match objects with typeclasses having thess path strings.</p></li>
</ul>
</dd>
<dtclass="field-even">Returns</dt>
<ddclass="field-even"><p><em>matches (query)</em>– A list of matches of length 0, 1 or more.</p>
<codeclass="sig-name descname">object_search</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">searchdata</span></em>, <emclass="sig-param"><spanclass="n">attribute_name</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">typeclass</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">exact</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">use_dbref</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.object_search"title="Permalink to this definition">¶</a></dt>
<dd><p>Search as an object globally or in a list of candidates and
return results. The result is always an Object. Always returns
a list.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>searchdata</strong> (<em>str</em><em> or </em><em>Object</em>) – The entity to match for. This is
usually a key string but may also be an object itself.
By default (if no <strong>attribute_name</strong> is set), this will
search <strong>object.key</strong> and <strong>object.aliases</strong> in order.
Can also be on the form #dbref, which will (if
<strong>exact=True</strong>) be matched against primary key.</p></li>
<li><p><strong>attribute_name</strong> (<em>str</em>) – Use this named Attribute to
match searchdata against, instead of the defaults. If
this is the name of a database field (with or without
the <strong>db_</strong> prefix), that will be matched too.</p></li>
<li><p><strong>typeclass</strong> (<em>str</em><em> or </em><em>TypeClass</em>) – restrict matches to objects
having this typeclass. This will help speed up global
searches.</p></li>
<li><p><strong>candidates</strong> (<em>list</em>) – If supplied, search will
only be performed among the candidates in this list. A
common list of candidates is the contents of the
current location searched.</p></li>
<li><p><strong>exact</strong> (<em>bool</em>) – Match names/aliases exactly or partially.
Partial matching matches the beginning of words in the
names/aliases, using a matching routine to separate
multiple matches in names with multiple components (so
“bi sw” will match “Big sword”). Since this is more
expensive than exact matching, it is recommended to be
used together with the <strong>candidates</strong> keyword to limit the
number of possibilities. This value has no meaning if
searching for attributes/properties.</p></li>
<li><p><strong>use_dbref</strong> (<em>bool</em>) – If False, bypass direct lookup of a string
on the form #dbref and treat it like any string.</p></li>
<codeclass="sig-name descname">search</code><spanclass="sig-paren">(</span><emclass="sig-param"><spanclass="n">searchdata</span></em>, <emclass="sig-param"><spanclass="n">attribute_name</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">typeclass</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">candidates</span><spanclass="o">=</span><spanclass="default_value">None</span></em>, <emclass="sig-param"><spanclass="n">exact</span><spanclass="o">=</span><spanclass="default_value">True</span></em>, <emclass="sig-param"><spanclass="n">use_dbref</span><spanclass="o">=</span><spanclass="default_value">True</span></em><spanclass="sig-paren">)</span><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.search"title="Permalink to this definition">¶</a></dt>
<dd><p>Search as an object globally or in a list of candidates and
return results. The result is always an Object. Always returns
a list.</p>
<dlclass="field-list simple">
<dtclass="field-odd">Parameters</dt>
<ddclass="field-odd"><ulclass="simple">
<li><p><strong>searchdata</strong> (<em>str</em><em> or </em><em>Object</em>) – The entity to match for. This is
usually a key string but may also be an object itself.
By default (if no <strong>attribute_name</strong> is set), this will
search <strong>object.key</strong> and <strong>object.aliases</strong> in order.
Can also be on the form #dbref, which will (if
<strong>exact=True</strong>) be matched against primary key.</p></li>
<li><p><strong>attribute_name</strong> (<em>str</em>) – Use this named Attribute to
match searchdata against, instead of the defaults. If
this is the name of a database field (with or without
the <strong>db_</strong> prefix), that will be matched too.</p></li>
<li><p><strong>typeclass</strong> (<em>str</em><em> or </em><em>TypeClass</em>) – restrict matches to objects
having this typeclass. This will help speed up global
searches.</p></li>
<li><p><strong>candidates</strong> (<em>list</em>) – If supplied, search will
only be performed among the candidates in this list. A
common list of candidates is the contents of the
current location searched.</p></li>
<li><p><strong>exact</strong> (<em>bool</em>) – Match names/aliases exactly or partially.
Partial matching matches the beginning of words in the
names/aliases, using a matching routine to separate
multiple matches in names with multiple components (so
“bi sw” will match “Big sword”). Since this is more
expensive than exact matching, it is recommended to be
used together with the <strong>candidates</strong> keyword to limit the
number of possibilities. This value has no meaning if
searching for attributes/properties.</p></li>
<li><p><strong>use_dbref</strong> (<em>bool</em>) – If False, bypass direct lookup of a string
on the form #dbref and treat it like any string.</p></li>
<codeclass="sig-name descname">clear_all_sessids</code><spanclass="sig-paren">(</span><spanclass="sig-paren">)</span><aclass="reference internal"href="../_modules/evennia/objects/manager.html#ObjectDBManager.clear_all_sessids"><spanclass="viewcode-link">[source]</span></a><aclass="headerlink"href="#evennia.objects.manager.ObjectDBManager.clear_all_sessids"title="Permalink to this definition">¶</a></dt>
<dd><p>Clear the db_sessid field of all objects having also the