#NEWLINE# def create_authorization_code( self , user , client , custom = None ) : #NEWLINE# #INDENT# object_params = { #NEWLINE# #INDENT# 'user' : user , #NEWLINE# 'client' : client , #NEWLINE# 'redirect_uri' : client . redirect_uri , #NEWLINE# 'scopes' : self . oauth_client . scope_objects , #NEWLINE# #UNINDENT# } #NEWLINE# object_params . update ( ( custom or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# scopes = object_params . pop ( 'scopes' ) #NEWLINE# authorization_code = AuthorizationCode . objects . create ( ** object_params ) #NEWLINE# if scopes : #NEWLINE# #INDENT# authorization_code . scopes = scopes #NEWLINE# authorization_code . save ( ) #NEWLINE# #UNINDENT# return custom