evennia/docs/latest/api/evennia.objects.manager.html
Evennia docbuilder action d17f22fc2c Updated HTML docs.
2024-03-17 13:48:03 +00:00

574 lines
No EOL
41 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>evennia.objects.manager &#8212; Evennia latest documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="evennia.objects.models" href="evennia.objects.models.html" />
<link rel="prev" title="evennia.objects" href="evennia.objects.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="evennia.objects.models.html" title="evennia.objects.models"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="evennia.objects.html" title="evennia.objects"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia latest</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> &#187;</li>
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> &#187;</li>
<li class="nav-item nav-item-4"><a href="evennia.objects.html" accesskey="U">evennia.objects</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">evennia.objects.manager</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
<h4>Previous topic</h4>
<p class="topless"><a href="evennia.objects.html"
title="previous chapter">evennia.objects</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="evennia.objects.models.html"
title="next chapter">evennia.objects.models</a></p>
<div role="note" aria-label="source link">
<!--h3>This Page</h3-->
<ul class="this-page-menu">
<li><a href="../_sources/api/evennia.objects.manager.md.txt"
rel="nofollow">Show Page Source</a></li>
</ul>
</div><h3>Links</h3>
<ul>
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
<li><a href="http://games.evennia.com">Game Index</a> </li>
<li>
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
<a href="https://evennia.blogspot.com/">Blog</a>
</li>
</ul>
<h3>Doc Versions</h3>
<ul>
<li><a href="evennia.objects.manager.html">latest (main branch)</a></li>
<li><a href="../4.x/index.html">v4.0.0 branch (outdated)</a></li>
<li><a href="../3.x/index.html">v3.0.0 branch (outdated)</a></li>
<li><a href="../2.x/index.html">v2.0.0 branch (outdated)</a></li>
<li><a href="../1.x/index.html">v1.0.0 branch (outdated)</a></li>
<li><a href="../0.x/index.html">v0.9.5 branch (outdated)</a></li>
</ul>
</div>
</div>
<div class="bodywrapper">
<div class="body" role="main">
<section id="module-evennia.objects.manager">
<span id="evennia-objects-manager"></span><h1>evennia.objects.manager<a class="headerlink" href="#module-evennia.objects.manager" title="Permalink to this headline"></a></h1>
<p>Custom manager for Objects.</p>
<dl class="py class">
<dt id="evennia.objects.manager.ObjectManager">
<em class="property">class </em><code class="sig-prename descclassname">evennia.objects.manager.</code><code class="sig-name descname">ObjectManager</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectManager"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectManager" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="#evennia.objects.manager.ObjectDBManager" title="evennia.objects.manager.ObjectDBManager"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.objects.manager.ObjectDBManager</span></code></a>, <code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.typeclasses.managers.TypeclassManager</span></code></p>
</dd></dl>
<dl class="py class">
<dt id="evennia.objects.manager.ObjectDBManager">
<em class="property">class </em><code class="sig-prename descclassname">evennia.objects.manager.</code><code class="sig-name descname">ObjectDBManager</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectDBManager" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference internal" href="evennia.typeclasses.managers.html#evennia.typeclasses.managers.TypedObjectManager" title="evennia.typeclasses.managers.TypedObjectManager"><code class="xref py py-class docutils literal notranslate"><span class="pre">evennia.typeclasses.managers.TypedObjectManager</span></code></a></p>
<p>This ObjectManager implements methods for searching
and manipulating Objects directly from the database.</p>
<p>Evennia-specific search methods (will return Typeclasses or
lists of Typeclasses, whereas Django-general methods will return
Querysets or database objects).</p>
<p>dbref (converter)
dbref_search
get_dbref_range
object_totals
typeclass_search
get_object_with_account
get_objs_with_key_and_typeclass
get_objs_with_attr
get_objs_with_attr_match
get_objs_with_db_property
get_objs_with_db_property_match
get_objs_with_key_or_alias
get_contents
search_object (interface to many of the above methods,</p>
<blockquote>
<div><p>equivalent to evennia.search_object)</p>
</div></blockquote>
<p>copy_object</p>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_object_with_account">
<code class="sig-name descname">get_object_with_account</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">ostring</span></em>, <em class="sig-param"><span class="n">exact</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_object_with_account"><span class="viewcode-link">[source]</span></a><a class="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 accounts name or dbref.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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
object candidates.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>match (query)</em> Matching query.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_key_and_typeclass">
<code class="sig-name descname">get_objs_with_key_and_typeclass</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">oname</span></em>, <em class="sig-param"><span class="n">otypeclass_path</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_key_and_typeclass"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (query)</em> The matching objects.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_attr">
<code class="sig-name descname">get_objs_with_attr</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">attribute_name</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_attr"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (query)</em> All objects having the given attribute_name defined at all.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_attr_value">
<code class="sig-name descname">get_objs_with_attr_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">attribute_name</span></em>, <em class="sig-param"><span class="n">attribute_value</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclasses</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_attr_value"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>Queryset</em> </p>
<dl class="simple">
<dt>Iterable with 0, 1 or more matches fullfilling both the <strong>attribute_name</strong> and</dt><dd><p><strong>attribute_value</strong> criterions.</p>
</dd>
</dl>
</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>This uses the Attributes 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>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_db_property">
<code class="sig-name descname">get_objs_with_db_property</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">property_name</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_db_property"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (list)</em> The found matches.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_db_property_value">
<code class="sig-name descname">get_objs_with_db_property_value</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">property_name</span></em>, <em class="sig-param"><span class="n">property_value</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclasses</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_db_property_value"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>Queryset</em> Iterable with 0, 1 or more matches.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_contents">
<code class="sig-name descname">get_contents</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">location</span></em>, <em class="sig-param"><span class="n">excludeobj</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_contents"><span class="viewcode-link">[source]</span></a><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>Queryset</em> Iterable with 0, 1 or more matches.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.get_objs_with_key_or_alias">
<code class="sig-name descname">get_objs_with_key_or_alias</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">ostring</span></em>, <em class="sig-param"><span class="n">exact</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclasses</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.get_objs_with_key_or_alias"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectDBManager.get_objs_with_key_or_alias" title="Permalink to this definition"></a></dt>
<dd><dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>Queryset</em> An iterable with 0, 1 or more matches.</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.search_object">
<code class="sig-name descname">search_object</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">searchdata</span></em>, <em class="sig-param"><span class="n">attribute_name</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclass</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">exact</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">use_dbref</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">tags</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.search_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectDBManager.search_object" 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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<li><p><strong>tags</strong> (<em>list</em>) A list of tuples <strong>(tagkey, tagcategory)</strong> where the
matched object must have _all_ tags in order to be considered
a match.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (list)</em> Matching objects</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.object_search">
<code class="sig-name descname">object_search</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">searchdata</span></em>, <em class="sig-param"><span class="n">attribute_name</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclass</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">exact</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">use_dbref</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">tags</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<li><p><strong>tags</strong> (<em>list</em>) A list of tuples <strong>(tagkey, tagcategory)</strong> where the
matched object must have _all_ tags in order to be considered
a match.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (list)</em> Matching objects</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.search">
<code class="sig-name descname">search</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">searchdata</span></em>, <em class="sig-param"><span class="n">attribute_name</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">typeclass</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">candidates</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">exact</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">use_dbref</span><span class="o">=</span><span class="default_value">True</span></em>, <em class="sig-param"><span class="n">tags</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="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>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="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>
<li><p><strong>tags</strong> (<em>list</em>) A list of tuples <strong>(tagkey, tagcategory)</strong> where the
matched object must have _all_ tags in order to be considered
a match.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>matches (list)</em> Matching objects</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.copy_object">
<code class="sig-name descname">copy_object</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">original_object</span></em>, <em class="sig-param"><span class="n">new_key</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_location</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_home</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_permissions</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_locks</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_aliases</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">new_destination</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.copy_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectDBManager.copy_object" title="Permalink to this definition"></a></dt>
<dd><p>Create and return a new object as a copy of the original object. All
will be identical to the original except for the arguments given
specifically to this method. Object contents will not be copied.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>original_object</strong> (<em>Object</em>) The object to make a copy from.</p></li>
<li><p><strong>new_key</strong> (<em>str</em><em>, </em><em>optional</em>) Name of the copy, if different
from the original.</p></li>
<li><p><strong>new_location</strong> (<em>Object</em><em>, </em><em>optional</em>) Alternate location.</p></li>
<li><p><strong>new_home</strong> (<em>Object</em><em>, </em><em>optional</em>) Change the home location</p></li>
<li><p><strong>new_aliases</strong> (<em>list</em><em>, </em><em>optional</em>) Give alternate object
aliases as a list of strings.</p></li>
<li><p><strong>new_destination</strong> (<em>Object</em><em>, </em><em>optional</em>) Used only by exits.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><p><em>copy (Object or None)</em> </p>
<dl class="simple">
<dt>The copy of <strong>original_object</strong>,</dt><dd><p>optionally modified as per the ingoing keyword
arguments. <strong>None</strong> if an error was encountered.</p>
</dd>
</dl>
</p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.clear_all_sessids">
<code class="sig-name descname">clear_all_sessids</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.clear_all_sessids"><span class="viewcode-link">[source]</span></a><a class="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
db_account field set.</p>
</dd></dl>
<dl class="py method">
<dt id="evennia.objects.manager.ObjectDBManager.create_object">
<code class="sig-name descname">create_object</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">typeclass</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">key</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">location</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">home</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">permissions</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">locks</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">aliases</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">tags</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">destination</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">report_to</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">nohome</span><span class="o">=</span><span class="default_value">False</span></em>, <em class="sig-param"><span class="n">attributes</span><span class="o">=</span><span class="default_value">None</span></em>, <em class="sig-param"><span class="n">nattributes</span><span class="o">=</span><span class="default_value">None</span></em><span class="sig-paren">)</span><a class="reference internal" href="../_modules/evennia/objects/manager.html#ObjectDBManager.create_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#evennia.objects.manager.ObjectDBManager.create_object" title="Permalink to this definition"></a></dt>
<dd><p>Create a new in-game object.</p>
<dl class="field-list simple">
<dt class="field-odd">Keyword Arguments</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>typeclass</strong> (<em>class</em><em> or </em><em>str</em>) Class or python path to a typeclass.</p></li>
<li><p><strong>key</strong> (<em>str</em>) Name of the new object. If not set, a name of
<strong>#dbref</strong> will be set.</p></li>
<li><p><strong>location</strong> (<em>Object</em><em> or </em><em>str</em>) Obj or #dbref to use as the location of the new object.</p></li>
<li><p><strong>home</strong> (<em>Object</em><em> or </em><em>str</em>) Obj or #dbref to use as the objects home location.</p></li>
<li><p><strong>permissions</strong> (<a class="reference internal" href="evennia.contrib.game_systems.barter.barter.html#evennia.contrib.game_systems.barter.barter.TradeHandler.list" title="evennia.contrib.game_systems.barter.barter.TradeHandler.list"><em>list</em></a>) A list of permission strings or tuples (permstring, category).</p></li>
<li><p><strong>locks</strong> (<em>str</em>) one or more lockstrings, separated by semicolons.</p></li>
<li><p><strong>aliases</strong> (<a class="reference internal" href="evennia.contrib.game_systems.barter.barter.html#evennia.contrib.game_systems.barter.barter.TradeHandler.list" title="evennia.contrib.game_systems.barter.barter.TradeHandler.list"><em>list</em></a>) A list of alternative keys or tuples (aliasstring, category).</p></li>
<li><p><strong>tags</strong> (<a class="reference internal" href="evennia.contrib.game_systems.barter.barter.html#evennia.contrib.game_systems.barter.barter.TradeHandler.list" title="evennia.contrib.game_systems.barter.barter.TradeHandler.list"><em>list</em></a>) List of tag keys or tuples (tagkey, category) or (tagkey, category, data).</p></li>
<li><p><strong>destination</strong> (<em>Object</em><em> or </em><em>str</em>) Obj or #dbref to use as an Exits target.</p></li>
<li><p><strong>report_to</strong> (<em>Object</em>) The object to return error messages to.</p></li>
<li><p><strong>nohome</strong> (<em>bool</em>) This allows the creation of objects without a
default home location; only used when creating the default
location itself or during unittests.</p></li>
<li><p><strong>attributes</strong> (<a class="reference internal" href="evennia.contrib.game_systems.barter.barter.html#evennia.contrib.game_systems.barter.barter.TradeHandler.list" title="evennia.contrib.game_systems.barter.barter.TradeHandler.list"><em>list</em></a>) Tuples on the form (key, value) or (key, value, category),
(key, value, lockstring) or (key, value, lockstring, default_access).
to set as Attributes on the new object.</p></li>
<li><p><strong>nattributes</strong> (<a class="reference internal" href="evennia.contrib.game_systems.barter.barter.html#evennia.contrib.game_systems.barter.barter.TradeHandler.list" title="evennia.contrib.game_systems.barter.barter.TradeHandler.list"><em>list</em></a>) Non-persistent tuples on the form (key, value). Note that
adding this rarely makes sense since this data will not survive a reload.</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p><em>object (Object)</em> A newly created object of the given typeclass.</p>
</dd>
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><a class="reference internal" href="evennia.objects.models.html#evennia.objects.models.ObjectDB.DoesNotExist" title="evennia.objects.models.ObjectDB.DoesNotExist"><strong>ObjectDB.DoesNotExist</strong></a> If trying to create an Object with
<strong>location</strong> or <strong>home</strong> that cant be found.</p>
</dd>
</dl>
</dd></dl>
</dd></dl>
</section>
</div>
</div>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="evennia.objects.models.html" title="evennia.objects.models"
>next</a> |</li>
<li class="right" >
<a href="evennia.objects.html" title="evennia.objects"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia latest</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../Evennia-API.html" >API Summary</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="evennia-api.html" >evennia</a> &#187;</li>
<li class="nav-item nav-item-3"><a href="evennia.html" >evennia</a> &#187;</li>
<li class="nav-item nav-item-4"><a href="evennia.objects.html" >evennia.objects</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">evennia.objects.manager</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2024, The Evennia developer community.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>