From 87973951b89d17d1636acde498fd06e0e44f336f Mon Sep 17 00:00:00 2001 From: Adarnof Date: Fri, 7 Apr 2017 00:23:25 -0400 Subject: [PATCH] Correct translation issues. Correct py3 str model methods. --- .idea/allianceauth.iml | 2 +- .idea/misc.xml | 2 +- alliance_auth/settings.py.example | 2 +- fleetactivitytracking/models.py | 3 +-- .../fleetactivitytracking/fatlinkview.html | 2 +- fleetactivitytracking/views.py | 19 ++++++++----------- services/modules/teamspeak3/manager.py | 2 +- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.idea/allianceauth.iml b/.idea/allianceauth.iml index a40b16c4..6a896f40 100755 --- a/.idea/allianceauth.iml +++ b/.idea/allianceauth.iml @@ -13,7 +13,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index c33bd879..0b2a2535 100755 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example index 5ee368ab..2a953ea2 100644 --- a/alliance_auth/settings.py.example +++ b/alliance_auth/settings.py.example @@ -64,7 +64,7 @@ INSTALLED_APPS = [ ## Django Project Configuration ## ##################################################### -# You shouldn't need to touch most of this. +# Don't touch unless you know what you're doing. # Scroll down for Auth Configuration ##################################################### diff --git a/fleetactivitytracking/models.py b/fleetactivitytracking/models.py index acd4c50c..45879bc8 100644 --- a/fleetactivitytracking/models.py +++ b/fleetactivitytracking/models.py @@ -36,5 +36,4 @@ class Fat(models.Model): unique_together = (('character', 'fatlink'),) def __str__(self): - output = "Fat-link for %s" % self.character.character_name - return output.encode('utf-8') + return "Fat-link for %s" % self.character.character_name diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html b/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html index 8b1fa240..83a7df50 100644 --- a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html +++ b/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html @@ -36,7 +36,7 @@ {{ fat.fatlink.name }} {{ fat.character.character_name }} {% if fat.station != "No Station" %} - {% blocktrans %}Docked in {{ fat.system }}{% endblocktrans %} + {% blocktrans %}Docked in {% endblocktrans %}{{ fat.system }} {% else %} {{ fat.system }} {% endif %} diff --git a/fleetactivitytracking/views.py b/fleetactivitytracking/views.py index 53a52146..8d177b99 100644 --- a/fleetactivitytracking/views.py +++ b/fleetactivitytracking/views.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from django.conf import settings from django.shortcuts import render, redirect, get_object_or_404 -from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import permission_required from django.core.exceptions import ValidationError @@ -98,15 +97,10 @@ def fatlink_statistics_view(request, year=datetime.date.today().year, month=date fat_stats = {} - # get FAT stats for member corps - for corp_id in settings.STR_CORP_IDS: - fat_stats[corp_id] = CorpStat(corp_id, start_of_month, start_of_next_month) - for alliance_id in settings.STR_ALLIANCE_IDS: - alliance_corps = EveCorporationInfo.objects.filter(alliance__alliance_id=alliance_id) - for corp in alliance_corps: - fat_stats[corp.corporation_id] = CorpStat(corp.corporation_id, start_of_month, start_of_next_month) + for corp in EveCorporationInfo.objects.all(): + fat_stats[corp.corporation_id] = CorpStat(corp.corporation_id, start_of_month, start_of_next_month) - # get FAT stats for corps not in alliance + # get FAT stats for corps without models fats_in_span = Fat.objects.filter(fatlink__fatdatetime__gte=start_of_month).filter( fatlink__fatdatetime__lt=start_of_next_month).exclude(character__corporation_id__in=fat_stats) @@ -210,10 +204,12 @@ def click_fatlink_view(request, token, hash, fatname): location['solar_system_name'] = \ c.Universe.get_universe_systems_system_id(system_id=location['solar_system_id']).result()[ 'name'] + print(location) if location['station_id']: location['station_name'] = \ c.Universe.get_universe_stations_station_id(station_id=location['station_id']).result()['name'] elif location['structure_id']: + print('HERE') c = token.get_esi_client(Universe='v1') location['station_name'] = \ c.Universe.get_universe_structures_structure_id(structure_id=location['structure_id']).result()[ @@ -228,7 +224,7 @@ def click_fatlink_view(request, token, hash, fatname): fat.shiptype = ship['ship_type_name'] fat.fatlink = fatlink fat.character = character - fat.user = character.user + fat.user = request.user try: fat.full_clean() fat.save() @@ -236,7 +232,7 @@ def click_fatlink_view(request, token, hash, fatname): except ValidationError as e: err_messages = [] for errorname, message in e.message_dict.items(): - err_messages.append(message[0].decode()) + err_messages.append(message[0]) messages.error(request, ' '.join(err_messages)) else: context = {'character_id': token.character_id, @@ -244,6 +240,7 @@ def click_fatlink_view(request, token, hash, fatname): return render(request, 'fleetactivitytracking/characternotexisting.html', context=context) else: messages.error(request, _('FAT link has expired.')) + return redirect(fatlink_view) @login_required diff --git a/services/modules/teamspeak3/manager.py b/services/modules/teamspeak3/manager.py index fe39d52f..52dd81a9 100755 --- a/services/modules/teamspeak3/manager.py +++ b/services/modules/teamspeak3/manager.py @@ -57,7 +57,7 @@ class Teamspeak3Manager: sanatized = "[" + corp_ticker + "]" + username return sanatized[:30] - def _get_userid(self, uid):: + def _get_userid(self, uid): logger.debug("Looking for uid %s on TS3 server." % uid) try: ret = self.server.send_command('customsearch', {'ident': 'sso_uid', 'pattern': uid})