djangosnippets.org: Latest snippets posted by nikmolnarhttp://djangosnippets.org/users/nikmolnar/2013-06-28T17:08:04.046722-05:00nikmolnarPassword Obfuscation Log Filter
2013-06-28T17:08:04.046722-05:00nikmolnarhttp://djangosnippets.org/snippets/2966/<p>This is a simple logging <a href="https://docs.djangoproject.com/en/1.5/topics/logging/#topic-logging-parts-filters">filter</a> to ensure that user-entered passwords aren't recorded in the log or emailed to admins as part of the request data if an error occurs during registration/login.</p>
Freely redistributableAutomatic Memoization Decorator
2013-01-05T20:53:12.666087-06:00nikmolnarhttp://djangosnippets.org/snippets/2874/<p>This decorator will memoize the results of instance methods, similar to <code>django.util.functional.memoize</code>, but automatically creates a cache attached to the object (and therefore shares the life span of the object) rather than requiring you to provide your own. Note this is intended for instance methods only, though it may …</p>
Freely redistributableAdd get_addr() method to request object
2012-12-13T17:17:26.955015-06:00nikmolnarhttp://djangosnippets.org/snippets/2863/<p>I thought it would be useful to have a <code>get_addr()</code> method available on request objects, similar to the <code>get_host()</code> provided by Django. This middleware will add a <code>get_addr()</code> method to requests which uses the <code>X-Forwarded-For</code> header (useful if you're behind a proxy) if it's present and you have the <code>USE_X_FORWARDED_FOR …</code></p>
Freely redistributable