#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# duplicates = False #NEWLINE# for email in options [ 'emails' ] : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# get_user_profile_by_email ( email ) #NEWLINE# print ( ( email + ': There is already a user registered with that address.' ) ) #NEWLINE# duplicates = True #NEWLINE# continue #NEWLINE# #UNINDENT# except UserProfile . DoesNotExist : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if duplicates : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# realm = None #NEWLINE# domain = options [ 'domain' ] #NEWLINE# if domain : #NEWLINE# #INDENT# realm = get_realm ( domain ) #NEWLINE# #UNINDENT# if ( not realm ) : #NEWLINE# #INDENT# print ( ( "The realm %s doesn't exist yet, please create it first." % ( domain , ) ) ) #NEWLINE# print ( "Don't forget default streams!" ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# for email in options [ 'emails' ] : #NEWLINE# #INDENT# if realm : #NEWLINE# #INDENT# if ( ( not email_allowed_for_realm ( email , realm ) ) and ( not options [ 'force' ] ) ) : #NEWLINE# #INDENT# print ( ( "You've asked to add an external user (%s) to a closed realm (%s)." % ( email , domain ) ) ) #NEWLINE# print ( 'Are you sure? To do this, pass --force.' ) #NEWLINE# exit ( 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# prereg_user = PreregistrationUser ( email = email , realm = realm ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# prereg_user = PreregistrationUser ( email = email ) #NEWLINE# #UNINDENT# prereg_user . save ( ) #NEWLINE# print ( ( ( email + ': ' ) + Confirmation . objects . get_link_for_object ( prereg_user ) ) )