#NEWLINE# def register_user( self , access_token ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# user_info = helper . user_info ( access_token ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# name_parts = user_info [ 'name' ] . split ( ' ' ) #NEWLINE# if ( len ( name_parts ) > 1 ) : #NEWLINE# #INDENT# first_name = name_parts [ 0 ] #NEWLINE# last_name = ' ' . join ( name_parts [ 1 : ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( first_name , last_name ) = ( user_info [ 'name' ] , '' ) #NEWLINE# #UNINDENT# screen_name = user_info [ 'webUri' ] . split ( '/' ) [ ( - 1 ) ] #NEWLINE# user = User ( username = get_unique_username ( screen_name ) , first_name = first_name , last_name = last_name , password = hashlib . md5 ( str ( random . random ( ) ) ) . hexdigest ( ) ) #NEWLINE# user . save ( ) #NEWLINE# return user