From 3b2549eeb0ff36d05e3b73c6b684c41ff23eff42 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 19 Jan 2011 08:49:35 +0000 Subject: [PATCH] Check if the character has a alliance, if not use None --- sso/services/ts3/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sso/services/ts3/__init__.py b/sso/services/ts3/__init__.py index 00d8cdb..4d5f31f 100644 --- a/sso/services/ts3/__init__.py +++ b/sso/services/ts3/__init__.py @@ -33,9 +33,13 @@ class TS3Service(BaseService): """ Add a user, returns a UID for that user """ details = { 'name': username, - 'alliance': kwargs['character'].corporation.alliance.ticker, 'corporation': kwargs['character'].corporation.ticker } + if kwargs['character'].corporation.alliance: + details['alliance'] = kwargs['character'].corporation.alliance.ticker + else: + details['alliance'] = None + username = self.settings['name_format'] % details ret = self.conn.send_command('tokenadd', {'tokentype': 0, 'tokenid1': self.settings['authed_sgid'], 'tokenid2': 0, 'tokendescription': kwargs['character'].name.replace(' ', ''), 'tokencustomset': "ident=sso_uid value=%s|ident=sso_userid value=%s|ident=eve_charid value=%s" % (kwargs['character'].name.replace(' ', ''), kwargs['user'].id, kwargs['character'].id) }) if 'keys' in ret and 'token' in ret['keys']: