def handle_command_list(self, *args, **options): acc_keys = self.vumi_api.redis.smembers('disabled_metrics_accounts') if not acc_keys: self.stderr.write('No accounts have metric collection disabled.\n') else: for i, acc_key in enumerate(acc_keys): user = get_user_by_account_key(acc_key) output = u"%s. %s\n" % (i, user_details_as_string(user)) self.stdout.write(output.encode(self.encoding))
def handle_command_list(self, *args, **options): acc_keys = self.vumi_api.redis.smembers("disabled_metrics_accounts") if not acc_keys: self.stderr.write("No accounts have metric collection disabled.\n") else: for i, acc_key in enumerate(acc_keys): user = get_user_by_account_key(acc_key) output = u"%s. %s\n" % (i, user_details_as_string(user)) self.stdout.write(output.encode(self.encoding))
def create_billing_account(user_api): account_key = user_api.user_account_key user = get_user_by_account_key(account_key) _, created = Account.objects.get_or_create( user=user, account_number=account_key) if created: self.stdout.write( " Created billing account.\n") else: self.stdout.write( " Billing account already exists.\n")
def handle_reconcile_cache(self, worker_name, command, account_key, conversation_key): user = get_user_by_account_key(account_key) user_api = vumi_api_for_user(user) conversation = user_api.get_wrapped_conversation(conversation_key) if conversation is None: raise CommandError('Conversation does not exist') return VumiApiCommand.command(worker_name, command, user_account_key=account_key, conversation_key=conversation_key)