<s> from django . core . management . base import BaseCommand , CommandError <EOL> from facebook . testusers import TestUsers <EOL> from facebook . modules . profile . user . models import TestUser <EOL> from facebook . graph import get_static_graph <EOL> class Command ( BaseCommand ) : <EOL> args = '<STR_LIT>' <EOL> help = '<STR_LIT>' <EOL> can_import_settings = True <EOL> def handle ( self , * args , ** options ) : <EOL> if args : <EOL> try : <EOL> arg1 = int ( args [ <NUM_LIT:0> ] ) <EOL> except AttributeError : <EOL> raise CommandError ( '<STR_LIT>' % user1 ) <EOL> try : <EOL> arg2 = int ( args [ <NUM_LIT:1> ] ) <EOL> except IndexError : <EOL> arg2 = None <EOL> except AttributeError : <EOL> raise CommandError ( '<STR_LIT>' % user2 ) <EOL> try : <EOL> app = args [ <NUM_LIT:2> ] <EOL> except IndexError : <EOL> app = None <EOL> else : <EOL> raise CommandError ( '<STR_LIT>' ) <EOL> graph = get_static_graph ( app_dict = app ) <EOL> testusers = TestUsers ( graph ) <EOL> try : <EOL> user1 = TestUser . objects . get ( id = int ( arg1 ) ) <EOL> except TestUser . DoesNotExist : <EOL> raise CommandError ( '<STR_LIT>' ) <EOL> if arg2 : <EOL> try : <EOL> user2 = TestUser . objects . get ( id = int ( arg2 ) ) <EOL> except TestUser . DoesNotExist : <EOL> raise CommandError ( '<STR_LIT>' ) <EOL> response = testusers . make_friends_with ( user1 , user2 ) <EOL> self . stdout . write ( u'<STR_LIT>' % response ) <EOL> else : <EOL> users = TestUser . objects . exclude ( id = user1 . id ) <EOL> for user in users : <EOL> response = testusers . make_friends_with ( user1 , user ) <EOL> self . stdout . write ( u'<STR_LIT>' % response ) </s>
