Google Single Sign On using Django

Here are the URLs for creating a Google Single Sign On.

Access Google OAuth via your web server:

http://code.google.com/apis/accounts/docs/OAuth2WebServer.html

Google Access Tokens:

https://accounts.google.com/b/0/IssuedAuthSubTokens

Google APIs:

http://code.google.com/apis/gdata/docs/directory.html

Android OAuth:

https://sites.google.com/site/oauthgoog/oauth-practices/mobile-apps-for-complex-login-systems/samplecode#TOC-3.2.-Android

Service Connection Example:

http://developer.android.com/training/id-auth/authenticate.html#ConnectToService

Google OAuth Playground:

http://googlecodesamples.com/oauth_playground/

Google Data AuthScopes:

http://code.google.com/apis/gdata/faq.html#AuthScopes

Google Python Client Library:

http://code.google.com/p/google-api-python-client/

Google Oauth2 Login:

http://code.google.com/apis/accounts/docs/OAuth2Login.html

Be Sociable, Share!

PostgreSQL Sequence Updates

I had a problem with PostgreSQL pgdump recently.  My setval() calls were all set to ’1′.  I whipped up this quick script to fix things:

#!/usr/bin/env python

DB_NAME = "my_db"

from subprocess import Popen, PIPE
import re

exclude = [ 'tablename', 'rows' ]
tp = re.compile( '[^a-z_]' )
ts = Popen( [ "/usr/bin/psql", DB_NAME, "-c SELECT tablename FROM pg_tables WHERE tablename NOT LIKE 'pg_%' AND tablename NOT LIKE 'sql_%' ORDER BY tablename" ], stdout=PIPE ).communicate()[ 0 ].split( ' ' )

tables = []
for t in ts:
    t = tp.sub( '', t )
    if len( t ) == 0 or t in exclude:
        continue
    tables.append( t )

for t in tables:
    sql = "SELECT pg_catalog.setval( pg_get_serial_sequence( '%s', 'id' ), ( SELECT MAX( id ) FROM %s ) + 1 );" % ( t, t )
    print Popen( [ "/usr/bin/psql", DB_NAME, "-c %s" % sql ], stdout=PIPE ).communicate()[ 0 ]
view raw file1.py This Gist is brought to you using Simple Gist Embed.
Be Sociable, Share!