Correct translation issues.

Correct py3 str model methods.
This commit is contained in:
Adarnof 2017-04-07 00:23:25 -04:00
parent 96b04a269d
commit 87973951b8
7 changed files with 14 additions and 18 deletions

View File

@ -13,7 +13,7 @@
</component>
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 2.7.11 virtualenv at ~/1.6" jdkType="Python SDK" />
<orderEntry type="jdk" jdkName="Python 3.3.2 (C:\Python33\python.exe)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">

2
.idea/misc.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.11 virtualenv at ~/1.6" project-jdk-type="Python SDK" />
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.3.2 (C:\Python33\python.exe)" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="1" />
</component>

View File

@ -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
#####################################################

View File

@ -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

View File

@ -36,7 +36,7 @@
<td class="text-center">{{ fat.fatlink.name }}</td>
<td class="text-center">{{ fat.character.character_name }}</td>
{% if fat.station != "No Station" %}
<td class="text-center">{% blocktrans %}Docked in {{ fat.system }}{% endblocktrans %}</td>
<td class="text-center">{% blocktrans %}Docked in {% endblocktrans %}{{ fat.system }}</td>
{% else %}
<td class="text-center">{{ fat.system }}</td>
{% endif %}

View File

@ -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:
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

View File

@ -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})