Access Control Mechanisms with mod_wsgi
Here my piece of code for managing users with WSGIAuthUserScript.
- basic
- auth
- mod-wsgi
- config-file
- option-parser
Here my piece of code for managing users with WSGIAuthUserScript.
Generate QR Code image from a string with the Google charts API http://code.google.com/intl/fr-FR/apis/chart/types.html#qrcodes Exemple usage in a template {{ my_string|qrcode:"my alt" }} will return the image tag with * src: http://chart.apis.google.com/chart?chs=150x150&cht=qr&chl=my_string&choe=UTF-8 * alt: my alt"
Decorates signals for executing only one time Exemple usage : from django.core.mail import EmailMultiAlternatives from django.template.loader import render_to_string from django.contrib.auth.models import User @one def user_welcome(sender, instance, created, **kwargs): # Send a welcome email if created == True and isinstance(instance, User): instance.message_set.create(message=_(u"Ho, Welcome %s!" % instance)) subject, from_email, to = 'Welcome !', '[email protected]', instance.email text_content = render_to_string('mail/welcome.html', { 'user': instance }) msg = EmailMultiAlternatives(subject, text_content, from_email, [to]) msg.send()
This snippet is used to create a script for monitoring sphinx status with Nagios via [django-sphinx](http://code.google.com/p/django-sphinx/). It returns 0 (OK) or 2 (CRITICAL). Remember to change this strings `ModelToMonitor` and `app_name`. Usage : `./manage your-controls-command --log` > /your/script/name.py
This snippet is used to monitor sphinx status via [django-sphinx](http://code.google.com/p/django-sphinx/). It returns 0 (OK) or 2 (CRITICAL). Remember to change this strings `ModelToMonitor` and `app_name`. Usage : `./manage your-controls-command --log`
For disabling autocomplete and security purpose, this snippet defines a CharField with a randomness name for each request of the form. This is useful for turning off autocomplete for credit card input in all browsers, without breaking the xhtml validation. * [https://wiki.mozilla.org/The_autocomplete_attribute_and_web_documents_using_XHTML#Security](https://wiki.mozilla.org/The_autocomplete_attribute_and_web_documents_using_XHTML#Security) * [http://en.wikipedia.org/wiki/Cryptographic_nonce](http://en.wikipedia.org/wiki/Cryptographic_nonce)
johnnoone has posted 6 snippets.