<p>The <codeclass="docutils literal notranslate"><spanclass="pre">**kwargs</span></code> is mandatory. Then you attach it to the signal of your choice:</p>
<p>This particular signal fires after (post) an Account has connected to the game.
When that happens, <codeclass="docutils literal notranslate"><spanclass="pre">myhandler</span></code> will fire with the <codeclass="docutils literal notranslate"><spanclass="pre">sender</span></code> being the Account that just connected.</p>
<p>If you want to respond only to the effects of a specific entity you can do so
(with a shortcut <codeclass="docutils literal notranslate"><spanclass="pre">evennia.signals</span></code>). Signals are named by the sender type. So <codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_*</span></code>
returns
<codeclass="docutils literal notranslate"><spanclass="pre">Account</span></code> instances as senders, <codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_OBJECT_*</span></code> returns <codeclass="docutils literal notranslate"><spanclass="pre">Object</span></code>s etc. Extra keywords (kwargs)
should
be extracted from the <codeclass="docutils literal notranslate"><spanclass="pre">**kwargs</span></code> dict in the signal handler.</p>
<ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_CREATE</span></code> - this is triggered at the very end of <codeclass="docutils literal notranslate"><spanclass="pre">Account.create()</span></code>. Note that
calling <codeclass="docutils literal notranslate"><spanclass="pre">evennia.create.create_account</span></code> (which is called internally by <codeclass="docutils literal notranslate"><spanclass="pre">Account.create</span></code>) will
<em>not</em>
trigger this signal. This is because using <codeclass="docutils literal notranslate"><spanclass="pre">Account.create()</span></code> is expected to be the most commonly
used way for users to themselves create accounts during login. It passes and extra kwarg <codeclass="docutils literal notranslate"><spanclass="pre">ip</span></code> with
the client IP of the connecting account.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LOGIN</span></code> - this will always fire when the account has authenticated. Sends
extra kwarg <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> with the new <aclass="reference internal"href="Sessions.html"><spanclass="doc std std-doc">Session</span></a> object involved.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCCOUNT_POST_FIRST_LOGIN</span></code> - this fires just before <codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LOGIN</span></code> but only
if
this is the <em>first</em> connection done (that is, if there are no previous sessions connected). Also
passes the <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> along as a kwarg.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LOGIN_FAIL</span></code> - sent when someone tried to log into an account by failed.
Passes
the <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> as an extra kwarg.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LOGOUT</span></code> - always fires when an account logs off, no matter if other sessions
remain or not. Passes the disconnecting <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> along as a kwarg.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LAST_LOGOUT</span></code> - fires before <codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_LOGOUT</span></code>, but only if this is
the <em>last</em> Session to disconnect for that account. Passes the <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> as a kwarg.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_OBJECT_POST_PUPPET</span></code> - fires when an account puppets this object. Extra kwargs <codeclass="docutils literal notranslate"><spanclass="pre">session</span></code>
and <codeclass="docutils literal notranslate"><spanclass="pre">account</span></code> represent the puppeting entities.
<codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_OBJECT_POST_UNPUPPET</span></code> - fires when the sending object is unpuppeted. Extra kwargs are
<codeclass="docutils literal notranslate"><spanclass="pre">session</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">account</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_ACCOUNT_POST_RENAME</span></code> - triggered by the setting of <codeclass="docutils literal notranslate"><spanclass="pre">Account.username</span></code>. Passes extra
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_TYPED_OBJECT_POST_RENAME</span></code> - triggered when any Typeclassed entity’s <codeclass="docutils literal notranslate"><spanclass="pre">key</span></code> is changed.
Extra
kwargs passed are <codeclass="docutils literal notranslate"><spanclass="pre">old_key</span></code> and <codeclass="docutils literal notranslate"><spanclass="pre">new_key</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_SCRIPT_POST_CREATE</span></code> - fires when a script is first created, after any hooks.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_CHANNEL_POST_CREATE</span></code> - fires when a Channel is first created, after any hooks.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_HELPENTRY_POST_CREATE</span></code> - fires when a help entry is first created.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">SIGNAL_EXIT_TRAVERSED</span></code> - fires when an exit is traversed, just after <codeclass="docutils literal notranslate"><spanclass="pre">at_traverse</span></code> hook. The <codeclass="docutils literal notranslate"><spanclass="pre">sender</span></code> is the exit itself, <codeclass="docutils literal notranslate"><spanclass="pre">traverser=</span></code> keyword hold the one traversing the exit.</p></li>
<p>The <codeclass="docutils literal notranslate"><spanclass="pre">evennia.signals</span></code> module also gives you conveneient access to the default Django signals (these
use a
different naming convention).</p>
<ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">pre_save</span></code> - fired when any database entitiy’s <codeclass="docutils literal notranslate"><spanclass="pre">.save</span></code> method fires, before any saving has
happened.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">post_save</span></code> - fires after saving a database entity.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">pre_delete</span></code> - fires just before a database entity is deleted.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">post_delete</span></code> - fires after a database entity was deleted.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">pre_init</span></code> - fires before a typeclass’<codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code> method (which in turn
happens before the <codeclass="docutils literal notranslate"><spanclass="pre">at_init</span></code> hook fires).</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">post_init</span></code> - triggers at the end of <codeclass="docutils literal notranslate"><spanclass="pre">__init__</span></code> (still before the <codeclass="docutils literal notranslate"><spanclass="pre">at_init</span></code> hook).</p></li>
</ul>
<p>These are highly specialized Django signals that are unlikely to be useful to most users. But
they are included here for completeness.</p>
<ulclass="simple">
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">m2m_changed</span></code> - fires after a Many-to-Many field (like <codeclass="docutils literal notranslate"><spanclass="pre">db_attributes</span></code>) changes.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">pre_migrate</span></code> - fires before database migration starts with <codeclass="docutils literal notranslate"><spanclass="pre">evennia</span><spanclass="pre">migrate</span></code>.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">post_migrate</span></code> - fires after database migration finished.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">request_started</span></code> - sent when HTTP request begins.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">request_finished</span></code> - sent when HTTP request ends.</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">settings_changed</span></code> - sent when changing settings due to <codeclass="docutils literal notranslate"><spanclass="pre">@override_settings</span></code>
decorator (only relevant for unit testing)</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">template_rendered</span></code> - sent when test system renders http template (only useful for unit tests).</p></li>
<li><p><codeclass="docutils literal notranslate"><spanclass="pre">connection_creation</span></code> - sent when making initial connection to database.</p></li>