From 19458e923475a4ca19d21534d68e441f6e7a113e Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Wed, 26 May 2010 09:22:51 +0100 Subject: [PATCH] Fixes issues experienced during the eve upgrade. Accounts marked as "Other Error" were killed when really they should be ignored for the moment. I've added further checking on the eve_api import that ingores down errors (900 and above) and the access checker to ignore accounts with a status of 3. --- eve_api/api_puller/accounts.py | 5 +++++ sso/models.py | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/eve_api/api_puller/accounts.py b/eve_api/api_puller/accounts.py index 9a26bb8..de755ee 100755 --- a/eve_api/api_puller/accounts.py +++ b/eve_api/api_puller/accounts.py @@ -55,6 +55,11 @@ def import_eve_account(api_key, user_id): return error = enode[0].getAttribute('code') + + if int(error) >= 900: + # API disabled, down or rejecting, return without changes + return + if error == '211': account.api_status = API_STATUS_ACC_EXPIRED else: diff --git a/sso/models.py b/sso/models.py index a454aa5..d424905 100644 --- a/sso/models.py +++ b/sso/models.py @@ -64,7 +64,7 @@ class SSOUser(models.Model): # Create a list of Char groups chargroups = [] for eacc in EVEAccount.objects.filter(user=self.user): - if eacc.api_status == 1: + if eacc.api_status in [1,3]: for char in eacc.characters.all(): if char.corporation.group: chargroups.append(char.corporation.group) @@ -75,6 +75,8 @@ class SSOUser(models.Model): # Generate the list of groups to add/remove delgroups = set(set(self.user.groups.all()) & set(corpgroups)) - set(chargroups) addgroups = set(chargroups) - set(set(self.user.groups.all()) & set(corpgroups)) + + print "Add: ", addgroups, "Del:", delgroups, "Current:", self.user.groups.all() for g in delgroups: self.user.groups.remove(g)