djangosnippets.org: Latest snippets posted by teeparkhttp://djangosnippets.org/users/teepark/2009-04-09T23:08:20.811588-05:00teeparkDiggBarMiddleware
2009-04-09T23:08:20.811588-05:00teeparkhttp://djangosnippets.org/snippets/1425/<p>give diggbar users something to think about</p>
<p>(http://daringfireball.net/2009/04/how_to_block_the_diggbar)</p>
Freely redistributablegeneral-purpose django XMLRC dispatcher
2009-02-13T18:20:12.452149-06:00teeparkhttp://djangosnippets.org/snippets/1322/<p>create an instance of this class: <code>rpcserver = XMLRPC()</code> then define handlers on it with the register decorator:</p>
<pre><code>@rpcserver.register("pingback.ping")
def handle_pingback(sourceURI, targetURI)
# ...
</code></pre>
<p>de-serialization of the arguments and serialization of the return values is handled by the XMLRPC object, so just expect python built-in types as your arguments and …</p>
Freely redistributableserver with debugging backdoor
2008-09-08T15:04:29.999288-05:00teeparkhttp://djangosnippets.org/snippets/1038/<p>this starts up two servers - HTTP serving the django application on port 8000 and a port 8001 server that will start an interactive interpreter with any incoming connections. this enables you to have an interpreter in the same process as your server.</p>
<pre><code>$ wget http://localhost:8000/someurl/
(...)
$ nc localhost …</code></pre>
Freely redistributablecommon model privacy
2007-07-31T13:13:55.651539-05:00teeparkhttp://djangosnippets.org/snippets/348/<p>A BooleanField indicating privacy is common on models, but the name of the field and whether the field being True indicates private or public both may change across models. If there is more than one potentially private model, a common interface is needed. A commonly-named method would do the job …</p>
Freely redistributable