djangosnippets.org: Latest snippets posted by robmadolehttps://djangosnippets.org/users/robmadole/2010-12-01T08:46:29.250707-06:00robmadoleTLS(SSL) middleware, per URL pattern or whole site
2010-12-01T08:46:29.250707-06:00robmadolehttps://djangosnippets.org/snippets/2282/<p>Allows url patterns to include a boolean indicating whether a view requires
TLS(SSL). The accompanying middleware handles the redirects needed to make
sure that it upholds this requirement.
</p>
<p><strong>WARNING</strong>: this monkey-patches some Django internals and is difficult to test
since Django's TestClient does not support TLS. If you use …</p>
Freely redistributableMonkey-patch Django's test client to return WSGIRequest objects
2010-11-12T11:11:45.721242-06:00robmadolehttps://djangosnippets.org/snippets/2259/<p>Testing low-level functionality sometimes requires a WSGIRequest object. An example of this is testing template tags.
</p>
<p>This will monkey-patch the test Client object to return WSGIRequest objects
</p>
<p>Normal Django behavior:
</p>
<pre><code>>>> client.get('/')
<HttpResponse >
</code></pre><p>With this code, get the request object:
</p>
<pre><code>>>> client.request_from.get('/')
<WSGIRequest >
</code></pre><p>Installation:
</p>
<p>For this to work, …</p>
Freely redistributable