Login

Snippets by barnardo

Snippet List

Simple Syslog Logging Class with Decorator

Simple logging decorator. Logs the function name along with the message. `Jul 14 16:10:42 mtzion test_func: 1 two` Define SYSLOG_FACILITY in settings.py. import syslog SYSLOG_FACILITY = syslog.LOG_LOCAL1

  • decorator
  • logging
  • syslog
Read More

Facebook Authentication Backend

Authentication through Facebook's Graph API. See [http://developers.facebook.com/docs/authentication/](http://developers.facebook.com/docs/authentication/) [http://developers.facebook.com/docs/authentication/permissions](http://developers.facebook.com/docs/authentication/permissions) [http://developers.facebook.com/docs/api](http://developers.facebook.com/docs/api) [http://github.com/facebook/python-sdk/blob/master/examples/oauth/facebookoauth.py](http://github.com/facebook/python-sdk/blob/master/examples/oauth/facebookoauth.py) Define the facebook tokens in settings.py and replace <app_name> with the name of your app. You will probably want to modify the scope on the authorize link in the template, see the authentication permissions link. This updates the user model every time the user logs in but I think that it is okay so the data is always correct. I have tested this but not rigorously. If there is a hole and everyone gets admin rights to your site don't say I didn't warn you :). Comments are appreciated. 16 June 2010 Added missing imports. Cleaned up the template. Shouts out to @obeattie and @whalesalad

  • graph
  • authentication
  • login
  • auth
  • facebook
  • oauth
Read More

barnardo has posted 2 snippets.