<s> from django . db import models <EOL> class TokenManager ( models . Manager ) : <EOL> def create_token ( self , consumer , token_type , timestamp , scope , <EOL> is_approved = False , user = None , callback = None , callback_confirmed = False ) : <EOL> """<STR_LIT>""" <EOL> token , created = self . get_or_create ( consumer = consumer , <EOL> token_type = token_type , <EOL> timestamp = timestamp , <EOL> scope = scope , <EOL> is_approved = is_approved , <EOL> user = user , <EOL> callback = callback , <EOL> callback_confirmed = callback_confirmed ) <EOL> if created : <EOL> if consumer . rsa_signature : <EOL> token . secret = consumer . secret <EOL> token . save ( ) <EOL> token . generate_random_codes ( ) <EOL> return token </s>
