Linux server.thearyasamaj.org 4.18.0-553.56.1.el8_10.x86_64 #1 SMP Tue Jun 10 05:00:59 EDT 2025 x86_64
Apache
: 103.90.241.146 | : 216.73.216.222
Cant Read [ /etc/named.conf ]
5.6.40
ftpuser@mantra.thearyasamaj.org
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
python3-zope-event /
html /
[ HOME SHELL ]
Name
Size
Permission
Action
_sources
[ DIR ]
drwxr-xr-x
_static
[ DIR ]
drwxr-xr-x
api.html
5.99
KB
-rw-r--r--
classhandler.html
9.09
KB
-rw-r--r--
genindex.html
3.4
KB
-rw-r--r--
hacking.html
21.87
KB
-rw-r--r--
index.html
6.95
KB
-rw-r--r--
objects.inv
404
B
-rw-r--r--
search.html
3.32
KB
-rw-r--r--
searchindex.js
4.27
KB
-rw-r--r--
theory.html
5.17
KB
-rw-r--r--
usage.html
10.4
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : usage.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="X-UA-Compatible" content="IE=Edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Using zope.event — zope.event 4.2.0 documentation</title> <link rel="stylesheet" href="_static/classic.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script> <script type="text/javascript" src="_static/jquery.js"></script> <script type="text/javascript" src="_static/underscore.js"></script> <script type="text/javascript" src="_static/doctools.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="next" title="Theory of Operation" href="theory.html" /> <link rel="prev" title="zope.event Documentation" href="index.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="theory.html" title="Theory of Operation" accesskey="N">next</a> |</li> <li class="right" > <a href="index.html" title="zope.event Documentation" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">zope.event 4.2.0 documentation</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="using-zope-event"> <span id="usage-docs"></span><h1>Using <code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code><a class="headerlink" href="#using-zope-event" title="Permalink to this headline">¶</a></h1> <p>The <code class="xref py py-mod docutils literal notranslate"><span class="pre">zope.event</span></code> package has a list of subscribers. Application code can manage subscriptions by manipulating this list. For the examples here, we’ll save the current contents away and empty the list. We’ll restore the contents when we’re done with our examples.</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="kn">import</span> <span class="nn">zope.event</span> <span class="gp">>>> </span><span class="n">old_subscribers</span> <span class="o">=</span> <span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="p">[:]</span> <span class="gp">>>> </span><span class="k">del</span> <span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="p">[:]</span> </pre></div> </div> <p>The package provides a <code class="xref py py-func docutils literal notranslate"><span class="pre">notify()</span></code> function, which is used to notify subscribers that something has happened:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">class</span> <span class="nc">MyEvent</span><span class="p">:</span> <span class="gp">... </span> <span class="k">pass</span> <span class="gp">>>> </span><span class="n">event</span> <span class="o">=</span> <span class="n">MyEvent</span><span class="p">()</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="n">event</span><span class="p">)</span> </pre></div> </div> <p>The notify function is called with a single object, which we call an event. Any object will do:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="bp">None</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> </pre></div> </div> <p>An extremely trivial subscription mechanism is provided. Subscribers are simply callback functions:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="k">def</span> <span class="nf">f</span><span class="p">(</span><span class="n">event</span><span class="p">):</span> <span class="gp">... </span> <span class="k">print</span> <span class="s1">'got:'</span><span class="p">,</span> <span class="n">event</span> </pre></div> </div> <p>that are put into the subscriptions list:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> <span class="go">got: 42</span> <span class="gp">>>> </span><span class="k">def</span> <span class="nf">g</span><span class="p">(</span><span class="n">event</span><span class="p">):</span> <span class="gp">... </span> <span class="k">print</span> <span class="s1">'also got:'</span><span class="p">,</span> <span class="n">event</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">g</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> <span class="go">got: 42</span> <span class="go">also got: 42</span> </pre></div> </div> <p>To unsubscribe, simply remove a subscriber from the list:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">f</span><span class="p">)</span> <span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">notify</span><span class="p">(</span><span class="mi">42</span><span class="p">)</span> <span class="go">also got: 42</span> </pre></div> </div> <p>Generally, application frameworks will provide more sophisticated subscription mechanisms that build on this simple mechanism. The frameworks will install subscribers that then dispatch to other subscribers based on event types or data.</p> <p>We’re done, so we’ll restore the subscribers:</p> <div class="highlight-pycon notranslate"><div class="highlight"><pre><span></span><span class="gp">>>> </span><span class="n">zope</span><span class="o">.</span><span class="n">event</span><span class="o">.</span><span class="n">subscribers</span><span class="p">[:]</span> <span class="o">=</span> <span class="n">old_subscribers</span> </pre></div> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="index.html" title="previous chapter"><code class="docutils literal notranslate"><span class="pre">zope.event</span></code> Documentation</a></p> <h4>Next topic</h4> <p class="topless"><a href="theory.html" title="next chapter">Theory of Operation</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="_sources/usage.rst.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <div class="searchformwrapper"> <form class="search" action="search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></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="theory.html" title="Theory of Operation" >next</a> |</li> <li class="right" > <a href="index.html" title="zope.event Documentation" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="index.html">zope.event 4.2.0 documentation</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010, Zope Foundation and Contributors. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.7.6. </div> </body> </html>
Close