Merge remote-tracking branch 'refs/remotes/R4stl1n/master'

This commit is contained in:
Brett Costabile 2015-12-01 19:01:39 -05:00
commit c0986abf4a
142 changed files with 126 additions and 37 deletions

3
.gitignore vendored
View File

@ -57,3 +57,6 @@ target/
alliance_auth/settings.py alliance_auth/settings.py
*Thumbs.db *Thumbs.db
nginx_config.txt nginx_config.txt
# custom staticfiles
static/*

View File

@ -122,11 +122,13 @@ TEMPLATE_CONTEXT_PROCESSORS = (
) )
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
'templates', 'customization/templates',
'stock/templates',
) )
STATICFILES_DIRS = ( STATICFILES_DIRS = (
'static', 'customization/static',
'stock/static',
) )
LOGIN_URL = '/login_user/' LOGIN_URL = '/login_user/'
@ -147,6 +149,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/ # https://docs.djangoproject.com/en/1.6/howto/static-files/
STATIC_URL = '/static/' STATIC_URL = '/static/'
STATIC_ROOT = '/home/allianceserver/allianceauth/static/'
##################################################### #####################################################
## ##

View File

@ -369,17 +369,22 @@ def run_corp_update():
# Update all allinace info's # Update all allinace info's
for all_alliance_info in EveManager.get_all_alliance_info(): for all_alliance_info in EveManager.get_all_alliance_info():
all_alliance_api_info = EveApiManager.get_alliance_information(all_alliance_info.alliance_id) if EveApiManager.check_if_alliance_exists(all_alliance_info.alliance_id):
if (not settings.IS_CORP and all_alliance_info.alliance_id == settings.ALLIANCE_ID): all_alliance_api_info = EveApiManager.get_alliance_information(all_alliance_info.alliance_id)
EveManager.update_alliance_info(all_alliance_api_info['id'], all_alliance_api_info['executor_id'], if (not settings.IS_CORP and all_alliance_info.alliance_id == settings.ALLIANCE_ID):
all_alliance_api_info['member_count'], False) EveManager.update_alliance_info(all_alliance_api_info['id'], all_alliance_api_info['executor_id'],
elif standing_level in corp_standings: all_alliance_api_info['member_count'], False)
if int(all_alliance_info.alliance_id) in corp_standings[standing_level]: elif standing_level in corp_standings:
if int(corp_standings[standing_level][int(all_alliance_info.alliance_id)][ if int(all_alliance_info.alliance_id) in corp_standings[standing_level]:
'standing']) >= settings.BLUE_STANDING: if int(corp_standings[standing_level][int(all_alliance_info.alliance_id)][
EveManager.update_alliance_info(all_alliance_api_info['id'], 'standing']) >= settings.BLUE_STANDING:
all_alliance_api_info['executor_id'], EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['member_count'], True) all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], True)
else:
EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False)
else: else:
EveManager.update_alliance_info(all_alliance_api_info['id'], EveManager.update_alliance_info(all_alliance_api_info['id'],
all_alliance_api_info['executor_id'], all_alliance_api_info['executor_id'],
@ -389,41 +394,44 @@ def run_corp_update():
all_alliance_api_info['executor_id'], all_alliance_api_info['executor_id'],
all_alliance_api_info['member_count'], False) all_alliance_api_info['member_count'], False)
else: else:
EveManager.update_alliance_info(all_alliance_api_info['id'], #alliance no longer exists
all_alliance_api_info['executor_id'], all_alliance_info.delete()
all_alliance_api_info['member_count'], False)
# Update corp infos # Update corp infos
for all_corp_info in EveManager.get_all_corporation_info(): for all_corp_info in EveManager.get_all_corporation_info():
alliance = None if EveApiManager.check_if_corp_exists(all_corp_info.corporation_id):
corpinfo = EveApiManager.get_corporation_information(all_corp_info.corporation_id) alliance = None
if corpinfo['alliance']['id'] is not None: corpinfo = EveApiManager.get_corporation_information(all_corp_info.corporation_id)
alliance = EveManager.get_alliance_info_by_id(corpinfo['alliance']['id']) if corpinfo['alliance']['id'] is not None:
alliance = EveManager.get_alliance_info_by_id(corpinfo['alliance']['id'])
if alliance is not None and all_corp_info.alliance is not None: if alliance is not None and all_corp_info.alliance is not None:
if (not settings.IS_CORP) and (all_corp_info.alliance.alliance_id == settings.ALLIANCE_ID): if (not settings.IS_CORP) and (all_corp_info.alliance.alliance_id == settings.ALLIANCE_ID):
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, False) EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, False)
elif int(alliance.alliance_id) in corp_standings[standing_level]: elif int(alliance.alliance_id) in corp_standings[standing_level]:
if int(corp_standings[standing_level][int(alliance.alliance_id)][ if int(corp_standings[standing_level][int(alliance.alliance_id)][
'standing']) >= settings.BLUE_STANDING: 'standing']) >= settings.BLUE_STANDING:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance,
True) True)
else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance,
False)
else: else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance,
False) False)
else: else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], alliance, if int(all_corp_info.corporation_id) in corp_standings[standing_level]:
False) if int(corp_standings[standing_level][int(all_corp_info.corporation_id)][
else: 'standing']) >= settings.BLUE_STANDING:
if int(all_corp_info.corporation_id) in corp_standings[standing_level]: EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, True)
if int(corp_standings[standing_level][int(all_corp_info.corporation_id)][ else:
'standing']) >= settings.BLUE_STANDING: EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, False)
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, True)
else: else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, False) EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, False)
else: else:
EveManager.update_corporation_info(corpinfo['id'], corpinfo['members']['current'], None, False) #corp has closed
all_corp_info.delete()
# Remove irrelevent corp and alliance models # Remove irrelevent corp and alliance models
# Check the corps # Check the corps

7
customization/.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
#Ignore everything
*
#Except these
!.gitignore
!README.md
!templates
!static

7
customization/README.md Normal file
View File

@ -0,0 +1,7 @@
If you want to customize your site, place the custom files in the appropriate directories below.
Place custom pages in the templates directory.
Place custom images, css, etc in the static directory.
Be sure to make folders are required to preserve the original file location.

5
customization/static/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore
!README.md

View File

@ -0,0 +1,7 @@
Place your custom static files in this folder. Maintain the folder structure of the original static folder.
For instance, if you have a custom background image for the index page, it would be located at:
`customization/static/img/index_images/index_blank_bg.jpg`
This directory will get searched first for the image, then fall back to the default.

5
customization/templates/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
#Ignore everything in this directory
*
# Except this file
!.gitignore
!README.md

View File

@ -0,0 +1,7 @@
Place your custom templates in this folder.
Maintain the folder structure of the original templates folder.
For instance, if you have a custom index page, it would be located at:
`customization/templates/public/index.html`
This directory will get searched first, then fall back to the defaults.

View File

@ -179,3 +179,38 @@ class EveApiManager():
return False return False
return False return False
@staticmethod
def check_if_alliance_exists(alliance_id):
try:
api = evelink.api.API()
eve = evelink.eve.EVE(api=api)
alliances = eve.alliances()
if int(alliance_id) in alliances[0]:
return True
else:
return False
except evelink.api.APIError as error:
print error
return False
except ValueError as error:
#attempts to catch error resulting from checking alliance_of nonetype models
print error
return False
return False
@staticmethod
def check_if_corp_exists(corp_id):
try:
api = evelink.api.API()
corp = evelink.corp.Corp(api=api)
corpinfo = corp.corporation_sheet(corp_id=corp_id)
if corpinfo[0]['members']['current'] > 0:
return True
else:
return False
except evelink.api.APIError as error:
#could be smart and check for error code523 to verify error due to no corp instead of catch-all
print error
return False
return False

2
static/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore

View File

Before

Width:  |  Height:  |  Size: 58 B

After

Width:  |  Height:  |  Size: 58 B

View File

Before

Width:  |  Height:  |  Size: 75 B

After

Width:  |  Height:  |  Size: 75 B

View File

Before

Width:  |  Height:  |  Size: 199 B

After

Width:  |  Height:  |  Size: 199 B

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

Before

Width:  |  Height:  |  Size: 843 B

After

Width:  |  Height:  |  Size: 843 B

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

View File

Before

Width:  |  Height:  |  Size: 45 B

After

Width:  |  Height:  |  Size: 45 B

View File

Before

Width:  |  Height:  |  Size: 711 B

After

Width:  |  Height:  |  Size: 711 B

View File

Before

Width:  |  Height:  |  Size: 506 B

After

Width:  |  Height:  |  Size: 506 B

View File

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 176 B

View File

Before

Width:  |  Height:  |  Size: 130 B

After

Width:  |  Height:  |  Size: 130 B

View File

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 299 B

View File

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 119 B

View File

Before

Width:  |  Height:  |  Size: 145 B

After

Width:  |  Height:  |  Size: 145 B

View File

Before

Width:  |  Height:  |  Size: 192 B

After

Width:  |  Height:  |  Size: 192 B

View File

Before

Width:  |  Height:  |  Size: 119 B

After

Width:  |  Height:  |  Size: 119 B

View File

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 390 B

View File

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

View File

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 319 B

View File

Before

Width:  |  Height:  |  Size: 667 B

After

Width:  |  Height:  |  Size: 667 B

View File

Before

Width:  |  Height:  |  Size: 341 B

After

Width:  |  Height:  |  Size: 341 B

View File

Before

Width:  |  Height:  |  Size: 477 B

After

Width:  |  Height:  |  Size: 477 B

View File

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View File

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

View File

Before

Width:  |  Height:  |  Size: 102 B

After

Width:  |  Height:  |  Size: 102 B

View File

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 116 B

View File

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 186 B

View File

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 265 B

View File

Before

Width:  |  Height:  |  Size: 273 B

After

Width:  |  Height:  |  Size: 273 B

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 552 B

View File

Before

Width:  |  Height:  |  Size: 369 B

After

Width:  |  Height:  |  Size: 369 B

View File

Before

Width:  |  Height:  |  Size: 197 B

After

Width:  |  Height:  |  Size: 197 B

View File

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 203 B

View File

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View File

Before

Width:  |  Height:  |  Size: 200 B

After

Width:  |  Height:  |  Size: 200 B

View File

Before

Width:  |  Height:  |  Size: 932 B

After

Width:  |  Height:  |  Size: 932 B

View File

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 336 B

View File

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 351 B

View File

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View File

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 248 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 351 KiB

After

Width:  |  Height:  |  Size: 351 KiB

View File

Before

Width:  |  Height:  |  Size: 304 KiB

After

Width:  |  Height:  |  Size: 304 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Some files were not shown because too many files have changed in this diff Show More