#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# realm = get_realm ( options [ 'domain' ] ) #NEWLINE# if ( options [ 'op' ] == 'show' ) : #NEWLINE# #INDENT# print ( ( 'Aliases for %s:' % ( realm . domain , ) ) ) #NEWLINE# for alias in realm_aliases ( realm ) : #NEWLINE# #INDENT# print ( alias ) #NEWLINE# #UNINDENT# sys . exit ( 0 ) #NEWLINE# #UNINDENT# alias = options [ 'alias' ] #NEWLINE# if ( options [ 'op' ] == 'add' ) : #NEWLINE# #INDENT# if ( get_realm ( alias ) is not None ) : #NEWLINE# #INDENT# print ( 'A Realm already exists for this domain, cannot add it as an alias for another realm!' ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# RealmAlias . objects . create ( realm = alias , domain = alias ) #NEWLINE# sys . exit ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( options [ 'op' ] == 'remove' ) : #NEWLINE# #INDENT# RealmAlias . objects . get ( realm = realm , domain = alias ) . delete ( ) #NEWLINE# sys . exit ( 0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . print_help ( 'python manage.py' , 'realm_alias' ) #NEWLINE# sys . exit ( 1 )