diff --git a/.coveragerc b/.coveragerc index 9e31bd50..6df2ec18 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,20 +1,7 @@ [run] branch = True source = - alliance_auth - authentication - corputils - eveonline - fleetactivitytracking - fleetup - groupmanagement - hrapplications - notifications - optimer - permissions_tool - services - srp - timerboard + allianceauth omit = */migrations/* diff --git a/.gitignore b/.gitignore index cd472cd5..c1610880 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,7 @@ static/* celerybeat-schedule #pycharm -.idea/* \ No newline at end of file +.idea/* + +#log folder +log/* diff --git a/.travis.yml b/.travis.yml index 4f045faf..f6ad12fa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,9 +2,11 @@ language: python python: - "3.5" - "3.6" + - "3.7-dev" # command to install dependencies install: - pip install requests + - pip install Django==$DJANGO_VERSION - pip install -r requirements.txt - pip install -r testing-requirements.txt # command to run tests @@ -12,3 +14,10 @@ script: coverage run runtests.py cache: pip after_success: coveralls +matrix: + allow_failures: + - python: "3.7-dev" +env: + - DJANGO_VERSION=1.10.8 # Remove in December 2017 + - DJANGO_VERSION=1.11.5 + # Add 2.0 when available and allow_failures (env: KEY=VALUE) diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..d46a6471 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +include LICENSE +include README.md +include MANIFEST.in +graft allianceauth + +global-exclude __pycache__ +global-exclude *.py[co] diff --git a/alliance_auth/__init__.py b/alliance_auth/__init__.py index 50fe2be2..e69de29b 100644 --- a/alliance_auth/__init__.py +++ b/alliance_auth/__init__.py @@ -1,8 +0,0 @@ -from __future__ import absolute_import, unicode_literals - -# This will make sure the app is always imported when -# Django starts so that shared_task will use this app. -from .celeryapp import app as celery_app # noqa - -__version__ = '1.16-dev' -NAME = 'Alliance Auth v%s' % __version__ diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example index 9249416c..51427e29 100644 --- a/alliance_auth/settings.py.example +++ b/alliance_auth/settings.py.example @@ -27,39 +27,39 @@ INSTALLED_APPS = [ 'django.contrib.humanize', 'django_celery_beat', 'bootstrapform', - 'geelweb.django.navhelper', + 'allianceauth.thirdparty.navhelper', 'bootstrap_pagination', 'sortedm2m', - 'authentication', - 'services', - 'eveonline', - 'groupmanagement', - 'notifications', + 'allianceauth.authentication', + 'allianceauth.services', + 'allianceauth.eveonline', + 'allianceauth.groupmanagement', + 'allianceauth.notifications', 'esi', # Optional apps - remove if not desired - 'corputils', - 'hrapplications', - 'timerboard', - 'srp', - 'optimer', - 'fleetup', - 'fleetactivitytracking', - 'permissions_tool', + 'allianceauth.corputils', + 'allianceauth.hrapplications', + 'allianceauth.timerboard', + 'allianceauth.srp', + 'allianceauth.optimer', + 'allianceauth.fleetup', + 'allianceauth.fleetactivitytracking', + 'allianceauth.permissions_tool', # Services - remove if not used - 'services.modules.mumble', - 'services.modules.discord', - 'services.modules.discourse', - 'services.modules.ipboard', - 'services.modules.ips4', - 'services.modules.market', - 'services.modules.openfire', - 'services.modules.seat', - 'services.modules.smf', - 'services.modules.phpbb3', - 'services.modules.xenforo', - 'services.modules.teamspeak3', + 'allianceauth.services.modules.mumble', + 'allianceauth.services.modules.discord', + 'allianceauth.services.modules.discourse', + 'allianceauth.services.modules.ipboard', + 'allianceauth.services.modules.ips4', + 'allianceauth.services.modules.market', + 'allianceauth.services.modules.openfire', + 'allianceauth.services.modules.seat', + 'allianceauth.services.modules.smf', + 'allianceauth.services.modules.phpbb3', + 'allianceauth.services.modules.xenforo', + 'allianceauth.services.modules.teamspeak3', ] ##################################################### @@ -84,11 +84,11 @@ CELERYBEAT_SCHEDULE = { 'schedule': crontab(day_of_month='*/1'), }, 'run_model_update': { - 'task': 'eveonline.tasks.run_model_update', + 'task': 'allianceauth.eveonline.tasks.run_model_update', 'schedule': crontab(minute=0, hour="*/6"), }, 'check_all_character_ownership': { - 'task': 'authentication.tasks.check_all_character_ownership', + 'task': 'allianceauth.authentication.tasks.check_all_character_ownership', 'schedule': crontab(hour='*/4'), } } @@ -137,9 +137,9 @@ TEMPLATES = [ 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', - 'services.context_processors.auth_settings', - 'notifications.context_processors.user_notification_count', - 'groupmanagement.context_processors.can_manage_groups', + 'allianceauth.services.context_processors.auth_settings', + 'allianceauth.notifications.context_processors.user_notification_count', + 'allianceauth.groupmanagement.context_processors.can_manage_groups', ], }, }, @@ -166,7 +166,7 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] -AUTHENTICATION_BACKENDS = ['authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend'] +AUTHENTICATION_BACKENDS = ['allianceauth.authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend'] LOGIN_URL = 'auth_login_user' # Internationalization @@ -188,10 +188,6 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static") -STATICFILES_DIRS = ( - os.path.join(BASE_DIR, "customization/static"), - os.path.join(BASE_DIR, "stock/static"), -) # Bootstrap messaging css workaround MESSAGE_TAGS = { @@ -522,12 +518,12 @@ LOGGING = { }, 'notifications': { # creates notifications for users with logging_notifications permission 'level': 'ERROR', # edit this line to change logging level to notifications - 'class': 'notifications.handlers.NotificationHandler', + 'class': 'allianceauth.notifications.handlers.NotificationHandler', 'formatter': 'verbose', }, }, 'loggers': { - 'authentication': { + 'allianceauth': { 'handlers': ['log_file', 'console', 'notifications'], 'level': 'DEBUG', }, @@ -535,18 +531,6 @@ LOGGING = { 'handlers': ['log_file', 'console', 'notifications'], 'level': 'DEBUG', }, - 'eveonline': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'groupmanagement': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'hrapplications': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, 'portal': { 'handlers': ['log_file', 'console', 'notifications'], 'level': 'DEBUG', @@ -555,38 +539,6 @@ LOGGING = { 'handlers': ['log_file', 'console', 'notifications'], 'level': 'DEBUG', }, - 'services': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'srp': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'timerboard': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'sigtracker': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'optimer': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'corputils': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, - 'fleetactivitytracking': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'ERROR', - }, - 'fleetup': { - 'handlers': ['log_file', 'console', 'notifications'], - 'level': 'DEBUG', - }, 'util': { 'handlers': ['log_file', 'console', 'notifications'], 'level': 'DEBUG', diff --git a/alliance_auth/urls.py b/alliance_auth/urls.py deleted file mode 100755 index 80954881..00000000 --- a/alliance_auth/urls.py +++ /dev/null @@ -1,91 +0,0 @@ -from django.conf.urls import include, url - -from django.conf.urls.i18n import i18n_patterns -from django.utils.translation import ugettext_lazy as _ -from django.contrib import admin -import authentication.urls -from authentication import hmac_urls -import authentication.views -import services.views -import groupmanagement.views -import notifications.views -import esi.urls -from alliance_auth import NAME -from alliance_auth.hooks import get_hooks -from django.views.generic.base import TemplateView - -admin.site.site_header = NAME - - -# Functional/Untranslated URL's -urlpatterns = [ - # Locale - url(r'^i18n/', include('django.conf.urls.i18n')), - - # Authentication - url(r'', include(authentication.urls, namespace='authentication')), - url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), - url(r'account/', include(hmac_urls)), - - # Admin urls - url(r'^admin/', include(admin.site.urls)), - - # SSO - url(r'^sso/', include(esi.urls, namespace='esi')), - url(r'^sso/login$', authentication.views.sso_login, name='auth_sso_login'), - - # Notifications - url(r'^remove_notifications/(\w+)/$', notifications.views.remove_notification, name='auth_remove_notification'), - url(r'^notifications/mark_all_read/$', notifications.views.mark_all_read, name='auth_mark_all_notifications_read'), - url(r'^notifications/delete_all_read/$', notifications.views.delete_all_read, - name='auth_delete_all_read_notifications'), -] - -# User viewed/translated URLS -urlpatterns += i18n_patterns( - # Group management - url(_(r'^groups/'), groupmanagement.views.groups_view, name='auth_groups'), - url(_(r'^group/management/'), groupmanagement.views.group_management, - name='auth_group_management'), - url(_(r'^group/membership/$'), groupmanagement.views.group_membership, - name='auth_group_membership'), - url(_(r'^group/membership/(\w+)/$'), groupmanagement.views.group_membership_list, - name='auth_group_membership_list'), - url(_(r'^group/membership/(\w+)/remove/(\w+)/$'), groupmanagement.views.group_membership_remove, - name='auth_group_membership_remove'), - url(_(r'^group/request_add/(\w+)'), groupmanagement.views.group_request_add, - name='auth_group_request_add'), - url(_(r'^group/request/accept/(\w+)'), groupmanagement.views.group_accept_request, - name='auth_group_accept_request'), - url(_(r'^group/request/reject/(\w+)'), groupmanagement.views.group_reject_request, - name='auth_group_reject_request'), - - url(_(r'^group/request_leave/(\w+)'), groupmanagement.views.group_request_leave, - name='auth_group_request_leave'), - url(_(r'group/leave_request/accept/(\w+)'), groupmanagement.views.group_leave_accept_request, - name='auth_group_leave_accept_request'), - url(_(r'^group/leave_request/reject/(\w+)'), groupmanagement.views.group_leave_reject_request, - name='auth_group_leave_reject_request'), - - url(_(r'^services/$'), services.views.services_view, name='auth_services'), - - # Tools - url(_(r'^tool/fleet_formatter_tool/$'), services.views.fleet_formatter_view, - name='auth_fleet_format_tool_view'), - - # Notifications - url(_(r'^notifications/$'), notifications.views.notification_list, name='auth_notification_list'), - url(_(r'^notifications/(\w+)/$'), notifications.views.notification_view, name='auth_notification_view'), - - -) - -# Append hooked service urls -services = get_hooks('services_hook') -for svc in services: - urlpatterns += svc().urlpatterns - -# Append app urls -app_urls = get_hooks('url_hook') -for app in app_urls: - urlpatterns += [app().include_pattern] diff --git a/allianceauth/__init__.py b/allianceauth/__init__.py new file mode 100644 index 00000000..e6be04d2 --- /dev/null +++ b/allianceauth/__init__.py @@ -0,0 +1,7 @@ +# This will make sure the app is always imported when +# Django starts so that shared_task will use this app. + +__version__ = '2.0-dev' +NAME = 'Alliance Auth v%s' % __version__ +default_app_config = 'allianceauth.apps.AllianceAuthConfig' + diff --git a/allianceauth/apps.py b/allianceauth/apps.py new file mode 100644 index 00000000..2e6bd289 --- /dev/null +++ b/allianceauth/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AllianceAuthConfig(AppConfig): + name = 'allianceauth' diff --git a/allianceauth/authentication/__init__.py b/allianceauth/authentication/__init__.py new file mode 100644 index 00000000..564bb2c6 --- /dev/null +++ b/allianceauth/authentication/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.authentication.apps.AuthenticationConfig' diff --git a/authentication/admin.py b/allianceauth/authentication/admin.py similarity index 96% rename from authentication/admin.py rename to allianceauth/authentication/admin.py index c88f108b..ab47f598 100644 --- a/authentication/admin.py +++ b/allianceauth/authentication/admin.py @@ -1,12 +1,11 @@ -from __future__ import unicode_literals - from django.contrib import admin from django.contrib.auth.admin import UserAdmin as BaseUserAdmin from django.contrib.auth.models import User, Permission from django.utils.text import slugify -from authentication.models import State, get_guest_state, CharacterOwnership, UserProfile -from alliance_auth.hooks import get_hooks -from services.hooks import ServicesHook +from allianceauth.services.hooks import ServicesHook + +from allianceauth.authentication.models import State, get_guest_state, CharacterOwnership, UserProfile +from allianceauth.hooks import get_hooks def make_service_hooks_update_groups_action(service): diff --git a/authentication/apps.py b/allianceauth/authentication/apps.py similarity index 63% rename from authentication/apps.py rename to allianceauth/authentication/apps.py index bd4c5ccf..90011bcf 100644 --- a/authentication/apps.py +++ b/allianceauth/authentication/apps.py @@ -1,14 +1,12 @@ -from __future__ import unicode_literals - from django.apps import AppConfig from django.core.checks import register, Tags class AuthenticationConfig(AppConfig): - name = 'authentication' + name = 'allianceauth.authentication' + label = 'authentication' def ready(self): super(AuthenticationConfig, self).ready() - import authentication.signals - from authentication import checks + from allianceauth.authentication import checks register(Tags.security)(checks.check_login_scopes_setting) diff --git a/authentication/backends.py b/allianceauth/authentication/backends.py similarity index 97% rename from authentication/backends.py rename to allianceauth/authentication/backends.py index 014d5512..949b8682 100644 --- a/authentication/backends.py +++ b/allianceauth/authentication/backends.py @@ -1,8 +1,9 @@ from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import Permission -from authentication.models import UserProfile, CharacterOwnership from django.contrib.auth.models import User +from .models import UserProfile, CharacterOwnership + class StateBackend(ModelBackend): @staticmethod diff --git a/authentication/checks.py b/allianceauth/authentication/checks.py similarity index 91% rename from authentication/checks.py rename to allianceauth/authentication/checks.py index 7ebb2d92..1a687b62 100644 --- a/authentication/checks.py +++ b/allianceauth/authentication/checks.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.core.checks import Error from django.conf import settings diff --git a/authentication/forms.py b/allianceauth/authentication/forms.py similarity index 83% rename from authentication/forms.py rename to allianceauth/authentication/forms.py index 124e6fd8..08fb240c 100644 --- a/authentication/forms.py +++ b/allianceauth/authentication/forms.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/authentication/hmac_urls.py b/allianceauth/authentication/hmac_urls.py similarity index 93% rename from authentication/hmac_urls.py rename to allianceauth/authentication/hmac_urls.py index 0f032390..3cf98bf4 100644 --- a/authentication/hmac_urls.py +++ b/allianceauth/authentication/hmac_urls.py @@ -1,5 +1,6 @@ from django.conf.urls import url, include -from authentication import views + +from allianceauth.authentication import views urlpatterns = [ url(r'^activate/complete/$', views.activation_complete, name='registration_activation_complete'), diff --git a/authentication/managers.py b/allianceauth/authentication/managers.py similarity index 90% rename from authentication/managers.py rename to allianceauth/authentication/managers.py index abac8f70..d1c6d441 100755 --- a/authentication/managers.py +++ b/allianceauth/authentication/managers.py @@ -1,10 +1,11 @@ -from __future__ import unicode_literals -from django.db.models import Manager, QuerySet, Q -from django.db import transaction -from eveonline.managers import EveManager -from eveonline.models import EveCharacter import logging +from django.db import transaction +from django.db.models import Manager, QuerySet, Q +from allianceauth.eveonline.managers import EveManager + +from allianceauth.eveonline.models import EveCharacter + logger = logging.getLogger(__name__) @@ -42,7 +43,7 @@ class StateQuerySet(QuerySet): if states.exists(): return states[0] else: - from authentication.models import get_guest_state + from allianceauth.authentication.models import get_guest_state return get_guest_state() def delete(self): @@ -68,7 +69,7 @@ class StateManager(Manager): if states.exists(): return states[0] else: - from authentication.models import get_guest_state + from allianceauth.authentication.models import get_guest_state return get_guest_state() def get_for_user(self, user): diff --git a/authentication/migrations/0001_initial.py b/allianceauth/authentication/migrations/0001_initial.py similarity index 100% rename from authentication/migrations/0001_initial.py rename to allianceauth/authentication/migrations/0001_initial.py diff --git a/authentication/migrations/0002_auto_20160907_1914.py b/allianceauth/authentication/migrations/0002_auto_20160907_1914.py similarity index 100% rename from authentication/migrations/0002_auto_20160907_1914.py rename to allianceauth/authentication/migrations/0002_auto_20160907_1914.py diff --git a/authentication/migrations/0003_authservicesinfo_state.py b/allianceauth/authentication/migrations/0003_authservicesinfo_state.py similarity index 100% rename from authentication/migrations/0003_authservicesinfo_state.py rename to allianceauth/authentication/migrations/0003_authservicesinfo_state.py diff --git a/authentication/migrations/0004_create_permissions.py b/allianceauth/authentication/migrations/0004_create_permissions.py similarity index 100% rename from authentication/migrations/0004_create_permissions.py rename to allianceauth/authentication/migrations/0004_create_permissions.py diff --git a/authentication/migrations/0005_delete_perms.py b/allianceauth/authentication/migrations/0005_delete_perms.py similarity index 100% rename from authentication/migrations/0005_delete_perms.py rename to allianceauth/authentication/migrations/0005_delete_perms.py diff --git a/authentication/migrations/0006_auto_20160910_0542.py b/allianceauth/authentication/migrations/0006_auto_20160910_0542.py similarity index 100% rename from authentication/migrations/0006_auto_20160910_0542.py rename to allianceauth/authentication/migrations/0006_auto_20160910_0542.py diff --git a/authentication/migrations/0007_remove_authservicesinfo_is_blue.py b/allianceauth/authentication/migrations/0007_remove_authservicesinfo_is_blue.py similarity index 100% rename from authentication/migrations/0007_remove_authservicesinfo_is_blue.py rename to allianceauth/authentication/migrations/0007_remove_authservicesinfo_is_blue.py diff --git a/authentication/migrations/0008_set_state.py b/allianceauth/authentication/migrations/0008_set_state.py similarity index 100% rename from authentication/migrations/0008_set_state.py rename to allianceauth/authentication/migrations/0008_set_state.py diff --git a/authentication/migrations/0009_auto_20161021_0228.py b/allianceauth/authentication/migrations/0009_auto_20161021_0228.py similarity index 100% rename from authentication/migrations/0009_auto_20161021_0228.py rename to allianceauth/authentication/migrations/0009_auto_20161021_0228.py diff --git a/authentication/migrations/0010_only_one_authservicesinfo.py b/allianceauth/authentication/migrations/0010_only_one_authservicesinfo.py similarity index 100% rename from authentication/migrations/0010_only_one_authservicesinfo.py rename to allianceauth/authentication/migrations/0010_only_one_authservicesinfo.py diff --git a/authentication/migrations/0011_authservicesinfo_user_onetoonefield.py b/allianceauth/authentication/migrations/0011_authservicesinfo_user_onetoonefield.py similarity index 100% rename from authentication/migrations/0011_authservicesinfo_user_onetoonefield.py rename to allianceauth/authentication/migrations/0011_authservicesinfo_user_onetoonefield.py diff --git a/authentication/migrations/0012_remove_add_delete_authservicesinfo_permissions.py b/allianceauth/authentication/migrations/0012_remove_add_delete_authservicesinfo_permissions.py similarity index 100% rename from authentication/migrations/0012_remove_add_delete_authservicesinfo_permissions.py rename to allianceauth/authentication/migrations/0012_remove_add_delete_authservicesinfo_permissions.py diff --git a/authentication/migrations/0013_service_modules.py b/allianceauth/authentication/migrations/0013_service_modules.py similarity index 100% rename from authentication/migrations/0013_service_modules.py rename to allianceauth/authentication/migrations/0013_service_modules.py diff --git a/authentication/migrations/0014_fleetup_permission.py b/allianceauth/authentication/migrations/0014_fleetup_permission.py similarity index 100% rename from authentication/migrations/0014_fleetup_permission.py rename to allianceauth/authentication/migrations/0014_fleetup_permission.py diff --git a/authentication/migrations/0015_user_profiles.py b/allianceauth/authentication/migrations/0015_user_profiles.py similarity index 98% rename from authentication/migrations/0015_user_profiles.py rename to allianceauth/authentication/migrations/0015_user_profiles.py index c46051fb..d1f472c1 100644 --- a/authentication/migrations/0015_user_profiles.py +++ b/allianceauth/authentication/migrations/0015_user_profiles.py @@ -2,11 +2,11 @@ # Generated by Django 1.10.5 on 2017-03-22 23:09 from __future__ import unicode_literals -import authentication.models -from django.conf import settings -from django.db import migrations, models +import allianceauth.authentication.models import django.db.models.deletion +from django.conf import settings from django.contrib.auth.hashers import make_password +from django.db import migrations, models def create_guest_state(apps, schema_editor): @@ -212,7 +212,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('main_character', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='eveonline.EveCharacter')), - ('state', models.ForeignKey(default=authentication.models.get_guest_state_pk, on_delete=django.db.models.deletion.SET_DEFAULT, to='authentication.State')), + ('state', models.ForeignKey(default=allianceauth.authentication.models.get_guest_state_pk, on_delete=django.db.models.deletion.SET_DEFAULT, to='authentication.State')), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='profile', to=settings.AUTH_USER_MODEL)), ], options={ diff --git a/alliance_auth/tests/__init__.py b/allianceauth/authentication/migrations/__init__.py similarity index 100% rename from alliance_auth/tests/__init__.py rename to allianceauth/authentication/migrations/__init__.py diff --git a/authentication/models.py b/allianceauth/authentication/models.py similarity index 89% rename from authentication/models.py rename to allianceauth/authentication/models.py index 4e8bcd11..84b5dc58 100755 --- a/authentication/models.py +++ b/allianceauth/authentication/models.py @@ -1,17 +1,16 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models, transaction -from django.contrib.auth.models import User, Permission -from authentication.managers import CharacterOwnershipManager, StateManager -from eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo -from notifications import notify -from django.utils.translation import ugettext_lazy as _ import logging +from django.contrib.auth.models import User, Permission +from django.db import models, transaction +from django.utils.translation import ugettext_lazy as _ +from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo +from allianceauth.notifications import notify + +from .managers import CharacterOwnershipManager, StateManager + logger = logging.getLogger(__name__) -@python_2_unicode_compatible class State(models.Model): name = models.CharField(max_length=20, unique=True) permissions = models.ManyToManyField(Permission, blank=True) @@ -58,7 +57,6 @@ def get_guest_state_pk(): return get_guest_state().pk -@python_2_unicode_compatible class UserProfile(models.Model): class Meta: default_permissions = ('change',) @@ -78,14 +76,13 @@ class UserProfile(models.Model): notify(self.user, _('State Changed'), _('Your user state has been changed to %(state)s') % ({'state': state}), 'info') - from authentication.signals import state_changed + from allianceauth.authentication.signals import state_changed state_changed.send(sender=self.__class__, user=self.user, state=self.state) def __str__(self): return str(self.user) -@python_2_unicode_compatible class CharacterOwnership(models.Model): class Meta: default_permissions = ('change', 'delete') diff --git a/authentication/signals.py b/allianceauth/authentication/signals.py similarity index 96% rename from authentication/signals.py rename to allianceauth/authentication/signals.py index 6339b0b2..34157c01 100644 --- a/authentication/signals.py +++ b/allianceauth/authentication/signals.py @@ -1,14 +1,15 @@ -from __future__ import unicode_literals -from django.db.models.signals import post_save, pre_delete, m2m_changed, pre_save -from django.db.models import Q -from django.dispatch import receiver, Signal -from django.contrib.auth.models import User -from authentication.models import CharacterOwnership, UserProfile, get_guest_state, State -from esi.models import Token -from eveonline.managers import EveManager -from eveonline.models import EveCharacter import logging +from .models import CharacterOwnership, UserProfile, get_guest_state, State +from django.contrib.auth.models import User +from django.db.models import Q +from django.db.models.signals import post_save, pre_delete, m2m_changed, pre_save +from django.dispatch import receiver, Signal +from esi.models import Token +from allianceauth.eveonline.managers import EveManager + +from allianceauth.eveonline.models import EveCharacter + logger = logging.getLogger(__name__) diff --git a/authentication/static/authentication/img/background.jpg b/allianceauth/authentication/static/authentication/img/background.jpg similarity index 100% rename from authentication/static/authentication/img/background.jpg rename to allianceauth/authentication/static/authentication/img/background.jpg diff --git a/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_Black.png b/allianceauth/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_Black.png similarity index 100% rename from authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_Black.png rename to allianceauth/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_Black.png diff --git a/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_White.png b/allianceauth/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_White.png similarity index 100% rename from authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_White.png rename to allianceauth/authentication/static/img/sso/EVE_SSO_Login_Buttons_Large_White.png diff --git a/authentication/tasks.py b/allianceauth/authentication/tasks.py similarity index 91% rename from authentication/tasks.py rename to allianceauth/authentication/tasks.py index dc4f07f4..d495e4c9 100644 --- a/authentication/tasks.py +++ b/allianceauth/authentication/tasks.py @@ -1,10 +1,11 @@ -from alliance_auth.celeryapp import app -from esi.models import Token -from esi.errors import TokenExpiredError, TokenInvalidError -from authentication.models import CharacterOwnership - import logging +from esi.errors import TokenExpiredError, TokenInvalidError +from esi.models import Token + +from allianceauth.authentication.models import CharacterOwnership +from allianceauth.celeryapp import app + logger = logging.getLogger(__name__) diff --git a/authentication/templates/authentication/dashboard.html b/allianceauth/authentication/templates/authentication/dashboard.html similarity index 100% rename from authentication/templates/authentication/dashboard.html rename to allianceauth/authentication/templates/authentication/dashboard.html diff --git a/authentication/templates/public/base.html b/allianceauth/authentication/templates/public/base.html similarity index 100% rename from authentication/templates/public/base.html rename to allianceauth/authentication/templates/public/base.html diff --git a/authentication/templates/public/lang_select.html b/allianceauth/authentication/templates/public/lang_select.html similarity index 100% rename from authentication/templates/public/lang_select.html rename to allianceauth/authentication/templates/public/lang_select.html diff --git a/authentication/templates/public/login.html b/allianceauth/authentication/templates/public/login.html similarity index 100% rename from authentication/templates/public/login.html rename to allianceauth/authentication/templates/public/login.html diff --git a/authentication/templates/public/middle_box.html b/allianceauth/authentication/templates/public/middle_box.html similarity index 100% rename from authentication/templates/public/middle_box.html rename to allianceauth/authentication/templates/public/middle_box.html diff --git a/authentication/templates/public/register.html b/allianceauth/authentication/templates/public/register.html similarity index 100% rename from authentication/templates/public/register.html rename to allianceauth/authentication/templates/public/register.html diff --git a/authentication/templates/registered/base.html b/allianceauth/authentication/templates/registered/base.html similarity index 100% rename from authentication/templates/registered/base.html rename to allianceauth/authentication/templates/registered/base.html diff --git a/authentication/templates/registration/activate.html b/allianceauth/authentication/templates/registration/activate.html similarity index 100% rename from authentication/templates/registration/activate.html rename to allianceauth/authentication/templates/registration/activate.html diff --git a/authentication/templates/registration/activation_email.txt b/allianceauth/authentication/templates/registration/activation_email.txt similarity index 100% rename from authentication/templates/registration/activation_email.txt rename to allianceauth/authentication/templates/registration/activation_email.txt diff --git a/authentication/templates/registration/activation_email_subject.txt b/allianceauth/authentication/templates/registration/activation_email_subject.txt similarity index 100% rename from authentication/templates/registration/activation_email_subject.txt rename to allianceauth/authentication/templates/registration/activation_email_subject.txt diff --git a/authentication/templates/registration/password_reset_email.html b/allianceauth/authentication/templates/registration/password_reset_email.html similarity index 100% rename from authentication/templates/registration/password_reset_email.html rename to allianceauth/authentication/templates/registration/password_reset_email.html diff --git a/authentication/templates/registration/registration_form.html b/allianceauth/authentication/templates/registration/registration_form.html similarity index 100% rename from authentication/templates/registration/registration_form.html rename to allianceauth/authentication/templates/registration/registration_form.html diff --git a/authentication/tests.py b/allianceauth/authentication/tests.py similarity index 96% rename from authentication/tests.py rename to allianceauth/authentication/tests.py index 5b0727d0..73e6f060 100644 --- a/authentication/tests.py +++ b/allianceauth/authentication/tests.py @@ -1,19 +1,12 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase from django.contrib.auth.models import User -from alliance_auth.tests.auth_utils import AuthUtils -from authentication.models import CharacterOwnership, UserProfile, State, get_guest_state -from authentication.backends import StateBackend -from authentication.tasks import check_character_ownership -from eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo +from allianceauth.tests.auth_utils import AuthUtils +from .models import CharacterOwnership, UserProfile, State, get_guest_state +from .backends import StateBackend +from .tasks import check_character_ownership +from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo, EveAllianceInfo from esi.models import Token diff --git a/authentication/urls.py b/allianceauth/authentication/urls.py similarity index 96% rename from authentication/urls.py rename to allianceauth/authentication/urls.py index da677946..cd35db3e 100644 --- a/authentication/urls.py +++ b/allianceauth/authentication/urls.py @@ -1,7 +1,8 @@ from django.conf.urls import url from django.contrib.auth.decorators import login_required from django.views.generic.base import TemplateView -from authentication import views + +from . import views app_name = 'authentication' diff --git a/authentication/views.py b/allianceauth/authentication/views.py similarity index 97% rename from authentication/views.py rename to allianceauth/authentication/views.py index 5c385755..7d8c33d5 100644 --- a/authentication/views.py +++ b/allianceauth/authentication/views.py @@ -1,20 +1,21 @@ -from __future__ import unicode_literals -from django.contrib.auth import login, authenticate -from django.shortcuts import redirect -from django.contrib.auth.decorators import login_required -from django.utils.translation import ugettext_lazy as _ -from authentication.forms import RegistrationForm -from authentication.models import CharacterOwnership -from django.contrib import messages -from django.contrib.auth.models import User +import logging + from django.conf import settings +from django.contrib import messages +from django.contrib.auth import login, authenticate +from django.contrib.auth.decorators import login_required +from django.contrib.auth.models import User from django.core import signing from django.core.urlresolvers import reverse +from django.shortcuts import redirect +from django.utils.translation import ugettext_lazy as _ from esi.decorators import token_required from registration.backends.hmac.views import RegistrationView as BaseRegistrationView, \ ActivationView as BaseActivationView, REGISTRATION_SALT from registration.signals import user_registered -import logging + +from .models import CharacterOwnership +from .forms import RegistrationForm logger = logging.getLogger(__name__) diff --git a/alliance_auth/celeryapp.py b/allianceauth/celeryapp.py similarity index 90% rename from alliance_auth/celeryapp.py rename to allianceauth/celeryapp.py index 26a34e0d..49c2c809 100644 --- a/alliance_auth/celeryapp.py +++ b/allianceauth/celeryapp.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, unicode_literals import os from celery import Celery diff --git a/allianceauth/corputils/__init__.py b/allianceauth/corputils/__init__.py new file mode 100644 index 00000000..2cbcd550 --- /dev/null +++ b/allianceauth/corputils/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.corputils.apps.CorpUtilsConfig' diff --git a/corputils/admin.py b/allianceauth/corputils/admin.py similarity index 51% rename from corputils/admin.py rename to allianceauth/corputils/admin.py index 934d066b..10a112ee 100644 --- a/corputils/admin.py +++ b/allianceauth/corputils/admin.py @@ -1,6 +1,6 @@ -from __future__ import unicode_literals -from corputils.models import CorpStats, CorpMember from django.contrib import admin +from .models import CorpStats, CorpMember + admin.site.register(CorpStats) admin.site.register(CorpMember) \ No newline at end of file diff --git a/corputils/apps.py b/allianceauth/corputils/apps.py similarity index 52% rename from corputils/apps.py rename to allianceauth/corputils/apps.py index 677d5fcb..5a9f1d4b 100644 --- a/corputils/apps.py +++ b/allianceauth/corputils/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class CorpUtilsConfig(AppConfig): - name = 'corputils' + name = 'allianceauth.corputils' + label = 'corputils' diff --git a/corputils/auth_hooks.py b/allianceauth/corputils/auth_hooks.py similarity index 86% rename from corputils/auth_hooks.py rename to allianceauth/corputils/auth_hooks.py index 14367ebe..08c74c22 100644 --- a/corputils/auth_hooks.py +++ b/allianceauth/corputils/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from corputils import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from allianceauth.corputils import urls class CorpStats(MenuItemHook): diff --git a/corputils/managers.py b/allianceauth/corputils/managers.py similarity index 100% rename from corputils/managers.py rename to allianceauth/corputils/managers.py diff --git a/corputils/migrations/0001_initial.py b/allianceauth/corputils/migrations/0001_initial.py similarity index 100% rename from corputils/migrations/0001_initial.py rename to allianceauth/corputils/migrations/0001_initial.py diff --git a/corputils/migrations/0002_migrate_permissions.py b/allianceauth/corputils/migrations/0002_migrate_permissions.py similarity index 100% rename from corputils/migrations/0002_migrate_permissions.py rename to allianceauth/corputils/migrations/0002_migrate_permissions.py diff --git a/corputils/migrations/0003_granular_permissions.py b/allianceauth/corputils/migrations/0003_granular_permissions.py similarity index 100% rename from corputils/migrations/0003_granular_permissions.py rename to allianceauth/corputils/migrations/0003_granular_permissions.py diff --git a/corputils/migrations/0004_member_models.py b/allianceauth/corputils/migrations/0004_member_models.py similarity index 100% rename from corputils/migrations/0004_member_models.py rename to allianceauth/corputils/migrations/0004_member_models.py diff --git a/corputils/migrations/0005_cleanup_permissions.py b/allianceauth/corputils/migrations/0005_cleanup_permissions.py similarity index 100% rename from corputils/migrations/0005_cleanup_permissions.py rename to allianceauth/corputils/migrations/0005_cleanup_permissions.py diff --git a/authentication/migrations/__init__.py b/allianceauth/corputils/migrations/__init__.py similarity index 100% rename from authentication/migrations/__init__.py rename to allianceauth/corputils/migrations/__init__.py diff --git a/corputils/models.py b/allianceauth/corputils/models.py similarity index 95% rename from corputils/models.py rename to allianceauth/corputils/models.py index a8b04f09..58643a67 100644 --- a/corputils/models.py +++ b/allianceauth/corputils/models.py @@ -1,23 +1,21 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models -from eveonline.models import EveCorporationInfo, EveCharacter -from esi.models import Token -from esi.errors import TokenError -from notifications import notify -from authentication.models import CharacterOwnership, UserProfile -from bravado.exception import HTTPForbidden -from corputils.managers import CorpStatsManager import logging import os +from allianceauth.authentication.models import CharacterOwnership, UserProfile +from bravado.exception import HTTPForbidden +from django.db import models +from esi.errors import TokenError +from esi.models import Token +from allianceauth.eveonline.models import EveCorporationInfo, EveCharacter +from allianceauth.notifications import notify + +from allianceauth.corputils.managers import CorpStatsManager SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json') logger = logging.getLogger(__name__) -@python_2_unicode_compatible class CorpStats(models.Model): token = models.ForeignKey(Token, on_delete=models.CASCADE) corp = models.OneToOneField(EveCorporationInfo) diff --git a/corputils/swagger.json b/allianceauth/corputils/swagger.json similarity index 100% rename from corputils/swagger.json rename to allianceauth/corputils/swagger.json diff --git a/corputils/tasks.py b/allianceauth/corputils/tasks.py similarity index 71% rename from corputils/tasks.py rename to allianceauth/corputils/tasks.py index 8aa63ef1..584f930e 100644 --- a/corputils/tasks.py +++ b/allianceauth/corputils/tasks.py @@ -1,5 +1,5 @@ -from corputils.models import CorpStats -from alliance_auth.celeryapp import app +from allianceauth.celeryapp import app +from allianceauth.corputils import CorpStats @app.task diff --git a/corputils/templates/corputils/base.html b/allianceauth/corputils/templates/corputils/base.html similarity index 100% rename from corputils/templates/corputils/base.html rename to allianceauth/corputils/templates/corputils/base.html diff --git a/corputils/templates/corputils/corpstats.html b/allianceauth/corputils/templates/corputils/corpstats.html similarity index 100% rename from corputils/templates/corputils/corpstats.html rename to allianceauth/corputils/templates/corputils/corpstats.html diff --git a/corputils/templates/corputils/search.html b/allianceauth/corputils/templates/corputils/search.html similarity index 100% rename from corputils/templates/corputils/search.html rename to allianceauth/corputils/templates/corputils/search.html diff --git a/corputils/tests.py b/allianceauth/corputils/tests.py similarity index 96% rename from corputils/tests.py rename to allianceauth/corputils/tests.py index fa8270ac..2c1bdfa4 100644 --- a/corputils/tests.py +++ b/allianceauth/corputils/tests.py @@ -1,21 +1,14 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase -from alliance_auth.tests.auth_utils import AuthUtils -from corputils.models import CorpStats, CorpMember -from eveonline.models import EveCorporationInfo, EveAllianceInfo, EveCharacter +from allianceauth.tests.auth_utils import AuthUtils +from .models import CorpStats, CorpMember +from allianceauth.eveonline.models import EveCorporationInfo, EveAllianceInfo, EveCharacter from esi.models import Token from esi.errors import TokenError from bravado.exception import HTTPForbidden from django.contrib.auth.models import Permission -from authentication.models import CharacterOwnership +from allianceauth.authentication.models import CharacterOwnership class CorpStatsManagerTestCase(TestCase): @@ -106,7 +99,7 @@ class CorpStatsUpdateTestCase(TestCase): self.corpstats.update() self.assertFalse(CorpMember.objects.filter(character_id='2', corpstats=self.corpstats).exists()) - @mock.patch('corputils.models.notify') + @mock.patch('allianceauth.corputils.models.notify') @mock.patch('esi.clients.SwaggerClient') def test_update_deleted_token(self, SwaggerClient, notify): SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2} @@ -115,7 +108,7 @@ class CorpStatsUpdateTestCase(TestCase): self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists()) self.assertTrue(notify.called) - @mock.patch('corputils.models.notify') + @mock.patch('allianceauth.corputils.models.notify') @mock.patch('esi.clients.SwaggerClient') def test_update_http_forbidden(self, SwaggerClient, notify): SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 2} @@ -124,7 +117,7 @@ class CorpStatsUpdateTestCase(TestCase): self.assertFalse(CorpStats.objects.filter(corp=self.corp).exists()) self.assertTrue(notify.called) - @mock.patch('corputils.models.notify') + @mock.patch('allianceauth.corputils.models.notify') @mock.patch('esi.clients.SwaggerClient') def test_update_token_character_corp_changed(self, SwaggerClient, notify): SwaggerClient.from_spec.return_value.Character.get_characters_character_id.return_value.result.return_value = {'corporation_id': 3} diff --git a/allianceauth/corputils/urls.py b/allianceauth/corputils/urls.py new file mode 100644 index 00000000..fe52474c --- /dev/null +++ b/allianceauth/corputils/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import url + +from . import views + +app_name = 'corputils' +urlpatterns = [ + url(r'^$', views.corpstats_view, name='view'), + url(r'^add/$', views.corpstats_add, name='add'), + url(r'^(?P(\d)*)/$', views.corpstats_view, name='view_corp'), + url(r'^(?P(\d)+)/update/$', views.corpstats_update, name='update'), + url(r'^search/$', views.corpstats_search, name='search'), + ] diff --git a/corputils/views.py b/allianceauth/corputils/views.py similarity index 96% rename from corputils/views.py rename to allianceauth/corputils/views.py index a72a48cd..e79c65a0 100644 --- a/corputils/views.py +++ b/allianceauth/corputils/views.py @@ -1,16 +1,17 @@ -from __future__ import unicode_literals -from django.contrib.auth.decorators import login_required, permission_required, user_passes_test -from django.shortcuts import render, redirect, get_object_or_404 +import os + +from bravado.exception import HTTPError from django.contrib import messages +from django.contrib.auth.decorators import login_required, permission_required, user_passes_test from django.core.exceptions import PermissionDenied from django.db import IntegrityError +from django.shortcuts import render, redirect, get_object_or_404 from django.utils.translation import ugettext_lazy as _ -from eveonline.models import EveCharacter, EveCorporationInfo -from eveonline.managers import EveManager -from corputils.models import CorpStats from esi.decorators import token_required -from bravado.exception import HTTPError -import os +from allianceauth.eveonline.managers import EveManager +from allianceauth.eveonline.models import EveCharacter, EveCorporationInfo + +from .models import CorpStats SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json') diff --git a/allianceauth/eveonline/__init__.py b/allianceauth/eveonline/__init__.py new file mode 100644 index 00000000..784980a6 --- /dev/null +++ b/allianceauth/eveonline/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.eveonline.apps.EveonlineConfig' diff --git a/eveonline/admin.py b/allianceauth/eveonline/admin.py similarity index 92% rename from eveonline/admin.py rename to allianceauth/eveonline/admin.py index ff25e698..78e3ada0 100644 --- a/eveonline/admin.py +++ b/allianceauth/eveonline/admin.py @@ -1,12 +1,12 @@ -from __future__ import unicode_literals -from django.contrib import admin from django import forms +from django.contrib import admin from django.core.exceptions import ObjectDoesNotExist -from eveonline.models import EveCharacter -from eveonline.models import EveAllianceInfo -from eveonline.models import EveCorporationInfo -from eveonline.managers import EveManager -from eveonline.providers import ObjectNotFound +from .managers import EveManager +from .providers import ObjectNotFound + +from .models import EveAllianceInfo +from .models import EveCharacter +from .models import EveCorporationInfo class EveEntityForm(forms.ModelForm): diff --git a/eveonline/apps.py b/allianceauth/eveonline/apps.py similarity index 52% rename from eveonline/apps.py rename to allianceauth/eveonline/apps.py index 866e59e8..662753b5 100644 --- a/eveonline/apps.py +++ b/allianceauth/eveonline/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class EveonlineConfig(AppConfig): - name = 'eveonline' + name = 'allianceauth.eveonline' + label = 'eveonline' diff --git a/eveonline/managers.py b/allianceauth/eveonline/managers.py similarity index 96% rename from eveonline/managers.py rename to allianceauth/eveonline/managers.py index 052f8d46..619657d7 100644 --- a/eveonline/managers.py +++ b/allianceauth/eveonline/managers.py @@ -1,10 +1,11 @@ -from __future__ import unicode_literals -from eveonline.models import EveCharacter -from eveonline.models import EveAllianceInfo -from eveonline.models import EveCorporationInfo -from eveonline.providers import eve_adapter_factory import logging +from .providers import eve_adapter_factory + +from .models import EveAllianceInfo +from .models import EveCharacter +from .models import EveCorporationInfo + logger = logging.getLogger(__name__) diff --git a/eveonline/migrations/0001_initial.py b/allianceauth/eveonline/migrations/0001_initial.py similarity index 100% rename from eveonline/migrations/0001_initial.py rename to allianceauth/eveonline/migrations/0001_initial.py diff --git a/eveonline/migrations/0002_remove_eveapikeypair_error_count.py b/allianceauth/eveonline/migrations/0002_remove_eveapikeypair_error_count.py similarity index 100% rename from eveonline/migrations/0002_remove_eveapikeypair_error_count.py rename to allianceauth/eveonline/migrations/0002_remove_eveapikeypair_error_count.py diff --git a/eveonline/migrations/0003_auto_20161026_0149.py b/allianceauth/eveonline/migrations/0003_auto_20161026_0149.py similarity index 100% rename from eveonline/migrations/0003_auto_20161026_0149.py rename to allianceauth/eveonline/migrations/0003_auto_20161026_0149.py diff --git a/eveonline/migrations/0004_eveapikeypair_sso_verified.py b/allianceauth/eveonline/migrations/0004_eveapikeypair_sso_verified.py similarity index 100% rename from eveonline/migrations/0004_eveapikeypair_sso_verified.py rename to allianceauth/eveonline/migrations/0004_eveapikeypair_sso_verified.py diff --git a/eveonline/migrations/0005_remove_eveallianceinfo_member_count.py b/allianceauth/eveonline/migrations/0005_remove_eveallianceinfo_member_count.py similarity index 100% rename from eveonline/migrations/0005_remove_eveallianceinfo_member_count.py rename to allianceauth/eveonline/migrations/0005_remove_eveallianceinfo_member_count.py diff --git a/eveonline/migrations/0006_allow_null_evecharacter_alliance.py b/allianceauth/eveonline/migrations/0006_allow_null_evecharacter_alliance.py similarity index 100% rename from eveonline/migrations/0006_allow_null_evecharacter_alliance.py rename to allianceauth/eveonline/migrations/0006_allow_null_evecharacter_alliance.py diff --git a/eveonline/migrations/0007_unique_id_name.py b/allianceauth/eveonline/migrations/0007_unique_id_name.py similarity index 100% rename from eveonline/migrations/0007_unique_id_name.py rename to allianceauth/eveonline/migrations/0007_unique_id_name.py diff --git a/eveonline/migrations/0008_remove_apikeys.py b/allianceauth/eveonline/migrations/0008_remove_apikeys.py similarity index 100% rename from eveonline/migrations/0008_remove_apikeys.py rename to allianceauth/eveonline/migrations/0008_remove_apikeys.py diff --git a/corputils/migrations/__init__.py b/allianceauth/eveonline/migrations/__init__.py similarity index 100% rename from corputils/migrations/__init__.py rename to allianceauth/eveonline/migrations/__init__.py diff --git a/eveonline/models.py b/allianceauth/eveonline/models.py similarity index 87% rename from eveonline/models.py rename to allianceauth/eveonline/models.py index ea09aa28..90515c3d 100644 --- a/eveonline/models.py +++ b/allianceauth/eveonline/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class EveCharacter(models.Model): character_id = models.CharField(max_length=254, unique=True) character_name = models.CharField(max_length=254, unique=True) @@ -17,7 +14,6 @@ class EveCharacter(models.Model): return self.character_name -@python_2_unicode_compatible class EveAllianceInfo(models.Model): alliance_id = models.CharField(max_length=254, unique=True) alliance_name = models.CharField(max_length=254, unique=True) @@ -28,7 +24,6 @@ class EveAllianceInfo(models.Model): return self.alliance_name -@python_2_unicode_compatible class EveCorporationInfo(models.Model): corporation_id = models.CharField(max_length=254, unique=True) corporation_name = models.CharField(max_length=254, unique=True) diff --git a/eveonline/providers.py b/allianceauth/eveonline/providers.py similarity index 98% rename from eveonline/providers.py rename to allianceauth/eveonline/providers.py index a7ff69f3..41522975 100644 --- a/eveonline/providers.py +++ b/allianceauth/eveonline/providers.py @@ -1,4 +1,3 @@ -from django.utils.encoding import python_2_unicode_compatible from esi.clients import esi_client_factory from django.conf import settings from django.core.cache import cache @@ -16,7 +15,6 @@ logger = logging.getLogger(__name__) OBJ_CACHE_DURATION = int(getattr(settings, 'EVEONLINE_OBJ_CACHE_DURATION', 300)) -@python_2_unicode_compatible class ObjectNotFound(Exception): def __init__(self, obj_id, type_name): self.id = obj_id @@ -26,7 +24,6 @@ class ObjectNotFound(Exception): return '%s with ID %s not found.' % (self.type, self.id) -@python_2_unicode_compatible class Entity(object): def __init__(self, id, name): self.id = id @@ -228,7 +225,6 @@ class EveProvider(object): raise NotImplemented() -@python_2_unicode_compatible class EveSwaggerProvider(EveProvider): def __init__(self, token=None, adapter=None): self.client = esi_client_factory(token=token, spec_file=SWAGGER_SPEC_PATH) @@ -292,7 +288,6 @@ class EveSwaggerProvider(EveProvider): raise ObjectNotFound(type_id, 'type') -@python_2_unicode_compatible class EveXmlProvider(EveProvider): def __init__(self, api_key=None, adapter=None): """ diff --git a/eveonline/swagger.json b/allianceauth/eveonline/swagger.json similarity index 100% rename from eveonline/swagger.json rename to allianceauth/eveonline/swagger.json diff --git a/eveonline/tasks.py b/allianceauth/eveonline/tasks.py similarity index 76% rename from eveonline/tasks.py rename to allianceauth/eveonline/tasks.py index c2e1a4b1..348ebed7 100644 --- a/eveonline/tasks.py +++ b/allianceauth/eveonline/tasks.py @@ -1,11 +1,11 @@ -from __future__ import unicode_literals -from eveonline.managers import EveManager -from eveonline.models import EveCorporationInfo -from eveonline.models import EveAllianceInfo -from eveonline.models import EveCharacter import logging -from alliance_auth.celeryapp import app +from .managers import EveManager + +from allianceauth.celeryapp import app +from .models import EveAllianceInfo +from .models import EveCharacter +from .models import EveCorporationInfo logger = logging.getLogger(__name__) diff --git a/allianceauth/eveonline/views.py b/allianceauth/eveonline/views.py new file mode 100755 index 00000000..139597f9 --- /dev/null +++ b/allianceauth/eveonline/views.py @@ -0,0 +1,2 @@ + + diff --git a/allianceauth/fleetactivitytracking/__init__.py b/allianceauth/fleetactivitytracking/__init__.py new file mode 100644 index 00000000..965a60f5 --- /dev/null +++ b/allianceauth/fleetactivitytracking/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.fleetactivitytracking.apps.FatConfig' diff --git a/allianceauth/fleetactivitytracking/admin.py b/allianceauth/fleetactivitytracking/admin.py new file mode 100644 index 00000000..8fb2cf70 --- /dev/null +++ b/allianceauth/fleetactivitytracking/admin.py @@ -0,0 +1,7 @@ + +from django.contrib import admin + +from allianceauth.fleetactivitytracking.models import Fatlink, Fat + +admin.site.register(Fatlink) +admin.site.register(Fat) diff --git a/allianceauth/fleetactivitytracking/apps.py b/allianceauth/fleetactivitytracking/apps.py new file mode 100644 index 00000000..86c4fe11 --- /dev/null +++ b/allianceauth/fleetactivitytracking/apps.py @@ -0,0 +1,7 @@ + +from django.apps import AppConfig + + +class FatConfig(AppConfig): + name = 'allianceauth.fleetactivitytracking' + label = 'fleetactivitytracking' diff --git a/fleetactivitytracking/auth_hooks.py b/allianceauth/fleetactivitytracking/auth_hooks.py similarity index 72% rename from fleetactivitytracking/auth_hooks.py rename to allianceauth/fleetactivitytracking/auth_hooks.py index 6c3bd5c2..4cd8e0a5 100644 --- a/fleetactivitytracking/auth_hooks.py +++ b/allianceauth/fleetactivitytracking/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from fleetactivitytracking import urls +from . import urls + +from allianceauth import hooks +from allianceauth.services.hooks import MenuItemHook, UrlHook @hooks.register('menu_item_hook') diff --git a/fleetactivitytracking/forms.py b/allianceauth/fleetactivitytracking/forms.py similarity index 86% rename from fleetactivitytracking/forms.py rename to allianceauth/fleetactivitytracking/forms.py index 854b402a..7e322a8b 100644 --- a/fleetactivitytracking/forms.py +++ b/allianceauth/fleetactivitytracking/forms.py @@ -1,8 +1,9 @@ -from __future__ import unicode_literals + from django import forms -from optimer.models import OpTimer from django.utils.translation import ugettext_lazy as _ +from allianceauth.optimer.models import OpTimer + class FatlinkForm(forms.Form): fatname = forms.CharField(label=_('Name of fat-link'), required=True) diff --git a/fleetactivitytracking/migrations/0001_initial.py b/allianceauth/fleetactivitytracking/migrations/0001_initial.py similarity index 93% rename from fleetactivitytracking/migrations/0001_initial.py rename to allianceauth/fleetactivitytracking/migrations/0001_initial.py index 75671c1a..b462ab6b 100644 --- a/fleetactivitytracking/migrations/0001_initial.py +++ b/allianceauth/fleetactivitytracking/migrations/0001_initial.py @@ -3,11 +3,13 @@ from __future__ import unicode_literals import datetime + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion from django.utils.timezone import utc -import fleetactivitytracking.models + +import allianceauth.fleetactivitytracking.models class Migration(migrations.Migration): @@ -39,7 +41,8 @@ class Migration(migrations.Migration): ('fleet', models.CharField(default=b'', max_length=254)), ('name', models.CharField(max_length=254)), ('hash', models.CharField(max_length=254, unique=True)), - ('creator', models.ForeignKey(on_delete=models.SET(fleetactivitytracking.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)), + ('creator', models.ForeignKey(on_delete=models.SET( + allianceauth.fleetactivitytracking.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)), ], ), migrations.AddField( diff --git a/fleetactivitytracking/migrations/0002_auto_20160905_2220.py b/allianceauth/fleetactivitytracking/migrations/0002_auto_20160905_2220.py similarity index 100% rename from fleetactivitytracking/migrations/0002_auto_20160905_2220.py rename to allianceauth/fleetactivitytracking/migrations/0002_auto_20160905_2220.py diff --git a/fleetactivitytracking/migrations/0003_auto_20160906_2354.py b/allianceauth/fleetactivitytracking/migrations/0003_auto_20160906_2354.py similarity index 100% rename from fleetactivitytracking/migrations/0003_auto_20160906_2354.py rename to allianceauth/fleetactivitytracking/migrations/0003_auto_20160906_2354.py diff --git a/fleetactivitytracking/migrations/0004_make_strings_more_stringy.py b/allianceauth/fleetactivitytracking/migrations/0004_make_strings_more_stringy.py similarity index 100% rename from fleetactivitytracking/migrations/0004_make_strings_more_stringy.py rename to allianceauth/fleetactivitytracking/migrations/0004_make_strings_more_stringy.py diff --git a/eveonline/migrations/__init__.py b/allianceauth/fleetactivitytracking/migrations/__init__.py similarity index 100% rename from eveonline/migrations/__init__.py rename to allianceauth/fleetactivitytracking/migrations/__init__.py diff --git a/fleetactivitytracking/models.py b/allianceauth/fleetactivitytracking/models.py similarity index 84% rename from fleetactivitytracking/models.py rename to allianceauth/fleetactivitytracking/models.py index 45879bc8..3cf4607d 100644 --- a/fleetactivitytracking/models.py +++ b/allianceauth/fleetactivitytracking/models.py @@ -1,16 +1,14 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models from django.contrib.auth.models import User -from eveonline.models import EveCharacter +from django.db import models from django.utils import timezone +from allianceauth.eveonline.models import EveCharacter + def get_sentinel_user(): return User.objects.get_or_create(username='deleted')[0] -@python_2_unicode_compatible class Fatlink(models.Model): fatdatetime = models.DateTimeField(default=timezone.now) duration = models.PositiveIntegerField() @@ -23,7 +21,6 @@ class Fatlink(models.Model): return self.name -@python_2_unicode_compatible class Fat(models.Model): character = models.ForeignKey(EveCharacter, on_delete=models.CASCADE) fatlink = models.ForeignKey(Fatlink) diff --git a/fleetactivitytracking/swagger.json b/allianceauth/fleetactivitytracking/swagger.json similarity index 100% rename from fleetactivitytracking/swagger.json rename to allianceauth/fleetactivitytracking/swagger.json diff --git a/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/characternotexisting.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkformatter.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkmodify.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalmonthlystatisticsview.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkpersonalstatisticsview.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticscorpview.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkstatisticsview.html diff --git a/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html b/allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html similarity index 100% rename from fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html rename to allianceauth/fleetactivitytracking/templates/fleetactivitytracking/fatlinkview.html diff --git a/allianceauth/fleetactivitytracking/urls.py b/allianceauth/fleetactivitytracking/urls.py new file mode 100644 index 00000000..e6e6113a --- /dev/null +++ b/allianceauth/fleetactivitytracking/urls.py @@ -0,0 +1,33 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + # FleetActivityTracking (FAT) + url(r'^$', views.fatlink_view, name='view'), + url(r'^statistics/$', views.fatlink_statistics_view, name='statistics'), + url(r'^statistics/corp/(\w+)$', views.fatlink_statistics_corp_view, + name='statistics_corp'), + url(r'^statistics/corp/(?P\w+)/(?P[0-9]+)/(?P[0-9]+)/', + views.fatlink_statistics_corp_view, + name='statistics_corp_month'), + url(r'^statistics/(?P[0-9]+)/(?P[0-9]+)/$', views.fatlink_statistics_view, + name='statistics_month'), + url(r'^user/statistics/$', views.fatlink_personal_statistics_view, + name='personal_statistics'), + url(r'^user/statistics/(?P[0-9]+)/$', views.fatlink_personal_statistics_view, + name='personal_statistics_year'), + url(r'^user/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + views.fatlink_monthly_personal_statistics_view, + name='personal_statistics_month'), + url(r'^user/(?P[0-9]+)/statistics/(?P[0-9]+)/(?P[0-9]+)/$', + views.fatlink_monthly_personal_statistics_view, + name='user_statistics_month'), + url(r'^create/$', views.create_fatlink_view, name='create'), + url(r'^modify/$', views.modify_fatlink_view, name='modify'), + url(r'^modify/(?P[a-zA-Z0-9_-]+)/([a-z0-9_-]+)$', + views.modify_fatlink_view), + url(r'^link/$', views.fatlink_view, name='click_fatlink'), + url(r'^link/(?P[a-zA-Z0-9]+)/(?P[a-z0-9_-]+)/$', + views.click_fatlink_view), + ] \ No newline at end of file diff --git a/fleetactivitytracking/views.py b/allianceauth/fleetactivitytracking/views.py similarity index 97% rename from fleetactivitytracking/views.py rename to allianceauth/fleetactivitytracking/views.py index 4684a21f..5b14a71d 100644 --- a/fleetactivitytracking/views.py +++ b/allianceauth/fleetactivitytracking/views.py @@ -1,28 +1,29 @@ -from __future__ import unicode_literals -from django.conf import settings -from django.shortcuts import render, redirect, get_object_or_404 -from django.contrib.auth.decorators import login_required -from django.contrib.auth.decorators import permission_required -from django.core.exceptions import ValidationError, ObjectDoesNotExist -from django.utils.translation import ugettext_lazy as _ -from django.utils import timezone -from django.contrib import messages -from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger -from eveonline.models import EveCharacter -from eveonline.models import EveCorporationInfo -from eveonline.models import EveAllianceInfo -from eveonline.managers import EveManager -from fleetactivitytracking.forms import FatlinkForm -from fleetactivitytracking.models import Fatlink, Fat -from authentication.models import CharacterOwnership -from django.contrib.auth.models import User -from esi.decorators import token_required -from slugify import slugify -import string -import random import datetime import logging import os +import random +import string + +from allianceauth.authentication.models import CharacterOwnership +from django.conf import settings +from django.contrib import messages +from django.contrib.auth.decorators import login_required +from django.contrib.auth.decorators import permission_required +from django.contrib.auth.models import User +from django.core.exceptions import ValidationError, ObjectDoesNotExist +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger +from django.shortcuts import render, redirect, get_object_or_404 +from django.utils import timezone +from django.utils.translation import ugettext_lazy as _ +from esi.decorators import token_required +from allianceauth.eveonline.managers import EveManager +from .forms import FatlinkForm +from .models import Fatlink, Fat +from slugify import slugify + +from allianceauth.eveonline.models import EveAllianceInfo +from allianceauth.eveonline.models import EveCharacter +from allianceauth.eveonline.models import EveCorporationInfo SWAGGER_SPEC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'swagger.json') diff --git a/allianceauth/fleetup/__init__.py b/allianceauth/fleetup/__init__.py new file mode 100755 index 00000000..dfdc4e77 --- /dev/null +++ b/allianceauth/fleetup/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.fleetup.apps.FleetupConfig' diff --git a/fleetup/apps.py b/allianceauth/fleetup/apps.py similarity index 52% rename from fleetup/apps.py rename to allianceauth/fleetup/apps.py index e8b5a203..98def790 100644 --- a/fleetup/apps.py +++ b/allianceauth/fleetup/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class FleetupConfig(AppConfig): - name = 'fleetup' + name = 'allianceauth.fleetup' + label = 'fleetup' diff --git a/fleetup/auth_hooks.py b/allianceauth/fleetup/auth_hooks.py similarity index 84% rename from fleetup/auth_hooks.py rename to allianceauth/fleetup/auth_hooks.py index 75f54f7a..d0c240b9 100644 --- a/fleetup/auth_hooks.py +++ b/allianceauth/fleetup/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from fleetup import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from . import urls class FleetUpMenu(MenuItemHook): diff --git a/fleetup/managers.py b/allianceauth/fleetup/managers.py similarity index 99% rename from fleetup/managers.py rename to allianceauth/fleetup/managers.py index bb9bca48..ca84d196 100644 --- a/fleetup/managers.py +++ b/allianceauth/fleetup/managers.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf import settings from django.core.cache import cache from django.utils import timezone diff --git a/fleetup/templates/fleetup/characters.html b/allianceauth/fleetup/templates/fleetup/characters.html similarity index 100% rename from fleetup/templates/fleetup/characters.html rename to allianceauth/fleetup/templates/fleetup/characters.html diff --git a/fleetup/templates/fleetup/doctrine.html b/allianceauth/fleetup/templates/fleetup/doctrine.html similarity index 100% rename from fleetup/templates/fleetup/doctrine.html rename to allianceauth/fleetup/templates/fleetup/doctrine.html diff --git a/fleetup/templates/fleetup/doctrinesview.html b/allianceauth/fleetup/templates/fleetup/doctrinesview.html similarity index 100% rename from fleetup/templates/fleetup/doctrinesview.html rename to allianceauth/fleetup/templates/fleetup/doctrinesview.html diff --git a/fleetup/templates/fleetup/fitting.html b/allianceauth/fleetup/templates/fleetup/fitting.html similarity index 100% rename from fleetup/templates/fleetup/fitting.html rename to allianceauth/fleetup/templates/fleetup/fitting.html diff --git a/fleetup/templates/fleetup/fittingsview.html b/allianceauth/fleetup/templates/fleetup/fittingsview.html similarity index 100% rename from fleetup/templates/fleetup/fittingsview.html rename to allianceauth/fleetup/templates/fleetup/fittingsview.html diff --git a/fleetup/templates/fleetup/index.html b/allianceauth/fleetup/templates/fleetup/index.html similarity index 100% rename from fleetup/templates/fleetup/index.html rename to allianceauth/fleetup/templates/fleetup/index.html diff --git a/fleetup/templates/fleetup/menu.html b/allianceauth/fleetup/templates/fleetup/menu.html similarity index 100% rename from fleetup/templates/fleetup/menu.html rename to allianceauth/fleetup/templates/fleetup/menu.html diff --git a/fleetactivitytracking/migrations/__init__.py b/allianceauth/fleetup/tests/__init__.py similarity index 100% rename from fleetactivitytracking/migrations/__init__.py rename to allianceauth/fleetup/tests/__init__.py diff --git a/fleetup/tests/test_manager.py b/allianceauth/fleetup/tests/test_manager.py similarity index 93% rename from fleetup/tests/test_manager.py rename to allianceauth/fleetup/tests/test_manager.py index 333b6f90..faf21ed9 100644 --- a/fleetup/tests/test_manager.py +++ b/allianceauth/fleetup/tests/test_manager.py @@ -1,11 +1,4 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock import requests_mock import json @@ -14,7 +7,7 @@ import datetime from django.test import TestCase from django.utils.timezone import make_aware, utc -from fleetup.managers import FleetUpManager +from allianceauth.fleetup.managers import FleetUpManager class FleetupManagerTestCase(TestCase): @@ -28,7 +21,7 @@ class FleetupManagerTestCase(TestCase): self.assertEqual('FLEETUP_ENDPOINT_a39562b6ef5b858220be13d2adb61d3f10cf8d61', cache_key) - @mock.patch('fleetup.managers.cache') + @mock.patch('allianceauth.fleetup.managers.cache') @requests_mock.Mocker() def test_get_endpoint(self, cache, m): url = "http://example.com/test/endpoint/" @@ -49,7 +42,7 @@ class FleetupManagerTestCase(TestCase): self.assertDictEqual(json_data, result) - @mock.patch('fleetup.managers.cache') + @mock.patch('allianceauth.fleetup.managers.cache') @requests_mock.Mocker() def test_get_endpoint_error(self, cache, m): url = "http://example.com/test/endpoint/" @@ -68,7 +61,7 @@ class FleetupManagerTestCase(TestCase): self.assertFalse(cache.set.called) self.assertIsNone(result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_members(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -119,7 +112,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_operations(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -182,7 +175,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_timers(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -241,7 +234,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_doctrines(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -286,7 +279,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({"fleetup_doctrines": []}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_doctrine(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -330,7 +323,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({"fitting_doctrine": {'Data': []}}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_fittings(self, get_endpoint): get_endpoint.return_value = {"Data": [ @@ -387,7 +380,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_fitting(self, get_endpoint): get_endpoint.return_value = {"Data": @@ -430,7 +423,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({"fitting_data": {}}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_doctrineid(self, get_endpoint): get_endpoint.return_value = { @@ -469,7 +462,7 @@ class FleetupManagerTestCase(TestCase): # Assert self.assertDictEqual({}, result) - @mock.patch('fleetup.managers.FleetUpManager.get_endpoint') + @mock.patch('allianceauth.fleetup.managers.FleetUpManager.get_endpoint') def test_get_fleetup_fitting_eft(self, get_endpoint): get_endpoint.return_value = { diff --git a/fleetup/urls.py b/allianceauth/fleetup/urls.py similarity index 93% rename from fleetup/urls.py rename to allianceauth/fleetup/urls.py index 990c78c7..1e2b06df 100644 --- a/fleetup/urls.py +++ b/allianceauth/fleetup/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url from . import views diff --git a/fleetup/views.py b/allianceauth/fleetup/views.py similarity index 98% rename from fleetup/views.py rename to allianceauth/fleetup/views.py index 80103be4..893bc7a1 100644 --- a/fleetup/views.py +++ b/allianceauth/fleetup/views.py @@ -1,14 +1,14 @@ -from __future__ import unicode_literals import datetime -from django.shortcuts import render +import logging + +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import permission_required +from django.shortcuts import render from django.template.defaulttags import register -from django.contrib import messages from django.utils.translation import ugettext_lazy as _ -from fleetup.managers import FleetUpManager -import logging +from .managers import FleetUpManager logger = logging.getLogger(__name__) diff --git a/allianceauth/groupmanagement/__init__.py b/allianceauth/groupmanagement/__init__.py new file mode 100644 index 00000000..5358824f --- /dev/null +++ b/allianceauth/groupmanagement/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.groupmanagement.apps.GroupManagementConfig' diff --git a/groupmanagement/admin.py b/allianceauth/groupmanagement/admin.py similarity index 80% rename from groupmanagement/admin.py rename to allianceauth/groupmanagement/admin.py index bf2df202..c7287386 100644 --- a/groupmanagement/admin.py +++ b/allianceauth/groupmanagement/admin.py @@ -1,8 +1,8 @@ -from __future__ import unicode_literals from django.contrib import admin from django.contrib.auth.models import Group -from groupmanagement.models import GroupRequest -from groupmanagement.models import AuthGroup + +from .models import AuthGroup +from .models import GroupRequest class AuthGroupAdmin(admin.ModelAdmin): diff --git a/groupmanagement/apps.py b/allianceauth/groupmanagement/apps.py similarity index 51% rename from groupmanagement/apps.py rename to allianceauth/groupmanagement/apps.py index 74482d3d..b8b17b78 100644 --- a/groupmanagement/apps.py +++ b/allianceauth/groupmanagement/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class GroupManagementConfig(AppConfig): - name = 'groupmanagement' + name = 'allianceauth.groupmanagement' + label = 'groupmanagement' diff --git a/groupmanagement/context_processors.py b/allianceauth/groupmanagement/context_processors.py similarity index 64% rename from groupmanagement/context_processors.py rename to allianceauth/groupmanagement/context_processors.py index 0d60be3f..5e1d9fbd 100644 --- a/groupmanagement/context_processors.py +++ b/allianceauth/groupmanagement/context_processors.py @@ -1,4 +1,4 @@ -from groupmanagement.managers import GroupManager +from allianceauth.groupmanagement.managers import GroupManager def can_manage_groups(request): diff --git a/groupmanagement/managers.py b/allianceauth/groupmanagement/managers.py similarity index 100% rename from groupmanagement/managers.py rename to allianceauth/groupmanagement/managers.py diff --git a/groupmanagement/migrations/0001_initial.py b/allianceauth/groupmanagement/migrations/0001_initial.py similarity index 100% rename from groupmanagement/migrations/0001_initial.py rename to allianceauth/groupmanagement/migrations/0001_initial.py diff --git a/groupmanagement/migrations/0002_auto_20160906_2354.py b/allianceauth/groupmanagement/migrations/0002_auto_20160906_2354.py similarity index 100% rename from groupmanagement/migrations/0002_auto_20160906_2354.py rename to allianceauth/groupmanagement/migrations/0002_auto_20160906_2354.py diff --git a/groupmanagement/migrations/0003_default_groups.py b/allianceauth/groupmanagement/migrations/0003_default_groups.py similarity index 100% rename from groupmanagement/migrations/0003_default_groups.py rename to allianceauth/groupmanagement/migrations/0003_default_groups.py diff --git a/groupmanagement/migrations/0004_authgroup.py b/allianceauth/groupmanagement/migrations/0004_authgroup.py similarity index 100% rename from groupmanagement/migrations/0004_authgroup.py rename to allianceauth/groupmanagement/migrations/0004_authgroup.py diff --git a/groupmanagement/migrations/0005_authgroup_public.py b/allianceauth/groupmanagement/migrations/0005_authgroup_public.py similarity index 100% rename from groupmanagement/migrations/0005_authgroup_public.py rename to allianceauth/groupmanagement/migrations/0005_authgroup_public.py diff --git a/groupmanagement/migrations/0006_request_groups_perm.py b/allianceauth/groupmanagement/migrations/0006_request_groups_perm.py similarity index 100% rename from groupmanagement/migrations/0006_request_groups_perm.py rename to allianceauth/groupmanagement/migrations/0006_request_groups_perm.py diff --git a/fleetup/tests/__init__.py b/allianceauth/groupmanagement/migrations/__init__.py similarity index 100% rename from fleetup/tests/__init__.py rename to allianceauth/groupmanagement/migrations/__init__.py diff --git a/groupmanagement/models.py b/allianceauth/groupmanagement/models.py similarity index 95% rename from groupmanagement/models.py rename to allianceauth/groupmanagement/models.py index ad8f5409..bcb1b24d 100644 --- a/groupmanagement/models.py +++ b/allianceauth/groupmanagement/models.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models -from django.contrib.auth.models import User from django.contrib.auth.models import Group +from django.contrib.auth.models import User +from django.db import models from django.db.models.signals import post_save from django.dispatch import receiver -from eveonline.models import EveCharacter +from allianceauth.eveonline.models import EveCharacter -@python_2_unicode_compatible class GroupRequest(models.Model): status = models.CharField(max_length=254) leave_request = models.BooleanField(default=0) @@ -21,7 +18,6 @@ class GroupRequest(models.Model): return self.user.username + ":" + self.group.name -@python_2_unicode_compatible class AuthGroup(models.Model): """ Extends Django Group model with a one-to-one field diff --git a/groupmanagement/tests.py b/allianceauth/groupmanagement/tests.py similarity index 100% rename from groupmanagement/tests.py rename to allianceauth/groupmanagement/tests.py diff --git a/groupmanagement/views.py b/allianceauth/groupmanagement/views.py similarity index 98% rename from groupmanagement/views.py rename to allianceauth/groupmanagement/views.py index e472f40b..9e5a650d 100755 --- a/groupmanagement/views.py +++ b/allianceauth/groupmanagement/views.py @@ -1,20 +1,18 @@ -from __future__ import unicode_literals -from django.shortcuts import render, redirect, get_object_or_404 +import logging + +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.models import Group -from django.contrib import messages -from notifications import notify -from django.utils.translation import ugettext_lazy as _ -from django.db.models import Count from django.core.exceptions import ObjectDoesNotExist, PermissionDenied +from django.db.models import Count from django.http import Http404 -from groupmanagement.managers import GroupManager -from groupmanagement.models import GroupRequest -from eveonline.managers import EveManager +from django.shortcuts import render, redirect, get_object_or_404 from django.utils.translation import ugettext_lazy as _ +from .managers import GroupManager +from .models import GroupRequest -import logging +from allianceauth.notifications import notify logger = logging.getLogger(__name__) diff --git a/alliance_auth/hooks.py b/allianceauth/hooks.py similarity index 99% rename from alliance_auth/hooks.py rename to allianceauth/hooks.py index b10afaa9..e4d6ea11 100644 --- a/alliance_auth/hooks.py +++ b/allianceauth/hooks.py @@ -30,8 +30,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Based on https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailcore/hooks.py """ -from __future__ import unicode_literals - from importlib import import_module from django.apps import apps diff --git a/allianceauth/hrapplications/__init__.py b/allianceauth/hrapplications/__init__.py new file mode 100644 index 00000000..1cbf5280 --- /dev/null +++ b/allianceauth/hrapplications/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.hrapplications.apps.HRApplicationsConfig' diff --git a/hrapplications/admin.py b/allianceauth/hrapplications/admin.py similarity index 61% rename from hrapplications/admin.py rename to allianceauth/hrapplications/admin.py index c1d4c4d5..e6b80f09 100755 --- a/hrapplications/admin.py +++ b/allianceauth/hrapplications/admin.py @@ -1,12 +1,8 @@ -from __future__ import unicode_literals from django.contrib import admin -from hrapplications.models import Application -from hrapplications.models import ApplicationQuestion -from hrapplications.models import ApplicationForm -from hrapplications.models import ApplicationResponse -from hrapplications.models import ApplicationComment -from hrapplications.models import ApplicationChoice +from .models import Application, ApplicationChoice, ApplicationComment, ApplicationForm, ApplicationQuestion, \ + ApplicationResponse + class ChoiceInline(admin.TabularInline): model = ApplicationChoice diff --git a/hrapplications/apps.py b/allianceauth/hrapplications/apps.py similarity index 51% rename from hrapplications/apps.py rename to allianceauth/hrapplications/apps.py index 5d99de86..d3c61479 100644 --- a/hrapplications/apps.py +++ b/allianceauth/hrapplications/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class HRApplicationsConfig(AppConfig): - name = 'hrapplications' + name = 'allianceauth.hrapplications' + label = 'hrapplications' diff --git a/hrapplications/auth_hooks.py b/allianceauth/hrapplications/auth_hooks.py similarity index 81% rename from hrapplications/auth_hooks.py rename to allianceauth/hrapplications/auth_hooks.py index 3e2f3246..b465c9e8 100644 --- a/hrapplications/auth_hooks.py +++ b/allianceauth/hrapplications/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from hrapplications import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from allianceauth.hrapplications import urls class ApplicationsMenu(MenuItemHook): diff --git a/hrapplications/forms.py b/allianceauth/hrapplications/forms.py similarity index 89% rename from hrapplications/forms.py rename to allianceauth/hrapplications/forms.py index 70842acb..73ffd5c4 100755 --- a/hrapplications/forms.py +++ b/allianceauth/hrapplications/forms.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/hrapplications/migrations/0001_initial.py b/allianceauth/hrapplications/migrations/0001_initial.py similarity index 100% rename from hrapplications/migrations/0001_initial.py rename to allianceauth/hrapplications/migrations/0001_initial.py diff --git a/hrapplications/migrations/0002_choices_for_questions.py b/allianceauth/hrapplications/migrations/0002_choices_for_questions.py similarity index 100% rename from hrapplications/migrations/0002_choices_for_questions.py rename to allianceauth/hrapplications/migrations/0002_choices_for_questions.py diff --git a/hrapplications/migrations/0003_make_strings_more_stringy.py b/allianceauth/hrapplications/migrations/0003_make_strings_more_stringy.py similarity index 100% rename from hrapplications/migrations/0003_make_strings_more_stringy.py rename to allianceauth/hrapplications/migrations/0003_make_strings_more_stringy.py diff --git a/hrapplications/migrations/0004_sorted_questions.py b/allianceauth/hrapplications/migrations/0004_sorted_questions.py similarity index 100% rename from hrapplications/migrations/0004_sorted_questions.py rename to allianceauth/hrapplications/migrations/0004_sorted_questions.py diff --git a/hrapplications/migrations/0005_remove_legacy_models.py b/allianceauth/hrapplications/migrations/0005_remove_legacy_models.py similarity index 100% rename from hrapplications/migrations/0005_remove_legacy_models.py rename to allianceauth/hrapplications/migrations/0005_remove_legacy_models.py diff --git a/groupmanagement/migrations/__init__.py b/allianceauth/hrapplications/migrations/__init__.py similarity index 100% rename from groupmanagement/migrations/__init__.py rename to allianceauth/hrapplications/migrations/__init__.py diff --git a/hrapplications/models.py b/allianceauth/hrapplications/models.py similarity index 89% rename from hrapplications/models.py rename to allianceauth/hrapplications/models.py index 2ee9ef4b..82317549 100755 --- a/hrapplications/models.py +++ b/allianceauth/hrapplications/models.py @@ -1,13 +1,11 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models from django.contrib.auth.models import User +from django.db import models from sortedm2m.fields import SortedManyToManyField -from eveonline.models import EveCharacter -from eveonline.models import EveCorporationInfo + +from allianceauth.eveonline.models import EveCharacter +from allianceauth.eveonline.models import EveCorporationInfo -@python_2_unicode_compatible class ApplicationQuestion(models.Model): title = models.CharField(max_length=254, verbose_name='Question') help_text = models.CharField(max_length=254, blank=True, null=True) @@ -16,7 +14,6 @@ class ApplicationQuestion(models.Model): return "Question: " + self.title -@python_2_unicode_compatible class ApplicationChoice(models.Model): question = models.ForeignKey(ApplicationQuestion,on_delete=models.CASCADE,related_name="choices") choice_text = models.CharField(max_length=200, verbose_name='Choice') @@ -24,7 +21,6 @@ class ApplicationChoice(models.Model): def __str__(self): return self.choice_text -@python_2_unicode_compatible class ApplicationForm(models.Model): questions = SortedManyToManyField(ApplicationQuestion) corp = models.OneToOneField(EveCorporationInfo) @@ -33,7 +29,6 @@ class ApplicationForm(models.Model): return str(self.corp) -@python_2_unicode_compatible class Application(models.Model): form = models.ForeignKey(ApplicationForm, on_delete=models.CASCADE, related_name='applications') user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='applications') @@ -69,7 +64,6 @@ class Application(models.Model): return None -@python_2_unicode_compatible class ApplicationResponse(models.Model): question = models.ForeignKey(ApplicationQuestion, on_delete=models.CASCADE) application = models.ForeignKey(Application, on_delete=models.CASCADE, related_name='responses') @@ -82,7 +76,6 @@ class ApplicationResponse(models.Model): unique_together = ('question', 'application') -@python_2_unicode_compatible class ApplicationComment(models.Model): application = models.ForeignKey(Application, on_delete=models.CASCADE, related_name='comments') user = models.ForeignKey(User, on_delete=models.CASCADE) diff --git a/hrapplications/templates/hrapplications/corpchoice.html b/allianceauth/hrapplications/templates/hrapplications/corpchoice.html similarity index 100% rename from hrapplications/templates/hrapplications/corpchoice.html rename to allianceauth/hrapplications/templates/hrapplications/corpchoice.html diff --git a/hrapplications/templates/hrapplications/create.html b/allianceauth/hrapplications/templates/hrapplications/create.html similarity index 100% rename from hrapplications/templates/hrapplications/create.html rename to allianceauth/hrapplications/templates/hrapplications/create.html diff --git a/hrapplications/templates/hrapplications/management.html b/allianceauth/hrapplications/templates/hrapplications/management.html similarity index 100% rename from hrapplications/templates/hrapplications/management.html rename to allianceauth/hrapplications/templates/hrapplications/management.html diff --git a/hrapplications/templates/hrapplications/searchview.html b/allianceauth/hrapplications/templates/hrapplications/searchview.html similarity index 100% rename from hrapplications/templates/hrapplications/searchview.html rename to allianceauth/hrapplications/templates/hrapplications/searchview.html diff --git a/hrapplications/templates/hrapplications/view.html b/allianceauth/hrapplications/templates/hrapplications/view.html similarity index 100% rename from hrapplications/templates/hrapplications/view.html rename to allianceauth/hrapplications/templates/hrapplications/view.html diff --git a/hrapplications/tests.py b/allianceauth/hrapplications/tests.py similarity index 100% rename from hrapplications/tests.py rename to allianceauth/hrapplications/tests.py diff --git a/allianceauth/hrapplications/urls.py b/allianceauth/hrapplications/urls.py new file mode 100644 index 00000000..295ed1e6 --- /dev/null +++ b/allianceauth/hrapplications/urls.py @@ -0,0 +1,31 @@ +from django.conf.urls import url + +from . import views + +app_name = 'hrapplications' + +urlpatterns = [ + url(r'^$', views.hr_application_management_view, + name="index"), + url(r'^create/$', views.hr_application_create_view, + name="create_view"), + url(r'^create/(\d+)', views.hr_application_create_view, + name="create_view"), + url(r'^remove/(\w+)', views.hr_application_remove, + name="remove"), + url(r'view/(\w+)', views.hr_application_view, + name="view"), + url(r'personal/view/(\w+)', views.hr_application_personal_view, + name="personal_view"), + url(r'personal/removal/(\w+)', + views.hr_application_personal_removal, + name="personal_removal"), + url(r'approve/(\w+)', views.hr_application_approve, + name="approve"), + url(r'reject/(\w+)', views.hr_application_reject, + name="reject"), + url(r'search/', views.hr_application_search, + name="search"), + url(r'mark_in_progress/(\w+)', views.hr_application_mark_in_progress, + name="mark_in_progress"), + ] diff --git a/hrapplications/views.py b/allianceauth/hrapplications/views.py similarity index 96% rename from hrapplications/views.py rename to allianceauth/hrapplications/views.py index 3a444ceb..802256d6 100755 --- a/hrapplications/views.py +++ b/allianceauth/hrapplications/views.py @@ -1,18 +1,18 @@ -from __future__ import unicode_literals -from django.shortcuts import render, get_object_or_404, redirect -from django.contrib.auth.decorators import permission_required -from django.contrib.auth.decorators import login_required -from django.contrib.auth.decorators import user_passes_test -from notifications import notify -from hrapplications.models import ApplicationForm -from hrapplications.models import Application -from hrapplications.models import ApplicationResponse -from hrapplications.models import ApplicationComment -from hrapplications.forms import HRApplicationCommentForm -from hrapplications.forms import HRApplicationSearchForm - import logging +from django.contrib.auth.decorators import login_required +from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import user_passes_test +from django.shortcuts import render, get_object_or_404, redirect +from .models import Application +from .models import ApplicationComment +from .models import ApplicationForm +from .models import ApplicationResponse +from allianceauth.notifications import notify + +from .forms import HRApplicationCommentForm +from .forms import HRApplicationSearchForm + logger = logging.getLogger(__name__) diff --git a/locale/de/LC_MESSAGES/django.po b/allianceauth/locale/de/LC_MESSAGES/django.po similarity index 100% rename from locale/de/LC_MESSAGES/django.po rename to allianceauth/locale/de/LC_MESSAGES/django.po diff --git a/services/models.py b/allianceauth/models.py similarity index 100% rename from services/models.py rename to allianceauth/models.py diff --git a/notifications/__init__.py b/allianceauth/notifications/__init__.py similarity index 88% rename from notifications/__init__.py rename to allianceauth/notifications/__init__.py index 48437531..323a9848 100644 --- a/notifications/__init__.py +++ b/allianceauth/notifications/__init__.py @@ -1,4 +1,4 @@ -from __future__ import unicode_literals +default_app_config = 'allianceauth.notifications.apps.NotificationsConfig' import logging logger = logging.getLogger(__name__) diff --git a/allianceauth/notifications/admin.py b/allianceauth/notifications/admin.py new file mode 100644 index 00000000..783f0f0a --- /dev/null +++ b/allianceauth/notifications/admin.py @@ -0,0 +1,4 @@ +from django.contrib import admin +from .models import Notification + +admin.site.register(Notification) diff --git a/notifications/apps.py b/allianceauth/notifications/apps.py similarity index 52% rename from notifications/apps.py rename to allianceauth/notifications/apps.py index 6e5c9743..384e7c93 100644 --- a/notifications/apps.py +++ b/allianceauth/notifications/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class NotificationsConfig(AppConfig): - name = 'notifications' + name = 'allianceauth.notifications' + label = 'notifications' diff --git a/notifications/context_processors.py b/allianceauth/notifications/context_processors.py similarity index 63% rename from notifications/context_processors.py rename to allianceauth/notifications/context_processors.py index 97d05923..75726acb 100644 --- a/notifications/context_processors.py +++ b/allianceauth/notifications/context_processors.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -from notifications.models import Notification +from .models import Notification def user_notification_count(request): diff --git a/notifications/handlers.py b/allianceauth/notifications/handlers.py similarity index 88% rename from notifications/handlers.py rename to allianceauth/notifications/handlers.py index dad51354..9fcaee18 100644 --- a/notifications/handlers.py +++ b/allianceauth/notifications/handlers.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import logging logger = logging.getLogger(__name__) @@ -8,8 +7,8 @@ class NotificationHandler(logging.Handler): def emit(self, record): from django.contrib.auth.models import User, Permission from django.db.models import Q - from notifications import notify - from notifications.models import Notification + from . import notify + from .models import Notification try: perm = Permission.objects.get(codename="logging_notifications") diff --git a/notifications/migrations/0001_initial.py b/allianceauth/notifications/migrations/0001_initial.py similarity index 100% rename from notifications/migrations/0001_initial.py rename to allianceauth/notifications/migrations/0001_initial.py diff --git a/notifications/migrations/0002_auto_20160910_1649.py b/allianceauth/notifications/migrations/0002_auto_20160910_1649.py similarity index 100% rename from notifications/migrations/0002_auto_20160910_1649.py rename to allianceauth/notifications/migrations/0002_auto_20160910_1649.py diff --git a/notifications/migrations/0003_make_strings_more_stringy.py b/allianceauth/notifications/migrations/0003_make_strings_more_stringy.py similarity index 100% rename from notifications/migrations/0003_make_strings_more_stringy.py rename to allianceauth/notifications/migrations/0003_make_strings_more_stringy.py diff --git a/hrapplications/migrations/__init__.py b/allianceauth/notifications/migrations/__init__.py similarity index 100% rename from hrapplications/migrations/__init__.py rename to allianceauth/notifications/migrations/__init__.py diff --git a/notifications/models.py b/allianceauth/notifications/models.py similarity index 88% rename from notifications/models.py rename to allianceauth/notifications/models.py index a102139f..7e432e30 100644 --- a/notifications/models.py +++ b/allianceauth/notifications/models.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models from django.contrib.auth.models import User import logging @@ -7,7 +5,6 @@ import logging logger = logging.getLogger(__name__) -@python_2_unicode_compatible class Notification(models.Model): LEVEL_CHOICES = ( ('danger', 'CRITICAL'), diff --git a/notifications/tests.py b/allianceauth/notifications/tests.py similarity index 100% rename from notifications/tests.py rename to allianceauth/notifications/tests.py diff --git a/notifications/views.py b/allianceauth/notifications/views.py similarity index 98% rename from notifications/views.py rename to allianceauth/notifications/views.py index a75e64a8..d6acbd26 100644 --- a/notifications/views.py +++ b/allianceauth/notifications/views.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.shortcuts import render, get_object_or_404, redirect from .models import Notification from django.contrib.auth.decorators import login_required diff --git a/allianceauth/optimer/__init__.py b/allianceauth/optimer/__init__.py new file mode 100644 index 00000000..0363d1b5 --- /dev/null +++ b/allianceauth/optimer/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.optimer.apps.OptimerConfig' diff --git a/allianceauth/optimer/admin.py b/allianceauth/optimer/admin.py new file mode 100644 index 00000000..72b8767a --- /dev/null +++ b/allianceauth/optimer/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from allianceauth.optimer.models import OpTimer + +admin.site.register(OpTimer) diff --git a/optimer/apps.py b/allianceauth/optimer/apps.py similarity index 52% rename from optimer/apps.py rename to allianceauth/optimer/apps.py index 9b2a9052..90ed6f2b 100644 --- a/optimer/apps.py +++ b/allianceauth/optimer/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class OptimerConfig(AppConfig): - name = 'optimer' + name = 'allianceauth.optimer' + label = 'optimer' diff --git a/optimer/auth_hooks.py b/allianceauth/optimer/auth_hooks.py similarity index 84% rename from optimer/auth_hooks.py rename to allianceauth/optimer/auth_hooks.py index c95e42f1..f1d7f48b 100644 --- a/optimer/auth_hooks.py +++ b/allianceauth/optimer/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from optimer import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from . import urls class OpTimerboardMenu(MenuItemHook): diff --git a/optimer/form.py b/allianceauth/optimer/form.py similarity index 93% rename from optimer/form.py rename to allianceauth/optimer/form.py index 45b956bf..620616d3 100644 --- a/optimer/form.py +++ b/allianceauth/optimer/form.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/optimer/migrations/0001_initial.py b/allianceauth/optimer/migrations/0001_initial.py similarity index 100% rename from optimer/migrations/0001_initial.py rename to allianceauth/optimer/migrations/0001_initial.py diff --git a/optimer/migrations/0002_auto_20170413_0442.py b/allianceauth/optimer/migrations/0002_auto_20170413_0442.py similarity index 100% rename from optimer/migrations/0002_auto_20170413_0442.py rename to allianceauth/optimer/migrations/0002_auto_20170413_0442.py diff --git a/optimer/migrations/0003_make_strings_more_stringy.py b/allianceauth/optimer/migrations/0003_make_strings_more_stringy.py similarity index 100% rename from optimer/migrations/0003_make_strings_more_stringy.py rename to allianceauth/optimer/migrations/0003_make_strings_more_stringy.py diff --git a/notifications/migrations/__init__.py b/allianceauth/optimer/migrations/__init__.py similarity index 100% rename from notifications/migrations/__init__.py rename to allianceauth/optimer/migrations/__init__.py diff --git a/optimer/models.py b/allianceauth/optimer/models.py similarity index 80% rename from optimer/models.py rename to allianceauth/optimer/models.py index bda5d332..fe9d19b9 100644 --- a/optimer/models.py +++ b/allianceauth/optimer/models.py @@ -1,12 +1,11 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models -from django.utils import timezone -from eveonline.models import EveCharacter from datetime import datetime +from django.db import models +from django.utils import timezone + +from allianceauth.eveonline.models import EveCharacter + -@python_2_unicode_compatible class OpTimer(models.Model): class Meta: ordering = ['start'] diff --git a/optimer/templates/optimer/add.html b/allianceauth/optimer/templates/optimer/add.html similarity index 100% rename from optimer/templates/optimer/add.html rename to allianceauth/optimer/templates/optimer/add.html diff --git a/optimer/templates/optimer/fleetoptable.html b/allianceauth/optimer/templates/optimer/fleetoptable.html similarity index 100% rename from optimer/templates/optimer/fleetoptable.html rename to allianceauth/optimer/templates/optimer/fleetoptable.html diff --git a/optimer/templates/optimer/management.html b/allianceauth/optimer/templates/optimer/management.html similarity index 100% rename from optimer/templates/optimer/management.html rename to allianceauth/optimer/templates/optimer/management.html diff --git a/optimer/templates/optimer/update.html b/allianceauth/optimer/templates/optimer/update.html similarity index 100% rename from optimer/templates/optimer/update.html rename to allianceauth/optimer/templates/optimer/update.html diff --git a/optimer/tests.py b/allianceauth/optimer/tests.py similarity index 100% rename from optimer/tests.py rename to allianceauth/optimer/tests.py diff --git a/allianceauth/optimer/urls.py b/allianceauth/optimer/urls.py new file mode 100644 index 00000000..bbdb28ff --- /dev/null +++ b/allianceauth/optimer/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import url + +from . import views + +app_name = 'optimer' + +urlpatterns = [ + url(r'^$', views.optimer_view, name='view'), + url(r'^add$', views.add_optimer_view, name='add'), + url(r'^(\w+)/remove$', views.remove_optimer, name='remove'), + url(r'^(\w+)/edit$', views.edit_optimer, name='edit'), + ] diff --git a/optimer/views.py b/allianceauth/optimer/views.py similarity index 97% rename from optimer/views.py rename to allianceauth/optimer/views.py index 56c54667..fb5f4bad 100644 --- a/optimer/views.py +++ b/allianceauth/optimer/views.py @@ -1,15 +1,15 @@ -from __future__ import unicode_literals +import logging + +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import permission_required -from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ from django.shortcuts import get_object_or_404 from django.shortcuts import render, redirect -from django.contrib import messages -from optimer.form import OpForm -from optimer.models import OpTimer +from django.utils import timezone +from django.utils.translation import ugettext_lazy as _ +from .form import OpForm -import logging +from .models import OpTimer logger = logging.getLogger(__name__) diff --git a/allianceauth/permissions_tool/__init__.py b/allianceauth/permissions_tool/__init__.py new file mode 100644 index 00000000..51ef3020 --- /dev/null +++ b/allianceauth/permissions_tool/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.permissions_tool.apps.PermissionsToolConfig' diff --git a/allianceauth/permissions_tool/apps.py b/allianceauth/permissions_tool/apps.py new file mode 100644 index 00000000..39c80576 --- /dev/null +++ b/allianceauth/permissions_tool/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class PermissionsToolConfig(AppConfig): + name = 'allianceauth.permissions_tool' + label = 'permissions_tool' + diff --git a/permissions_tool/auth_hooks.py b/allianceauth/permissions_tool/auth_hooks.py similarity index 86% rename from permissions_tool/auth_hooks.py rename to allianceauth/permissions_tool/auth_hooks.py index 421bdc9d..5a061e59 100644 --- a/permissions_tool/auth_hooks.py +++ b/allianceauth/permissions_tool/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from permissions_tool import urls +from . import urls + +from allianceauth import hooks +from allianceauth.services.hooks import MenuItemHook, UrlHook class PermissionsTool(MenuItemHook): diff --git a/permissions_tool/migrations/0001_initial.py b/allianceauth/permissions_tool/migrations/0001_initial.py similarity index 100% rename from permissions_tool/migrations/0001_initial.py rename to allianceauth/permissions_tool/migrations/0001_initial.py diff --git a/optimer/migrations/__init__.py b/allianceauth/permissions_tool/migrations/__init__.py similarity index 100% rename from optimer/migrations/__init__.py rename to allianceauth/permissions_tool/migrations/__init__.py diff --git a/permissions_tool/models.py b/allianceauth/permissions_tool/models.py similarity index 100% rename from permissions_tool/models.py rename to allianceauth/permissions_tool/models.py diff --git a/permissions_tool/templates/permissions_tool/audit.html b/allianceauth/permissions_tool/templates/permissions_tool/audit.html similarity index 100% rename from permissions_tool/templates/permissions_tool/audit.html rename to allianceauth/permissions_tool/templates/permissions_tool/audit.html diff --git a/permissions_tool/templates/permissions_tool/audit_row.html b/allianceauth/permissions_tool/templates/permissions_tool/audit_row.html similarity index 100% rename from permissions_tool/templates/permissions_tool/audit_row.html rename to allianceauth/permissions_tool/templates/permissions_tool/audit_row.html diff --git a/permissions_tool/templates/permissions_tool/audit_state_row.html b/allianceauth/permissions_tool/templates/permissions_tool/audit_state_row.html similarity index 100% rename from permissions_tool/templates/permissions_tool/audit_state_row.html rename to allianceauth/permissions_tool/templates/permissions_tool/audit_state_row.html diff --git a/permissions_tool/templates/permissions_tool/overview.html b/allianceauth/permissions_tool/templates/permissions_tool/overview.html similarity index 100% rename from permissions_tool/templates/permissions_tool/overview.html rename to allianceauth/permissions_tool/templates/permissions_tool/overview.html diff --git a/permissions_tool/tests.py b/allianceauth/permissions_tool/tests.py similarity index 93% rename from permissions_tool/tests.py rename to allianceauth/permissions_tool/tests.py index 58af5c8b..ae4da6c5 100644 --- a/permissions_tool/tests.py +++ b/allianceauth/permissions_tool/tests.py @@ -1,19 +1,10 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase from django import urls from django.contrib.auth.models import Group, Permission -from alliance_auth.tests.auth_utils import AuthUtils - -import six +from allianceauth.tests.auth_utils import AuthUtils class PermissionsToolViewsTestCase(TestCase): @@ -50,9 +41,7 @@ class PermissionsToolViewsTestCase(TestCase): self.client.login(username=self.member.username, password='password') response = self.client.get(urls.reverse('permissions_tool:overview')) - response_content = response.content - if six.PY3: - response_content = str(response_content, encoding='utf8') + response_content = str(response.content, encoding='utf8') self.assertInHTML( '
  • Permissions Audit
  • ', diff --git a/permissions_tool/urls.py b/allianceauth/permissions_tool/urls.py similarity index 87% rename from permissions_tool/urls.py rename to allianceauth/permissions_tool/urls.py index 115c3af8..faa8bdd1 100644 --- a/permissions_tool/urls.py +++ b/allianceauth/permissions_tool/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url from . import views diff --git a/permissions_tool/views.py b/allianceauth/permissions_tool/views.py similarity index 96% rename from permissions_tool/views.py rename to allianceauth/permissions_tool/views.py index c9d4c26d..4858c3ac 100644 --- a/permissions_tool/views.py +++ b/allianceauth/permissions_tool/views.py @@ -1,11 +1,11 @@ -from __future__ import unicode_literals +import logging + from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.models import Permission, User -from django.shortcuts import render, get_object_or_404 from django.db.models import Count -from authentication.models import UserProfile +from django.shortcuts import render, get_object_or_404 -import logging +from allianceauth.authentication.models import UserProfile logger = logging.getLogger(__name__) diff --git a/allianceauth/services/__init__.py b/allianceauth/services/__init__.py new file mode 100644 index 00000000..41e459ec --- /dev/null +++ b/allianceauth/services/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.apps.ServicesConfig' diff --git a/allianceauth/services/apps.py b/allianceauth/services/apps.py new file mode 100644 index 00000000..d120c56b --- /dev/null +++ b/allianceauth/services/apps.py @@ -0,0 +1,9 @@ +from django.apps import AppConfig + + +class ServicesConfig(AppConfig): + name = 'allianceauth.services' + label = 'services' + + def ready(self): + pass \ No newline at end of file diff --git a/services/auth_hooks.py b/allianceauth/services/auth_hooks.py similarity index 82% rename from services/auth_hooks.py rename to allianceauth/services/auth_hooks.py index b2b05e2d..1b888d5b 100644 --- a/services/auth_hooks.py +++ b/allianceauth/services/auth_hooks.py @@ -1,6 +1,6 @@ -from services.hooks import MenuItemHook -from alliance_auth import hooks -from services.hooks import ServicesHook +from allianceauth import hooks +from .hooks import MenuItemHook +from .hooks import ServicesHook class Services(MenuItemHook): diff --git a/services/context_processors.py b/allianceauth/services/context_processors.py similarity index 94% rename from services/context_processors.py rename to allianceauth/services/context_processors.py index 31a8e2d4..a87de060 100644 --- a/services/context_processors.py +++ b/allianceauth/services/context_processors.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf import settings from django.utils import timezone diff --git a/services/forms.py b/allianceauth/services/forms.py similarity index 97% rename from services/forms.py rename to allianceauth/services/forms.py index c3aa5113..99f35ea3 100644 --- a/services/forms.py +++ b/allianceauth/services/forms.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/services/hooks.py b/allianceauth/services/hooks.py similarity index 97% rename from services/hooks.py rename to allianceauth/services/hooks.py index 618167e9..d5cd35ec 100644 --- a/services/hooks.py +++ b/allianceauth/services/hooks.py @@ -1,8 +1,7 @@ -from __future__ import unicode_literals - -from django.template.loader import render_to_string from django.conf.urls import include, url -from alliance_auth.hooks import get_hooks +from django.template.loader import render_to_string + +from allianceauth.hooks import get_hooks class ServicesHook: diff --git a/permissions_tool/__init__.py b/allianceauth/services/management/__init__.py similarity index 100% rename from permissions_tool/__init__.py rename to allianceauth/services/management/__init__.py diff --git a/permissions_tool/migrations/__init__.py b/allianceauth/services/management/commands/__init__.py similarity index 100% rename from permissions_tool/migrations/__init__.py rename to allianceauth/services/management/commands/__init__.py diff --git a/services/management/commands/verify_service_accounts.py b/allianceauth/services/management/commands/verify_service_accounts.py similarity index 87% rename from services/management/commands/verify_service_accounts.py rename to allianceauth/services/management/commands/verify_service_accounts.py index 7855e605..ba53c80a 100644 --- a/services/management/commands/verify_service_accounts.py +++ b/allianceauth/services/management/commands/verify_service_accounts.py @@ -1,6 +1,7 @@ -from django.core.management.base import BaseCommand from django.contrib.auth.models import User -from services.tasks import validate_services +from django.core.management.base import BaseCommand + +from allianceauth.services.tasks import validate_services class Command(BaseCommand): diff --git a/services/migrations/0001_initial.py b/allianceauth/services/migrations/0001_initial.py similarity index 100% rename from services/migrations/0001_initial.py rename to allianceauth/services/migrations/0001_initial.py diff --git a/services/migrations/0002_auto_20161016_0135.py b/allianceauth/services/migrations/0002_auto_20161016_0135.py similarity index 100% rename from services/migrations/0002_auto_20161016_0135.py rename to allianceauth/services/migrations/0002_auto_20161016_0135.py diff --git a/services/migrations/0003_delete_groupcache.py b/allianceauth/services/migrations/0003_delete_groupcache.py similarity index 100% rename from services/migrations/0003_delete_groupcache.py rename to allianceauth/services/migrations/0003_delete_groupcache.py diff --git a/services/management/__init__.py b/allianceauth/services/migrations/__init__.py similarity index 100% rename from services/management/__init__.py rename to allianceauth/services/migrations/__init__.py diff --git a/services/management/commands/__init__.py b/allianceauth/services/models.py similarity index 100% rename from services/management/commands/__init__.py rename to allianceauth/services/models.py diff --git a/services/migrations/__init__.py b/allianceauth/services/modules/__init__.py similarity index 100% rename from services/migrations/__init__.py rename to allianceauth/services/modules/__init__.py diff --git a/allianceauth/services/modules/discord/__init__.py b/allianceauth/services/modules/discord/__init__.py new file mode 100644 index 00000000..1fe95445 --- /dev/null +++ b/allianceauth/services/modules/discord/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.discord.apps.DiscordServiceConfig' \ No newline at end of file diff --git a/services/modules/discord/admin.py b/allianceauth/services/modules/discord/admin.py similarity index 86% rename from services/modules/discord/admin.py rename to allianceauth/services/modules/discord/admin.py index 51d0c0cf..1f47945d 100644 --- a/services/modules/discord/admin.py +++ b/allianceauth/services/modules/discord/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import DiscordUser diff --git a/services/modules/discord/apps.py b/allianceauth/services/modules/discord/apps.py similarity index 50% rename from services/modules/discord/apps.py rename to allianceauth/services/modules/discord/apps.py index 2d0e2667..ac2c2e23 100644 --- a/services/modules/discord/apps.py +++ b/allianceauth/services/modules/discord/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class DiscordServiceConfig(AppConfig): - name = 'discord' + name = 'allianceauth.services.modules.discord' + label = 'discord' diff --git a/services/modules/discord/auth_hooks.py b/allianceauth/services/modules/discord/auth_hooks.py similarity index 94% rename from services/modules/discord/auth_hooks.py rename to allianceauth/services/modules/discord/auth_hooks.py index 7b034698..a863b620 100644 --- a/services/modules/discord/auth_hooks.py +++ b/allianceauth/services/modules/discord/auth_hooks.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals - import logging from django.template.loader import render_to_string -from alliance_auth import hooks -from services.hooks import ServicesHook +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import DiscordTasks from .urls import urlpatterns diff --git a/services/modules/discord/manager.py b/allianceauth/services/modules/discord/manager.py similarity index 99% rename from services/modules/discord/manager.py rename to allianceauth/services/modules/discord/manager.py index 31014643..9d497d04 100644 --- a/services/modules/discord/manager.py +++ b/allianceauth/services/modules/discord/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import requests import json import re diff --git a/services/modules/discord/migrations/0001_initial.py b/allianceauth/services/modules/discord/migrations/0001_initial.py similarity index 100% rename from services/modules/discord/migrations/0001_initial.py rename to allianceauth/services/modules/discord/migrations/0001_initial.py diff --git a/services/modules/discord/migrations/0002_service_permissions.py b/allianceauth/services/modules/discord/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/discord/migrations/0002_service_permissions.py rename to allianceauth/services/modules/discord/migrations/0002_service_permissions.py diff --git a/services/modules/__init__.py b/allianceauth/services/modules/discord/migrations/__init__.py similarity index 100% rename from services/modules/__init__.py rename to allianceauth/services/modules/discord/migrations/__init__.py diff --git a/services/modules/discord/models.py b/allianceauth/services/modules/discord/models.py similarity index 80% rename from services/modules/discord/models.py rename to allianceauth/services/modules/discord/models.py index 5bcd4ef5..534ba149 100644 --- a/services/modules/discord/models.py +++ b/allianceauth/services/modules/discord/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class DiscordUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/discord/tasks.py b/allianceauth/services/modules/discord/tasks.py similarity index 96% rename from services/modules/discord/tasks.py rename to allianceauth/services/modules/discord/tasks.py index 880e5301..e1b03034 100644 --- a/services/modules/discord/tasks.py +++ b/allianceauth/services/modules/discord/tasks.py @@ -1,13 +1,12 @@ -from __future__ import unicode_literals - import logging -from alliance_auth.celeryapp import app from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify -from services.modules.discord.manager import DiscordOAuthManager, DiscordApiBackoff +from allianceauth.notifications import notify + +from allianceauth.celeryapp import app +from .manager import DiscordOAuthManager, DiscordApiBackoff from .models import DiscordUser logger = logging.getLogger(__name__) diff --git a/services/modules/discord/templates/registered/discord_service_ctrl.html b/allianceauth/services/modules/discord/templates/registered/discord_service_ctrl.html similarity index 100% rename from services/modules/discord/templates/registered/discord_service_ctrl.html rename to allianceauth/services/modules/discord/templates/registered/discord_service_ctrl.html diff --git a/services/modules/discord/tests.py b/allianceauth/services/modules/discord/tests.py similarity index 98% rename from services/modules/discord/tests.py rename to allianceauth/services/modules/discord/tests.py index f0737202..a93dc6ea 100644 --- a/services/modules/discord/tests.py +++ b/allianceauth/services/modules/discord/tests.py @@ -1,17 +1,10 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist from django.conf import settings -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import DiscordService from .models import DiscordUser @@ -21,7 +14,7 @@ from .manager import DiscordOAuthManager import requests_mock import datetime -MODULE_PATH = 'services.modules.discord' +MODULE_PATH = 'allianceauth.services.modules.discord' DEFAULT_AUTH_GROUP = 'Member' @@ -263,7 +256,7 @@ class DiscordManagerTestCase(TestCase): headers = {'accept': 'application/json', 'authorization': 'Bearer accesstoken'} m.register_uri('POST', - manager.DISCORD_URL + '/invites/'+str(settings.DISCORD_INVITE_CODE), + manager.DISCORD_URL + '/invites/' + str(settings.DISCORD_INVITE_CODE), request_headers=headers, text='{}') @@ -331,7 +324,6 @@ class DiscordManagerTestCase(TestCase): @requests_mock.Mocker() def test_update_nickname(self, m): from . import manager - import json # Arrange headers = {'content-type': 'application/json', 'authorization': 'Bot ' + settings.DISCORD_BOT_TOKEN} diff --git a/services/modules/discord/urls.py b/allianceauth/services/modules/discord/urls.py similarity index 93% rename from services/modules/discord/urls.py rename to allianceauth/services/modules/discord/urls.py index 17862c89..af324c73 100644 --- a/services/modules/discord/urls.py +++ b/allianceauth/services/modules/discord/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/discord/views.py b/allianceauth/services/modules/discord/views.py similarity index 97% rename from services/modules/discord/views.py rename to allianceauth/services/modules/discord/views.py index 5a907071..9b5fc1bb 100644 --- a/services/modules/discord/views.py +++ b/allianceauth/services/modules/discord/views.py @@ -1,17 +1,14 @@ -from __future__ import unicode_literals - import logging from django.contrib import messages from django.contrib.auth.decorators import login_required -from django.contrib.auth.decorators import user_passes_test from django.contrib.auth.decorators import permission_required +from django.contrib.auth.decorators import user_passes_test from django.shortcuts import redirect +from allianceauth.services.views import superuser_test from .manager import DiscordOAuthManager from .tasks import DiscordTasks -from services.views import superuser_test - logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/discourse/__init__.py b/allianceauth/services/modules/discourse/__init__.py new file mode 100644 index 00000000..8a08530f --- /dev/null +++ b/allianceauth/services/modules/discourse/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.discourse.apps.DiscourseServiceConfig' \ No newline at end of file diff --git a/services/modules/discourse/admin.py b/allianceauth/services/modules/discourse/admin.py similarity index 86% rename from services/modules/discourse/admin.py rename to allianceauth/services/modules/discourse/admin.py index 81240d4a..a6ad60c7 100644 --- a/services/modules/discourse/admin.py +++ b/allianceauth/services/modules/discourse/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import DiscourseUser diff --git a/services/modules/discourse/apps.py b/allianceauth/services/modules/discourse/apps.py similarity index 50% rename from services/modules/discourse/apps.py rename to allianceauth/services/modules/discourse/apps.py index b5fc3ab7..97574c28 100644 --- a/services/modules/discourse/apps.py +++ b/allianceauth/services/modules/discourse/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class DiscourseServiceConfig(AppConfig): - name = 'discourse' + name = 'allianceauth.services.modules.discourse' + label = 'discourse' diff --git a/services/modules/discourse/auth_hooks.py b/allianceauth/services/modules/discourse/auth_hooks.py similarity index 89% rename from services/modules/discourse/auth_hooks.py rename to allianceauth/services/modules/discourse/auth_hooks.py index cde66da4..30e40471 100644 --- a/services/modules/discourse/auth_hooks.py +++ b/allianceauth/services/modules/discourse/auth_hooks.py @@ -1,16 +1,11 @@ -from __future__ import unicode_literals +import logging -from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks -from eveonline.managers import EveManager - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import DiscourseTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/discourse/manager.py b/allianceauth/services/modules/discourse/manager.py similarity index 99% rename from services/modules/discourse/manager.py rename to allianceauth/services/modules/discourse/manager.py index 2f4e73c1..40195b55 100644 --- a/services/modules/discourse/manager.py +++ b/allianceauth/services/modules/discourse/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import logging import requests import re diff --git a/services/modules/discourse/migrations/0001_initial.py b/allianceauth/services/modules/discourse/migrations/0001_initial.py similarity index 100% rename from services/modules/discourse/migrations/0001_initial.py rename to allianceauth/services/modules/discourse/migrations/0001_initial.py diff --git a/services/modules/discourse/migrations/0002_service_permissions.py b/allianceauth/services/modules/discourse/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/discourse/migrations/0002_service_permissions.py rename to allianceauth/services/modules/discourse/migrations/0002_service_permissions.py diff --git a/services/modules/discord/__init__.py b/allianceauth/services/modules/discourse/migrations/__init__.py similarity index 100% rename from services/modules/discord/__init__.py rename to allianceauth/services/modules/discourse/migrations/__init__.py diff --git a/services/modules/discourse/models.py b/allianceauth/services/modules/discourse/models.py similarity index 80% rename from services/modules/discourse/models.py rename to allianceauth/services/modules/discourse/models.py index 9b72ea90..f4b2b871 100644 --- a/services/modules/discourse/models.py +++ b/allianceauth/services/modules/discourse/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class DiscourseUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/discourse/tasks.py b/allianceauth/services/modules/discourse/tasks.py similarity index 94% rename from services/modules/discourse/tasks.py rename to allianceauth/services/modules/discourse/tasks.py index 94947f3c..bdfa14ce 100644 --- a/services/modules/discourse/tasks.py +++ b/allianceauth/services/modules/discourse/tasks.py @@ -1,15 +1,13 @@ -from __future__ import unicode_literals +import logging -from alliance_auth.celeryapp import app from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import DiscourseManager from .models import DiscourseUser -import logging - logger = logging.getLogger(__name__) diff --git a/services/modules/discourse/templates/registered/discourse_service_ctrl.html b/allianceauth/services/modules/discourse/templates/registered/discourse_service_ctrl.html similarity index 100% rename from services/modules/discourse/templates/registered/discourse_service_ctrl.html rename to allianceauth/services/modules/discourse/templates/registered/discourse_service_ctrl.html diff --git a/services/modules/discourse/tests.py b/allianceauth/services/modules/discourse/tests.py similarity index 95% rename from services/modules/discourse/tests.py rename to allianceauth/services/modules/discourse/tests.py index 9f2c1f53..8944a1ca 100644 --- a/services/modules/discourse/tests.py +++ b/allianceauth/services/modules/discourse/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist from django.conf import settings -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import DiscourseService from .models import DiscourseUser from .tasks import DiscourseTasks -MODULE_PATH = 'services.modules.discourse' +MODULE_PATH = 'allianceauth.services.modules.discourse' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/discourse/urls.py b/allianceauth/services/modules/discourse/urls.py similarity index 81% rename from services/modules/discourse/urls.py rename to allianceauth/services/modules/discourse/urls.py index cf4154cb..207bedc4 100644 --- a/services/modules/discourse/urls.py +++ b/allianceauth/services/modules/discourse/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url from . import views diff --git a/services/modules/discourse/views.py b/allianceauth/services/modules/discourse/views.py similarity index 98% rename from services/modules/discourse/views.py rename to allianceauth/services/modules/discourse/views.py index 7e9034c3..594c5bbf 100644 --- a/services/modules/discourse/views.py +++ b/allianceauth/services/modules/discourse/views.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django.conf import settings from django.contrib import messages from django.contrib.auth.decorators import login_required diff --git a/allianceauth/services/modules/example/__init__.py b/allianceauth/services/modules/example/__init__.py new file mode 100644 index 00000000..06d7ccbe --- /dev/null +++ b/allianceauth/services/modules/example/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.example.apps.ExampleServiceConfig' diff --git a/allianceauth/services/modules/example/apps.py b/allianceauth/services/modules/example/apps.py new file mode 100644 index 00000000..611e3c30 --- /dev/null +++ b/allianceauth/services/modules/example/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class ExampleServiceConfig(AppConfig): + name = 'allianceauth.services.modules.example' + label = 'example_service' diff --git a/services/modules/example/auth_hooks.py b/allianceauth/services/modules/example/auth_hooks.py similarity index 91% rename from services/modules/example/auth_hooks.py rename to allianceauth/services/modules/example/auth_hooks.py index fecdecf7..d81d9075 100644 --- a/services/modules/example/auth_hooks.py +++ b/allianceauth/services/modules/example/auth_hooks.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals - from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .urls import urlpatterns diff --git a/services/modules/example/models.py b/allianceauth/services/modules/example/models.py similarity index 75% rename from services/modules/example/models.py rename to allianceauth/services/modules/example/models.py index 692f3152..c8c18dd1 100644 --- a/services/modules/example/models.py +++ b/allianceauth/services/modules/example/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class ExampleUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/example/urls.py b/allianceauth/services/modules/example/urls.py similarity index 79% rename from services/modules/example/urls.py rename to allianceauth/services/modules/example/urls.py index 5c895021..3a387d4f 100644 --- a/services/modules/example/urls.py +++ b/allianceauth/services/modules/example/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include module_urls = [ diff --git a/services/modules/example/views.py b/allianceauth/services/modules/example/views.py similarity index 100% rename from services/modules/example/views.py rename to allianceauth/services/modules/example/views.py diff --git a/allianceauth/services/modules/ipboard/__init__.py b/allianceauth/services/modules/ipboard/__init__.py new file mode 100644 index 00000000..2c42569d --- /dev/null +++ b/allianceauth/services/modules/ipboard/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.ipboard.apps.IpboardServiceConfig' diff --git a/services/modules/ipboard/admin.py b/allianceauth/services/modules/ipboard/admin.py similarity index 86% rename from services/modules/ipboard/admin.py rename to allianceauth/services/modules/ipboard/admin.py index 9351245c..dce5ec2b 100644 --- a/services/modules/ipboard/admin.py +++ b/allianceauth/services/modules/ipboard/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import IpboardUser diff --git a/services/modules/ipboard/apps.py b/allianceauth/services/modules/ipboard/apps.py similarity index 50% rename from services/modules/ipboard/apps.py rename to allianceauth/services/modules/ipboard/apps.py index 6bad20bb..e8221127 100644 --- a/services/modules/ipboard/apps.py +++ b/allianceauth/services/modules/ipboard/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class IpboardServiceConfig(AppConfig): - name = 'ipboard' + name = 'allianceauth.services.modules.ipboard' + label = 'ipboard' diff --git a/services/modules/ipboard/auth_hooks.py b/allianceauth/services/modules/ipboard/auth_hooks.py similarity index 94% rename from services/modules/ipboard/auth_hooks.py rename to allianceauth/services/modules/ipboard/auth_hooks.py index 40164365..d85344d3 100644 --- a/services/modules/ipboard/auth_hooks.py +++ b/allianceauth/services/modules/ipboard/auth_hooks.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals +import logging from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import IpboardTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/ipboard/manager.py b/allianceauth/services/modules/ipboard/manager.py similarity index 99% rename from services/modules/ipboard/manager.py rename to allianceauth/services/modules/ipboard/manager.py index ecc59fdd..2b9d6719 100755 --- a/services/modules/ipboard/manager.py +++ b/allianceauth/services/modules/ipboard/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string import re diff --git a/services/modules/ipboard/migrations/0001_initial.py b/allianceauth/services/modules/ipboard/migrations/0001_initial.py similarity index 100% rename from services/modules/ipboard/migrations/0001_initial.py rename to allianceauth/services/modules/ipboard/migrations/0001_initial.py diff --git a/services/modules/ipboard/migrations/0002_service_permissions.py b/allianceauth/services/modules/ipboard/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/ipboard/migrations/0002_service_permissions.py rename to allianceauth/services/modules/ipboard/migrations/0002_service_permissions.py diff --git a/services/modules/discord/migrations/__init__.py b/allianceauth/services/modules/ipboard/migrations/__init__.py similarity index 100% rename from services/modules/discord/migrations/__init__.py rename to allianceauth/services/modules/ipboard/migrations/__init__.py diff --git a/services/modules/ipboard/models.py b/allianceauth/services/modules/ipboard/models.py similarity index 80% rename from services/modules/ipboard/models.py rename to allianceauth/services/modules/ipboard/models.py index 456ddb18..1a9df670 100644 --- a/services/modules/ipboard/models.py +++ b/allianceauth/services/modules/ipboard/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class IpboardUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/ipboard/tasks.py b/allianceauth/services/modules/ipboard/tasks.py similarity index 93% rename from services/modules/ipboard/tasks.py rename to allianceauth/services/modules/ipboard/tasks.py index 1d31681a..10d81f1f 100644 --- a/services/modules/ipboard/tasks.py +++ b/allianceauth/services/modules/ipboard/tasks.py @@ -1,16 +1,13 @@ -from __future__ import unicode_literals +import logging -from alliance_auth.celeryapp import app -from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import IPBoardManager from .models import IpboardUser -import logging - logger = logging.getLogger(__name__) diff --git a/services/modules/ipboard/tests.py b/allianceauth/services/modules/ipboard/tests.py similarity index 97% rename from services/modules/ipboard/tests.py rename to allianceauth/services/modules/ipboard/tests.py index ae667b84..576c0e96 100644 --- a/services/modules/ipboard/tests.py +++ b/allianceauth/services/modules/ipboard/tests.py @@ -1,25 +1,18 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django.contrib.auth.models import User, Group, Permission from django import urls from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import IpboardService from .models import IpboardUser from .tasks import IpboardTasks from .manager import IPBoardManager -MODULE_PATH = 'services.modules.ipboard' +MODULE_PATH = 'allianceauth.services.modules.ipboard' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/ipboard/urls.py b/allianceauth/services/modules/ipboard/urls.py similarity index 93% rename from services/modules/ipboard/urls.py rename to allianceauth/services/modules/ipboard/urls.py index 78f1d70a..30ad4f81 100644 --- a/services/modules/ipboard/urls.py +++ b/allianceauth/services/modules/ipboard/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/ipboard/views.py b/allianceauth/services/modules/ipboard/views.py similarity index 97% rename from services/modules/ipboard/views.py rename to allianceauth/services/modules/ipboard/views.py index aa19f371..f531acf4 100644 --- a/services/modules/ipboard/views.py +++ b/allianceauth/services/modules/ipboard/views.py @@ -1,17 +1,13 @@ -from __future__ import unicode_literals +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from services.forms import ServicePasswordForm -from eveonline.managers import EveManager - +from allianceauth.services.forms import ServicePasswordForm from .manager import IPBoardManager -from .tasks import IpboardTasks from .models import IpboardUser - -import logging +from .tasks import IpboardTasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/ips4/__init__.py b/allianceauth/services/modules/ips4/__init__.py new file mode 100644 index 00000000..d2188107 --- /dev/null +++ b/allianceauth/services/modules/ips4/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.ips4.apps.Ips4ServiceConfig' diff --git a/services/modules/ips4/admin.py b/allianceauth/services/modules/ips4/admin.py similarity index 86% rename from services/modules/ips4/admin.py rename to allianceauth/services/modules/ips4/admin.py index bb25bea8..d70aeede 100644 --- a/services/modules/ips4/admin.py +++ b/allianceauth/services/modules/ips4/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import Ips4User diff --git a/services/modules/ips4/apps.py b/allianceauth/services/modules/ips4/apps.py similarity index 51% rename from services/modules/ips4/apps.py rename to allianceauth/services/modules/ips4/apps.py index 40047d31..b0c2f0c5 100644 --- a/services/modules/ips4/apps.py +++ b/allianceauth/services/modules/ips4/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class Ips4ServiceConfig(AppConfig): - name = 'ips4' + name = 'allianceauth.services.modules.ips4' + label = 'ips4' diff --git a/services/modules/ips4/auth_hooks.py b/allianceauth/services/modules/ips4/auth_hooks.py similarity index 92% rename from services/modules/ips4/auth_hooks.py rename to allianceauth/services/modules/ips4/auth_hooks.py index 561d883b..77bdfe88 100644 --- a/services/modules/ips4/auth_hooks.py +++ b/allianceauth/services/modules/ips4/auth_hooks.py @@ -1,13 +1,10 @@ -from __future__ import unicode_literals - from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import Ips4Tasks +from .urls import urlpatterns class Ips4Service(ServicesHook): diff --git a/services/modules/ips4/manager.py b/allianceauth/services/modules/ips4/manager.py similarity index 99% rename from services/modules/ips4/manager.py rename to allianceauth/services/modules/ips4/manager.py index ffbb8fc5..017864b8 100644 --- a/services/modules/ips4/manager.py +++ b/allianceauth/services/modules/ips4/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import logging import random import string diff --git a/services/modules/ips4/migrations/0001_initial.py b/allianceauth/services/modules/ips4/migrations/0001_initial.py similarity index 100% rename from services/modules/ips4/migrations/0001_initial.py rename to allianceauth/services/modules/ips4/migrations/0001_initial.py diff --git a/services/modules/ips4/migrations/0002_service_permissions.py b/allianceauth/services/modules/ips4/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/ips4/migrations/0002_service_permissions.py rename to allianceauth/services/modules/ips4/migrations/0002_service_permissions.py diff --git a/services/modules/discourse/__init__.py b/allianceauth/services/modules/ips4/migrations/__init__.py similarity index 100% rename from services/modules/discourse/__init__.py rename to allianceauth/services/modules/ips4/migrations/__init__.py diff --git a/services/modules/ips4/models.py b/allianceauth/services/modules/ips4/models.py similarity index 81% rename from services/modules/ips4/models.py rename to allianceauth/services/modules/ips4/models.py index a664a90f..407e243a 100644 --- a/services/modules/ips4/models.py +++ b/allianceauth/services/modules/ips4/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class Ips4User(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/ips4/tasks.py b/allianceauth/services/modules/ips4/tasks.py similarity index 93% rename from services/modules/ips4/tasks.py rename to allianceauth/services/modules/ips4/tasks.py index bd02a234..e452e0be 100644 --- a/services/modules/ips4/tasks.py +++ b/allianceauth/services/modules/ips4/tasks.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals, absolute_import - from django.conf import settings from django.core.exceptions import ObjectDoesNotExist diff --git a/services/modules/ips4/tests.py b/allianceauth/services/modules/ips4/tests.py similarity index 96% rename from services/modules/ips4/tests.py rename to allianceauth/services/modules/ips4/tests.py index 34bd104e..c9b24bf4 100644 --- a/services/modules/ips4/tests.py +++ b/allianceauth/services/modules/ips4/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import Ips4Service from .models import Ips4User from .tasks import Ips4Tasks -MODULE_PATH = 'services.modules.ips4' +MODULE_PATH = 'allianceauth.services.modules.ips4' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/ips4/urls.py b/allianceauth/services/modules/ips4/urls.py similarity index 92% rename from services/modules/ips4/urls.py rename to allianceauth/services/modules/ips4/urls.py index ac1a86a9..c6f5779d 100644 --- a/services/modules/ips4/urls.py +++ b/allianceauth/services/modules/ips4/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/ips4/views.py b/allianceauth/services/modules/ips4/views.py similarity index 98% rename from services/modules/ips4/views.py rename to allianceauth/services/modules/ips4/views.py index e9076245..3834a715 100644 --- a/services/modules/ips4/views.py +++ b/allianceauth/services/modules/ips4/views.py @@ -1,17 +1,14 @@ -from __future__ import unicode_literals +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from services.forms import ServicePasswordForm - +from allianceauth.services.forms import ServicePasswordForm from .manager import Ips4Manager from .models import Ips4User from .tasks import Ips4Tasks -import logging - logger = logging.getLogger(__name__) ACCESS_PERM = 'ips4.access_ips4' diff --git a/allianceauth/services/modules/market/__init__.py b/allianceauth/services/modules/market/__init__.py new file mode 100644 index 00000000..35e7d1ed --- /dev/null +++ b/allianceauth/services/modules/market/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.market.apps.MarketServiceConfig' diff --git a/services/modules/market/admin.py b/allianceauth/services/modules/market/admin.py similarity index 86% rename from services/modules/market/admin.py rename to allianceauth/services/modules/market/admin.py index 6b7ca8d2..75e0a9e9 100644 --- a/services/modules/market/admin.py +++ b/allianceauth/services/modules/market/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import MarketUser diff --git a/services/modules/market/apps.py b/allianceauth/services/modules/market/apps.py similarity index 51% rename from services/modules/market/apps.py rename to allianceauth/services/modules/market/apps.py index ff750cb7..13a77d38 100644 --- a/services/modules/market/apps.py +++ b/allianceauth/services/modules/market/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class MarketServiceConfig(AppConfig): - name = 'market' + name = 'allianceauth.services.modules.market' + label = 'market' diff --git a/services/modules/market/auth_hooks.py b/allianceauth/services/modules/market/auth_hooks.py similarity index 93% rename from services/modules/market/auth_hooks.py rename to allianceauth/services/modules/market/auth_hooks.py index 28fd6be5..19e115fa 100644 --- a/services/modules/market/auth_hooks.py +++ b/allianceauth/services/modules/market/auth_hooks.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals +import logging from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import MarketTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/market/manager.py b/allianceauth/services/modules/market/manager.py similarity index 97% rename from services/modules/market/manager.py rename to allianceauth/services/modules/market/manager.py index f2aabea4..bec87ca2 100644 --- a/services/modules/market/manager.py +++ b/allianceauth/services/modules/market/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import logging import random import string diff --git a/services/modules/market/migrations/0001_initial.py b/allianceauth/services/modules/market/migrations/0001_initial.py similarity index 100% rename from services/modules/market/migrations/0001_initial.py rename to allianceauth/services/modules/market/migrations/0001_initial.py diff --git a/services/modules/market/migrations/0002_service_permissions.py b/allianceauth/services/modules/market/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/market/migrations/0002_service_permissions.py rename to allianceauth/services/modules/market/migrations/0002_service_permissions.py diff --git a/services/modules/discourse/migrations/__init__.py b/allianceauth/services/modules/market/migrations/__init__.py similarity index 100% rename from services/modules/discourse/migrations/__init__.py rename to allianceauth/services/modules/market/migrations/__init__.py diff --git a/services/modules/market/models.py b/allianceauth/services/modules/market/models.py similarity index 80% rename from services/modules/market/models.py rename to allianceauth/services/modules/market/models.py index 945fb52e..a76157e9 100644 --- a/services/modules/market/models.py +++ b/allianceauth/services/modules/market/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class MarketUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/market/tasks.py b/allianceauth/services/modules/market/tasks.py similarity index 89% rename from services/modules/market/tasks.py rename to allianceauth/services/modules/market/tasks.py index 8fc029ec..597d4a07 100644 --- a/services/modules/market/tasks.py +++ b/allianceauth/services/modules/market/tasks.py @@ -1,15 +1,11 @@ -from __future__ import unicode_literals - -from django.conf import settings -from django.core.exceptions import ObjectDoesNotExist -from notifications import notify - -from .models import MarketUser -from .manager import MarketManager - - import logging +from django.core.exceptions import ObjectDoesNotExist + +from allianceauth.notifications import notify +from .manager import MarketManager +from .models import MarketUser + logger = logging.getLogger(__name__) diff --git a/services/modules/market/tests.py b/allianceauth/services/modules/market/tests.py similarity index 96% rename from services/modules/market/tests.py rename to allianceauth/services/modules/market/tests.py index 03a50275..3c9f5f63 100644 --- a/services/modules/market/tests.py +++ b/allianceauth/services/modules/market/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import MarketService from .models import MarketUser from .tasks import MarketTasks -MODULE_PATH = 'services.modules.market' +MODULE_PATH = 'allianceauth.services.modules.market' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/market/urls.py b/allianceauth/services/modules/market/urls.py similarity index 92% rename from services/modules/market/urls.py rename to allianceauth/services/modules/market/urls.py index 139418ae..175fccf0 100644 --- a/services/modules/market/urls.py +++ b/allianceauth/services/modules/market/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/market/views.py b/allianceauth/services/modules/market/views.py similarity index 97% rename from services/modules/market/views.py rename to allianceauth/services/modules/market/views.py index e7caa879..1b93ce41 100644 --- a/services/modules/market/views.py +++ b/allianceauth/services/modules/market/views.py @@ -1,18 +1,14 @@ -from __future__ import unicode_literals +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from services.forms import ServicePasswordForm -from eveonline.managers import EveManager - +from allianceauth.services.forms import ServicePasswordForm from .manager import MarketManager from .models import MarketUser from .tasks import MarketTasks -import logging - logger = logging.getLogger(__name__) ACCESS_PERM = 'market.access_market' diff --git a/allianceauth/services/modules/mumble/__init__.py b/allianceauth/services/modules/mumble/__init__.py new file mode 100644 index 00000000..0876670c --- /dev/null +++ b/allianceauth/services/modules/mumble/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.mumble.apps.MumbleServiceConfig' diff --git a/services/modules/mumble/admin.py b/allianceauth/services/modules/mumble/admin.py similarity index 90% rename from services/modules/mumble/admin.py rename to allianceauth/services/modules/mumble/admin.py index b475ef4b..387f7549 100644 --- a/services/modules/mumble/admin.py +++ b/allianceauth/services/modules/mumble/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import MumbleUser diff --git a/services/modules/mumble/apps.py b/allianceauth/services/modules/mumble/apps.py similarity index 51% rename from services/modules/mumble/apps.py rename to allianceauth/services/modules/mumble/apps.py index b104c642..33070346 100644 --- a/services/modules/mumble/apps.py +++ b/allianceauth/services/modules/mumble/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class MumbleServiceConfig(AppConfig): - name = 'mumble' + name = 'allianceauth.services.modules.mumble' + label = 'mumble' diff --git a/services/modules/mumble/auth_hooks.py b/allianceauth/services/modules/mumble/auth_hooks.py similarity index 94% rename from services/modules/mumble/auth_hooks.py rename to allianceauth/services/modules/mumble/auth_hooks.py index d2fcf307..0af2cf13 100644 --- a/services/modules/mumble/auth_hooks.py +++ b/allianceauth/services/modules/mumble/auth_hooks.py @@ -1,16 +1,15 @@ -from __future__ import unicode_literals -from django.template.loader import render_to_string -from django.conf import settings -from notifications import notify - -from alliance_auth import hooks -from services.hooks import ServicesHook -from .tasks import MumbleTasks -from .manager import MumbleManager -from .urls import urlpatterns - import logging +from django.conf import settings +from django.template.loader import render_to_string +from allianceauth.notifications import notify + +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook +from .manager import MumbleManager +from .tasks import MumbleTasks +from .urls import urlpatterns + logger = logging.getLogger(__name__) diff --git a/services/modules/mumble/manager.py b/allianceauth/services/modules/mumble/manager.py similarity index 99% rename from services/modules/mumble/manager.py rename to allianceauth/services/modules/mumble/manager.py index a7841599..faab95f5 100755 --- a/services/modules/mumble/manager.py +++ b/allianceauth/services/modules/mumble/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string from passlib.hash import bcrypt_sha256 diff --git a/services/modules/mumble/migrations/0001_initial.py b/allianceauth/services/modules/mumble/migrations/0001_initial.py similarity index 100% rename from services/modules/mumble/migrations/0001_initial.py rename to allianceauth/services/modules/mumble/migrations/0001_initial.py diff --git a/services/modules/mumble/migrations/0002_auto_20161212_0100.py b/allianceauth/services/modules/mumble/migrations/0002_auto_20161212_0100.py similarity index 100% rename from services/modules/mumble/migrations/0002_auto_20161212_0100.py rename to allianceauth/services/modules/mumble/migrations/0002_auto_20161212_0100.py diff --git a/services/modules/mumble/migrations/0003_mumbleuser_user.py b/allianceauth/services/modules/mumble/migrations/0003_mumbleuser_user.py similarity index 100% rename from services/modules/mumble/migrations/0003_mumbleuser_user.py rename to allianceauth/services/modules/mumble/migrations/0003_mumbleuser_user.py diff --git a/services/modules/mumble/migrations/0004_auto_20161214_1024.py b/allianceauth/services/modules/mumble/migrations/0004_auto_20161214_1024.py similarity index 100% rename from services/modules/mumble/migrations/0004_auto_20161214_1024.py rename to allianceauth/services/modules/mumble/migrations/0004_auto_20161214_1024.py diff --git a/services/modules/mumble/migrations/0005_mumbleuser_hashfn.py b/allianceauth/services/modules/mumble/migrations/0005_mumbleuser_hashfn.py similarity index 100% rename from services/modules/mumble/migrations/0005_mumbleuser_hashfn.py rename to allianceauth/services/modules/mumble/migrations/0005_mumbleuser_hashfn.py diff --git a/services/modules/mumble/migrations/0006_service_permissions.py b/allianceauth/services/modules/mumble/migrations/0006_service_permissions.py similarity index 100% rename from services/modules/mumble/migrations/0006_service_permissions.py rename to allianceauth/services/modules/mumble/migrations/0006_service_permissions.py diff --git a/services/modules/example/__init__.py b/allianceauth/services/modules/mumble/migrations/__init__.py similarity index 100% rename from services/modules/example/__init__.py rename to allianceauth/services/modules/mumble/migrations/__init__.py diff --git a/services/modules/mumble/models.py b/allianceauth/services/modules/mumble/models.py similarity index 80% rename from services/modules/mumble/models.py rename to allianceauth/services/modules/mumble/models.py index 160c4212..8df6be40 100644 --- a/services/modules/mumble/models.py +++ b/allianceauth/services/modules/mumble/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class MumbleUser(models.Model): user = models.OneToOneField('auth.User', related_name='mumble', null=True) username = models.CharField(max_length=254, unique=True) diff --git a/services/modules/mumble/tasks.py b/allianceauth/services/modules/mumble/tasks.py similarity index 94% rename from services/modules/mumble/tasks.py rename to allianceauth/services/modules/mumble/tasks.py index 46e9cad8..7a665322 100644 --- a/services/modules/mumble/tasks.py +++ b/allianceauth/services/modules/mumble/tasks.py @@ -1,14 +1,11 @@ -from __future__ import unicode_literals +import logging -from alliance_auth.celeryapp import app -from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from .models import MumbleUser +from allianceauth.celeryapp import app from .manager import MumbleManager - -import logging +from .models import MumbleUser logger = logging.getLogger(__name__) diff --git a/services/modules/mumble/templates/registered/mumble_service_ctrl.html b/allianceauth/services/modules/mumble/templates/registered/mumble_service_ctrl.html similarity index 100% rename from services/modules/mumble/templates/registered/mumble_service_ctrl.html rename to allianceauth/services/modules/mumble/templates/registered/mumble_service_ctrl.html diff --git a/services/modules/mumble/tests.py b/allianceauth/services/modules/mumble/tests.py similarity index 97% rename from services/modules/mumble/tests.py rename to allianceauth/services/modules/mumble/tests.py index 89ea8297..99526421 100644 --- a/services/modules/mumble/tests.py +++ b/allianceauth/services/modules/mumble/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import MumbleService from .models import MumbleUser from .tasks import MumbleTasks -MODULE_PATH = 'services.modules.mumble' +MODULE_PATH = 'allianceauth.services.modules.mumble' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/mumble/urls.py b/allianceauth/services/modules/mumble/urls.py similarity index 92% rename from services/modules/mumble/urls.py rename to allianceauth/services/modules/mumble/urls.py index ec22746f..06933069 100644 --- a/services/modules/mumble/urls.py +++ b/allianceauth/services/modules/mumble/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/mumble/views.py b/allianceauth/services/modules/mumble/views.py similarity index 97% rename from services/modules/mumble/views.py rename to allianceauth/services/modules/mumble/views.py index 5d2115be..47c1aa11 100644 --- a/services/modules/mumble/views.py +++ b/allianceauth/services/modules/mumble/views.py @@ -1,16 +1,13 @@ -from __future__ import unicode_literals +import logging + +from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from django.contrib import messages - -from eveonline.models import EveAllianceInfo -from services.forms import ServicePasswordForm +from allianceauth.services.forms import ServicePasswordForm from .manager import MumbleManager from .tasks import MumbleTasks -import logging - logger = logging.getLogger(__name__) ACCESS_PERM = 'mumble.access_mumble' diff --git a/allianceauth/services/modules/openfire/__init__.py b/allianceauth/services/modules/openfire/__init__.py new file mode 100644 index 00000000..b28d62f2 --- /dev/null +++ b/allianceauth/services/modules/openfire/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.openfire.apps.OpenfireServiceConfig' diff --git a/services/modules/openfire/admin.py b/allianceauth/services/modules/openfire/admin.py similarity index 86% rename from services/modules/openfire/admin.py rename to allianceauth/services/modules/openfire/admin.py index 44d88289..d2564634 100644 --- a/services/modules/openfire/admin.py +++ b/allianceauth/services/modules/openfire/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import OpenfireUser diff --git a/services/modules/openfire/apps.py b/allianceauth/services/modules/openfire/apps.py similarity index 50% rename from services/modules/openfire/apps.py rename to allianceauth/services/modules/openfire/apps.py index f47161c0..a6b6c46d 100644 --- a/services/modules/openfire/apps.py +++ b/allianceauth/services/modules/openfire/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class OpenfireServiceConfig(AppConfig): - name = 'openfire' + name = 'allianceauth.services.modules.openfire' + label = 'openfire' diff --git a/services/modules/openfire/auth_hooks.py b/allianceauth/services/modules/openfire/auth_hooks.py similarity index 96% rename from services/modules/openfire/auth_hooks.py rename to allianceauth/services/modules/openfire/auth_hooks.py index 9e99a85c..049dcd72 100644 --- a/services/modules/openfire/auth_hooks.py +++ b/allianceauth/services/modules/openfire/auth_hooks.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals +import logging from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook, MenuItemHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook, MenuItemHook from .tasks import OpenfireTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/openfire/forms.py b/allianceauth/services/modules/openfire/forms.py similarity index 86% rename from services/modules/openfire/forms.py rename to allianceauth/services/modules/openfire/forms.py index 593c710c..9fbe4cd6 100644 --- a/services/modules/openfire/forms.py +++ b/allianceauth/services/modules/openfire/forms.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/services/modules/openfire/manager.py b/allianceauth/services/modules/openfire/manager.py similarity index 97% rename from services/modules/openfire/manager.py rename to allianceauth/services/modules/openfire/manager.py index 9b8c82e6..465bc4e6 100755 --- a/services/modules/openfire/manager.py +++ b/allianceauth/services/modules/openfire/manager.py @@ -1,13 +1,7 @@ -from __future__ import unicode_literals -from django.utils import six import re import random import string -try: - from urlparse import urlparse -except ImportError: - # python 3 - from urllib.parse import urlparse +from urllib.parse import urlparse import sleekxmpp from django.conf import settings @@ -129,7 +123,7 @@ class OpenfireManager: remote_groups = [] if response: remote_groups = response['groupname'] - if isinstance(remote_groups, six.string_types): + if isinstance(remote_groups, str): remote_groups = [remote_groups] remote_groups = list(map(cls._sanitize_groupname, remote_groups)) logger.debug("Openfire user %s has groups %s" % (username, remote_groups)) diff --git a/services/modules/openfire/migrations/0001_initial.py b/allianceauth/services/modules/openfire/migrations/0001_initial.py similarity index 100% rename from services/modules/openfire/migrations/0001_initial.py rename to allianceauth/services/modules/openfire/migrations/0001_initial.py diff --git a/services/modules/openfire/migrations/0002_service_permissions.py b/allianceauth/services/modules/openfire/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/openfire/migrations/0002_service_permissions.py rename to allianceauth/services/modules/openfire/migrations/0002_service_permissions.py diff --git a/services/modules/ipboard/__init__.py b/allianceauth/services/modules/openfire/migrations/__init__.py similarity index 100% rename from services/modules/ipboard/__init__.py rename to allianceauth/services/modules/openfire/migrations/__init__.py diff --git a/services/modules/openfire/models.py b/allianceauth/services/modules/openfire/models.py similarity index 79% rename from services/modules/openfire/models.py rename to allianceauth/services/modules/openfire/models.py index 1e07bc98..15cb4253 100644 --- a/services/modules/openfire/models.py +++ b/allianceauth/services/modules/openfire/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class OpenfireUser(models.Model): user = models.OneToOneField('auth.User', primary_key=True, diff --git a/services/modules/openfire/tasks.py b/allianceauth/services/modules/openfire/tasks.py similarity index 91% rename from services/modules/openfire/tasks.py rename to allianceauth/services/modules/openfire/tasks.py index 632ced5e..acda91d3 100644 --- a/services/modules/openfire/tasks.py +++ b/allianceauth/services/modules/openfire/tasks.py @@ -1,15 +1,11 @@ -from __future__ import unicode_literals - import logging -from alliance_auth.celeryapp import app -from django.conf import settings -from django.core.exceptions import ObjectDoesNotExist from django.contrib.auth.models import User -from notifications import notify - -from services.modules.openfire.manager import OpenfireManager +from django.core.exceptions import ObjectDoesNotExist +from allianceauth.notifications import notify +from allianceauth.celeryapp import app +from allianceauth.services.modules.openfire.manager import OpenfireManager from .models import OpenfireUser logger = logging.getLogger(__name__) diff --git a/services/modules/openfire/tests.py b/allianceauth/services/modules/openfire/tests.py similarity index 97% rename from services/modules/openfire/tests.py rename to allianceauth/services/modules/openfire/tests.py index 811a60cd..05ae865f 100644 --- a/services/modules/openfire/tests.py +++ b/allianceauth/services/modules/openfire/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import OpenfireService from .models import OpenfireUser from .tasks import OpenfireTasks -MODULE_PATH = 'services.modules.openfire' +MODULE_PATH = 'allianceauth.services.modules.openfire' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/openfire/urls.py b/allianceauth/services/modules/openfire/urls.py similarity index 95% rename from services/modules/openfire/urls.py rename to allianceauth/services/modules/openfire/urls.py index bb63cbd6..86212275 100644 --- a/services/modules/openfire/urls.py +++ b/allianceauth/services/modules/openfire/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from django.conf.urls.i18n import i18n_patterns from django.utils.translation import ugettext_lazy as _ diff --git a/services/modules/openfire/views.py b/allianceauth/services/modules/openfire/views.py similarity index 98% rename from services/modules/openfire/views.py rename to allianceauth/services/modules/openfire/views.py index 2d98e1d2..58034cf3 100644 --- a/services/modules/openfire/views.py +++ b/allianceauth/services/modules/openfire/views.py @@ -1,18 +1,16 @@ -from __future__ import unicode_literals +import datetime +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.contrib.auth.models import Group from django.shortcuts import render, redirect -from services.forms import ServicePasswordForm -from .manager import OpenfireManager, PingBotException -from .tasks import OpenfireTasks + +from allianceauth.services.forms import ServicePasswordForm from .forms import JabberBroadcastForm +from .manager import OpenfireManager, PingBotException from .models import OpenfireUser - -import datetime - -import logging +from .tasks import OpenfireTasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/phpbb3/__init__.py b/allianceauth/services/modules/phpbb3/__init__.py new file mode 100644 index 00000000..3bf14b68 --- /dev/null +++ b/allianceauth/services/modules/phpbb3/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.phpbb3.apps.Phpbb3ServiceConfig' diff --git a/services/modules/phpbb3/admin.py b/allianceauth/services/modules/phpbb3/admin.py similarity index 86% rename from services/modules/phpbb3/admin.py rename to allianceauth/services/modules/phpbb3/admin.py index 97376ea5..210c9042 100644 --- a/services/modules/phpbb3/admin.py +++ b/allianceauth/services/modules/phpbb3/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import Phpbb3User diff --git a/services/modules/phpbb3/apps.py b/allianceauth/services/modules/phpbb3/apps.py similarity index 51% rename from services/modules/phpbb3/apps.py rename to allianceauth/services/modules/phpbb3/apps.py index ed8a7bb7..917753ea 100644 --- a/services/modules/phpbb3/apps.py +++ b/allianceauth/services/modules/phpbb3/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class Phpbb3ServiceConfig(AppConfig): - name = 'phpbb3' + name = 'allianceauth.services.modules.phpbb3' + label = 'phpbb3' diff --git a/services/modules/phpbb3/auth_hooks.py b/allianceauth/services/modules/phpbb3/auth_hooks.py similarity index 94% rename from services/modules/phpbb3/auth_hooks.py rename to allianceauth/services/modules/phpbb3/auth_hooks.py index 17c30f11..117c0d1f 100644 --- a/services/modules/phpbb3/auth_hooks.py +++ b/allianceauth/services/modules/phpbb3/auth_hooks.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals +import logging from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import Phpbb3Tasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/phpbb3/manager.py b/allianceauth/services/modules/phpbb3/manager.py similarity index 99% rename from services/modules/phpbb3/manager.py rename to allianceauth/services/modules/phpbb3/manager.py index 396b27e1..621de22e 100755 --- a/services/modules/phpbb3/manager.py +++ b/allianceauth/services/modules/phpbb3/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string import calendar diff --git a/services/modules/phpbb3/migrations/0001_initial.py b/allianceauth/services/modules/phpbb3/migrations/0001_initial.py similarity index 100% rename from services/modules/phpbb3/migrations/0001_initial.py rename to allianceauth/services/modules/phpbb3/migrations/0001_initial.py diff --git a/services/modules/phpbb3/migrations/0002_service_permissions.py b/allianceauth/services/modules/phpbb3/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/phpbb3/migrations/0002_service_permissions.py rename to allianceauth/services/modules/phpbb3/migrations/0002_service_permissions.py diff --git a/services/modules/ipboard/migrations/__init__.py b/allianceauth/services/modules/phpbb3/migrations/__init__.py similarity index 100% rename from services/modules/ipboard/migrations/__init__.py rename to allianceauth/services/modules/phpbb3/migrations/__init__.py diff --git a/services/modules/phpbb3/models.py b/allianceauth/services/modules/phpbb3/models.py similarity index 78% rename from services/modules/phpbb3/models.py rename to allianceauth/services/modules/phpbb3/models.py index d19f7ad7..a2de5917 100644 --- a/services/modules/phpbb3/models.py +++ b/allianceauth/services/modules/phpbb3/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class Phpbb3User(models.Model): user = models.OneToOneField('auth.User', primary_key=True, diff --git a/services/modules/phpbb3/tasks.py b/allianceauth/services/modules/phpbb3/tasks.py similarity index 93% rename from services/modules/phpbb3/tasks.py rename to allianceauth/services/modules/phpbb3/tasks.py index 126f239e..ee882c9a 100644 --- a/services/modules/phpbb3/tasks.py +++ b/allianceauth/services/modules/phpbb3/tasks.py @@ -1,16 +1,13 @@ -from __future__ import unicode_literals +import logging -from alliance_auth.celeryapp import app -from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import Phpbb3Manager from .models import Phpbb3User -import logging - logger = logging.getLogger(__name__) diff --git a/services/modules/phpbb3/tests.py b/allianceauth/services/modules/phpbb3/tests.py similarity index 97% rename from services/modules/phpbb3/tests.py rename to allianceauth/services/modules/phpbb3/tests.py index 5498be5d..f7d86976 100644 --- a/services/modules/phpbb3/tests.py +++ b/allianceauth/services/modules/phpbb3/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import Phpbb3Service from .models import Phpbb3User from .tasks import Phpbb3Tasks -MODULE_PATH = 'services.modules.phpbb3' +MODULE_PATH = 'allianceauth.services.modules.phpbb3' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/phpbb3/urls.py b/allianceauth/services/modules/phpbb3/urls.py similarity index 92% rename from services/modules/phpbb3/urls.py rename to allianceauth/services/modules/phpbb3/urls.py index a64f4cc1..431dde5d 100644 --- a/services/modules/phpbb3/urls.py +++ b/allianceauth/services/modules/phpbb3/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/phpbb3/views.py b/allianceauth/services/modules/phpbb3/views.py similarity index 98% rename from services/modules/phpbb3/views.py rename to allianceauth/services/modules/phpbb3/views.py index 39730d93..4aa0fca7 100644 --- a/services/modules/phpbb3/views.py +++ b/allianceauth/services/modules/phpbb3/views.py @@ -1,16 +1,13 @@ -from __future__ import unicode_literals +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from services.forms import ServicePasswordForm - +from allianceauth.services.forms import ServicePasswordForm from .manager import Phpbb3Manager -from .tasks import Phpbb3Tasks from .models import Phpbb3User - -import logging +from .tasks import Phpbb3Tasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/seat/__init__.py b/allianceauth/services/modules/seat/__init__.py new file mode 100644 index 00000000..eec64742 --- /dev/null +++ b/allianceauth/services/modules/seat/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.seat.apps.SeatServiceConfig' diff --git a/services/modules/seat/admin.py b/allianceauth/services/modules/seat/admin.py similarity index 85% rename from services/modules/seat/admin.py rename to allianceauth/services/modules/seat/admin.py index d02036e1..14640c9c 100644 --- a/services/modules/seat/admin.py +++ b/allianceauth/services/modules/seat/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import SeatUser diff --git a/services/modules/seat/apps.py b/allianceauth/services/modules/seat/apps.py similarity index 51% rename from services/modules/seat/apps.py rename to allianceauth/services/modules/seat/apps.py index 81e2261c..ad213736 100644 --- a/services/modules/seat/apps.py +++ b/allianceauth/services/modules/seat/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class SeatServiceConfig(AppConfig): - name = 'seat' + name = 'allianceauth.services.modules.seat' + label = 'seat' diff --git a/services/modules/seat/auth_hooks.py b/allianceauth/services/modules/seat/auth_hooks.py similarity index 94% rename from services/modules/seat/auth_hooks.py rename to allianceauth/services/modules/seat/auth_hooks.py index 55746ac9..d080bbaa 100644 --- a/services/modules/seat/auth_hooks.py +++ b/allianceauth/services/modules/seat/auth_hooks.py @@ -1,16 +1,13 @@ -from __future__ import unicode_literals - -from django.template.loader import render_to_string -from django.conf import settings - -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns -from .tasks import SeatTasks - import logging +from django.conf import settings +from django.template.loader import render_to_string + +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook +from .tasks import SeatTasks +from .urls import urlpatterns + logger = logging.getLogger(__name__) diff --git a/services/modules/seat/manager.py b/allianceauth/services/modules/seat/manager.py similarity index 98% rename from services/modules/seat/manager.py rename to allianceauth/services/modules/seat/manager.py index 115936c0..3f97d61d 100644 --- a/services/modules/seat/manager.py +++ b/allianceauth/services/modules/seat/manager.py @@ -1,16 +1,14 @@ -from __future__ import unicode_literals +import hashlib +import logging import random import string + import requests -import hashlib -from eveonline.managers import EveManager from django.conf import settings -from django.core.exceptions import ObjectDoesNotExist from django.core.cache import cache +from django.core.exceptions import ObjectDoesNotExist -from six import iteritems - -import logging +from allianceauth.eveonline.managers import EveManager logger = logging.getLogger(__name__) @@ -195,7 +193,7 @@ class SeatManager: if bool(seat_all_keys) and not user and getattr(settings, 'SEAT_PURGE_DELETED', False): # remove from SeAT keys that were removed from Auth - for key, key_user in iteritems(seat_all_keys): + for key, key_user in seat_all_keys.items(): # Remove the key only if it is an account or character key ret = cls.exec_request('key/{}'.format(key), 'get') logger.debug(ret) diff --git a/services/modules/seat/migrations/0001_initial.py b/allianceauth/services/modules/seat/migrations/0001_initial.py similarity index 100% rename from services/modules/seat/migrations/0001_initial.py rename to allianceauth/services/modules/seat/migrations/0001_initial.py diff --git a/services/modules/seat/migrations/0002_service_permissions.py b/allianceauth/services/modules/seat/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/seat/migrations/0002_service_permissions.py rename to allianceauth/services/modules/seat/migrations/0002_service_permissions.py diff --git a/services/modules/ips4/__init__.py b/allianceauth/services/modules/seat/migrations/__init__.py similarity index 100% rename from services/modules/ips4/__init__.py rename to allianceauth/services/modules/seat/migrations/__init__.py diff --git a/services/modules/seat/models.py b/allianceauth/services/modules/seat/models.py similarity index 79% rename from services/modules/seat/models.py rename to allianceauth/services/modules/seat/models.py index a325600d..54174e0f 100644 --- a/services/modules/seat/models.py +++ b/allianceauth/services/modules/seat/models.py @@ -1,10 +1,7 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.contrib.auth.models import User from django.db import models -@python_2_unicode_compatible class SeatUser(models.Model): user = models.OneToOneField(User, primary_key=True, diff --git a/services/modules/seat/tasks.py b/allianceauth/services/modules/seat/tasks.py similarity index 93% rename from services/modules/seat/tasks.py rename to allianceauth/services/modules/seat/tasks.py index 8781d939..3e4eace1 100644 --- a/services/modules/seat/tasks.py +++ b/allianceauth/services/modules/seat/tasks.py @@ -1,16 +1,12 @@ -from __future__ import unicode_literals +import logging from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from django.conf import settings -from notifications import notify -from alliance_auth.celeryapp import app - -from .models import SeatUser +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import SeatManager - -import logging +from .models import SeatUser logger = logging.getLogger(__name__) diff --git a/services/modules/seat/tests.py b/allianceauth/services/modules/seat/tests.py similarity index 97% rename from services/modules/seat/tests.py rename to allianceauth/services/modules/seat/tests.py index c4bf5407..60727bc5 100644 --- a/services/modules/seat/tests.py +++ b/allianceauth/services/modules/seat/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import SeatService from .models import SeatUser from .tasks import SeatTasks -MODULE_PATH = 'services.modules.seat' +MODULE_PATH = 'allianceauth.services.modules.seat' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/seat/urls.py b/allianceauth/services/modules/seat/urls.py similarity index 92% rename from services/modules/seat/urls.py rename to allianceauth/services/modules/seat/urls.py index fac5828d..768c22fd 100644 --- a/services/modules/seat/urls.py +++ b/allianceauth/services/modules/seat/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/seat/views.py b/allianceauth/services/modules/seat/views.py similarity index 98% rename from services/modules/seat/views.py rename to allianceauth/services/modules/seat/views.py index 200b2e03..0dde8d7b 100644 --- a/services/modules/seat/views.py +++ b/allianceauth/services/modules/seat/views.py @@ -1,18 +1,14 @@ -from __future__ import unicode_literals -from django.shortcuts import render, redirect -from django.contrib.auth.decorators import login_required, permission_required +import logging + from django.contrib import messages +from django.contrib.auth.decorators import login_required, permission_required +from django.shortcuts import render, redirect from django.utils.translation import ugettext_lazy as _ +from allianceauth.services.forms import ServicePasswordForm from .manager import SeatManager - -from eveonline.managers import EveManager - -from .tasks import SeatTasks from .models import SeatUser -from services.forms import ServicePasswordForm - -import logging +from .tasks import SeatTasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/smf/__init__.py b/allianceauth/services/modules/smf/__init__.py new file mode 100644 index 00000000..73b9e82f --- /dev/null +++ b/allianceauth/services/modules/smf/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.smf.apps.SmfServiceConfig' diff --git a/services/modules/smf/admin.py b/allianceauth/services/modules/smf/admin.py similarity index 85% rename from services/modules/smf/admin.py rename to allianceauth/services/modules/smf/admin.py index a4291319..6afdca04 100644 --- a/services/modules/smf/admin.py +++ b/allianceauth/services/modules/smf/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import SmfUser diff --git a/services/modules/smf/apps.py b/allianceauth/services/modules/smf/apps.py similarity index 52% rename from services/modules/smf/apps.py rename to allianceauth/services/modules/smf/apps.py index 66059295..cccae88a 100644 --- a/services/modules/smf/apps.py +++ b/allianceauth/services/modules/smf/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class SmfServiceConfig(AppConfig): - name = 'smf' + name = 'allianceauth.services.modules.smf' + label = 'smf' diff --git a/services/modules/smf/auth_hooks.py b/allianceauth/services/modules/smf/auth_hooks.py similarity index 94% rename from services/modules/smf/auth_hooks.py rename to allianceauth/services/modules/smf/auth_hooks.py index 47471326..48da4444 100644 --- a/services/modules/smf/auth_hooks.py +++ b/allianceauth/services/modules/smf/auth_hooks.py @@ -1,15 +1,12 @@ -from __future__ import unicode_literals +import logging from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import SmfTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/smf/manager.py b/allianceauth/services/modules/smf/manager.py similarity index 97% rename from services/modules/smf/manager.py rename to allianceauth/services/modules/smf/manager.py index 36679b46..f0816209 100644 --- a/services/modules/smf/manager.py +++ b/allianceauth/services/modules/smf/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string import calendar diff --git a/services/modules/smf/migrations/0001_initial.py b/allianceauth/services/modules/smf/migrations/0001_initial.py similarity index 100% rename from services/modules/smf/migrations/0001_initial.py rename to allianceauth/services/modules/smf/migrations/0001_initial.py diff --git a/services/modules/smf/migrations/0002_service_permissions.py b/allianceauth/services/modules/smf/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/smf/migrations/0002_service_permissions.py rename to allianceauth/services/modules/smf/migrations/0002_service_permissions.py diff --git a/services/modules/ips4/migrations/__init__.py b/allianceauth/services/modules/smf/migrations/__init__.py similarity index 100% rename from services/modules/ips4/migrations/__init__.py rename to allianceauth/services/modules/smf/migrations/__init__.py diff --git a/services/modules/smf/models.py b/allianceauth/services/modules/smf/models.py similarity index 78% rename from services/modules/smf/models.py rename to allianceauth/services/modules/smf/models.py index 1e05456f..381cd44f 100644 --- a/services/modules/smf/models.py +++ b/allianceauth/services/modules/smf/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class SmfUser(models.Model): user = models.OneToOneField('auth.User', primary_key=True, diff --git a/services/modules/smf/tasks.py b/allianceauth/services/modules/smf/tasks.py similarity index 93% rename from services/modules/smf/tasks.py rename to allianceauth/services/modules/smf/tasks.py index fceb905f..a164a3e4 100644 --- a/services/modules/smf/tasks.py +++ b/allianceauth/services/modules/smf/tasks.py @@ -1,13 +1,10 @@ -from __future__ import unicode_literals - import logging -from alliance_auth.celeryapp import app -from django.conf import settings from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import SmfManager from .models import SmfUser diff --git a/services/modules/smf/tests.py b/allianceauth/services/modules/smf/tests.py similarity index 97% rename from services/modules/smf/tests.py rename to allianceauth/services/modules/smf/tests.py index 12e02742..78b77009 100644 --- a/services/modules/smf/tests.py +++ b/allianceauth/services/modules/smf/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import SmfService from .models import SmfUser from .tasks import SmfTasks -MODULE_PATH = 'services.modules.smf' +MODULE_PATH = 'allianceauth.services.modules.smf' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/smf/urls.py b/allianceauth/services/modules/smf/urls.py similarity index 92% rename from services/modules/smf/urls.py rename to allianceauth/services/modules/smf/urls.py index 6fb2310e..41a0500d 100644 --- a/services/modules/smf/urls.py +++ b/allianceauth/services/modules/smf/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/smf/views.py b/allianceauth/services/modules/smf/views.py similarity index 97% rename from services/modules/smf/views.py rename to allianceauth/services/modules/smf/views.py index f2227773..22335d8a 100644 --- a/services/modules/smf/views.py +++ b/allianceauth/services/modules/smf/views.py @@ -1,17 +1,13 @@ -from __future__ import unicode_literals +import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from eveonline.managers import EveManager -from services.forms import ServicePasswordForm - +from allianceauth.services.forms import ServicePasswordForm from .manager import SmfManager -from .tasks import SmfTasks from .models import SmfUser - -import logging +from .tasks import SmfTasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/teamspeak3/__init__.py b/allianceauth/services/modules/teamspeak3/__init__.py new file mode 100644 index 00000000..e9c14dfa --- /dev/null +++ b/allianceauth/services/modules/teamspeak3/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.teamspeak3.apps.Teamspeak3ServiceConfig' diff --git a/services/modules/teamspeak3/admin.py b/allianceauth/services/modules/teamspeak3/admin.py similarity index 92% rename from services/modules/teamspeak3/admin.py rename to allianceauth/services/modules/teamspeak3/admin.py index 2ff77e24..446ff91b 100644 --- a/services/modules/teamspeak3/admin.py +++ b/allianceauth/services/modules/teamspeak3/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import AuthTS, Teamspeak3User diff --git a/services/modules/teamspeak3/apps.py b/allianceauth/services/modules/teamspeak3/apps.py similarity index 62% rename from services/modules/teamspeak3/apps.py rename to allianceauth/services/modules/teamspeak3/apps.py index 1d542597..f46e3c92 100644 --- a/services/modules/teamspeak3/apps.py +++ b/allianceauth/services/modules/teamspeak3/apps.py @@ -1,10 +1,9 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class Teamspeak3ServiceConfig(AppConfig): - name = 'teamspeak3' + name = 'allianceauth.services.modules.teamspeak3' + label = 'teamspeak3' def ready(self): from . import signals diff --git a/services/modules/teamspeak3/auth_hooks.py b/allianceauth/services/modules/teamspeak3/auth_hooks.py similarity index 92% rename from services/modules/teamspeak3/auth_hooks.py rename to allianceauth/services/modules/teamspeak3/auth_hooks.py index 0cb20a56..7d72c204 100644 --- a/services/modules/teamspeak3/auth_hooks.py +++ b/allianceauth/services/modules/teamspeak3/auth_hooks.py @@ -1,15 +1,11 @@ -from __future__ import unicode_literals +import logging -from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import Teamspeak3Tasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/teamspeak3/forms.py b/allianceauth/services/modules/teamspeak3/forms.py similarity index 92% rename from services/modules/teamspeak3/forms.py rename to allianceauth/services/modules/teamspeak3/forms.py index ec4366b7..8e41ca59 100644 --- a/services/modules/teamspeak3/forms.py +++ b/allianceauth/services/modules/teamspeak3/forms.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/services/modules/teamspeak3/manager.py b/allianceauth/services/modules/teamspeak3/manager.py similarity index 99% rename from services/modules/teamspeak3/manager.py rename to allianceauth/services/modules/teamspeak3/manager.py index 7a700526..a0da8587 100755 --- a/services/modules/teamspeak3/manager.py +++ b/allianceauth/services/modules/teamspeak3/manager.py @@ -1,10 +1,8 @@ -from __future__ import unicode_literals - import logging from django.conf import settings -from services.modules.teamspeak3.util.ts3 import TS3Server, TeamspeakError +from .util.ts3 import TS3Server, TeamspeakError from .models import TSgroup logger = logging.getLogger(__name__) diff --git a/services/modules/teamspeak3/migrations/0001_initial.py b/allianceauth/services/modules/teamspeak3/migrations/0001_initial.py similarity index 100% rename from services/modules/teamspeak3/migrations/0001_initial.py rename to allianceauth/services/modules/teamspeak3/migrations/0001_initial.py diff --git a/services/modules/teamspeak3/migrations/0002_auto_20161212_0133.py b/allianceauth/services/modules/teamspeak3/migrations/0002_auto_20161212_0133.py similarity index 100% rename from services/modules/teamspeak3/migrations/0002_auto_20161212_0133.py rename to allianceauth/services/modules/teamspeak3/migrations/0002_auto_20161212_0133.py diff --git a/services/modules/teamspeak3/migrations/0003_teamspeak3user.py b/allianceauth/services/modules/teamspeak3/migrations/0003_teamspeak3user.py similarity index 100% rename from services/modules/teamspeak3/migrations/0003_teamspeak3user.py rename to allianceauth/services/modules/teamspeak3/migrations/0003_teamspeak3user.py diff --git a/services/modules/teamspeak3/migrations/0004_service_permissions.py b/allianceauth/services/modules/teamspeak3/migrations/0004_service_permissions.py similarity index 100% rename from services/modules/teamspeak3/migrations/0004_service_permissions.py rename to allianceauth/services/modules/teamspeak3/migrations/0004_service_permissions.py diff --git a/services/modules/market/__init__.py b/allianceauth/services/modules/teamspeak3/migrations/__init__.py similarity index 100% rename from services/modules/market/__init__.py rename to allianceauth/services/modules/teamspeak3/migrations/__init__.py diff --git a/services/modules/teamspeak3/models.py b/allianceauth/services/modules/teamspeak3/models.py similarity index 85% rename from services/modules/teamspeak3/models.py rename to allianceauth/services/modules/teamspeak3/models.py index 17a3c9aa..0aa885f8 100644 --- a/services/modules/teamspeak3/models.py +++ b/allianceauth/services/modules/teamspeak3/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class Teamspeak3User(models.Model): user = models.OneToOneField('auth.User', primary_key=True, @@ -21,7 +18,6 @@ class Teamspeak3User(models.Model): ) -@python_2_unicode_compatible class TSgroup(models.Model): ts_group_id = models.IntegerField(primary_key=True) ts_group_name = models.CharField(max_length=30) @@ -33,7 +29,6 @@ class TSgroup(models.Model): return self.ts_group_name -@python_2_unicode_compatible class AuthTS(models.Model): auth_group = models.ForeignKey('auth.Group') ts_group = models.ManyToManyField(TSgroup) @@ -45,7 +40,6 @@ class AuthTS(models.Model): return self.auth_group.name -@python_2_unicode_compatible class UserTSgroup(models.Model): user = models.ForeignKey('auth.User') ts_group = models.ManyToManyField(TSgroup) diff --git a/services/modules/teamspeak3/signals.py b/allianceauth/services/modules/teamspeak3/signals.py similarity index 96% rename from services/modules/teamspeak3/signals.py rename to allianceauth/services/modules/teamspeak3/signals.py index ad8b4185..afe86e2d 100644 --- a/services/modules/teamspeak3/signals.py +++ b/allianceauth/services/modules/teamspeak3/signals.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import logging from django.db import transaction diff --git a/services/modules/teamspeak3/tasks.py b/allianceauth/services/modules/teamspeak3/tasks.py similarity index 96% rename from services/modules/teamspeak3/tasks.py rename to allianceauth/services/modules/teamspeak3/tasks.py index abadfde1..7528377a 100644 --- a/services/modules/teamspeak3/tasks.py +++ b/allianceauth/services/modules/teamspeak3/tasks.py @@ -1,15 +1,13 @@ -from __future__ import unicode_literals - import logging -from alliance_auth.celeryapp import app from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist -from notifications import notify -from .util.ts3 import TeamspeakError +from allianceauth.celeryapp import app +from allianceauth.notifications import notify from .manager import Teamspeak3Manager from .models import AuthTS, TSgroup, UserTSgroup, Teamspeak3User +from .util.ts3 import TeamspeakError logger = logging.getLogger(__name__) diff --git a/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html b/allianceauth/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html similarity index 100% rename from services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html rename to allianceauth/services/modules/teamspeak3/templates/registered/teamspeak3_service_ctrl.html diff --git a/services/modules/teamspeak3/tests.py b/allianceauth/services/modules/teamspeak3/tests.py similarity index 98% rename from services/modules/teamspeak3/tests.py rename to allianceauth/services/modules/teamspeak3/tests.py index 61bd9a2e..fbff98ec 100644 --- a/services/modules/teamspeak3/tests.py +++ b/allianceauth/services/modules/teamspeak3/tests.py @@ -1,11 +1,4 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls @@ -13,14 +6,14 @@ from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist from django.db.models import signals -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import Teamspeak3Service from .models import Teamspeak3User, AuthTS, TSgroup from .tasks import Teamspeak3Tasks from .signals import m2m_changed_authts_group, post_save_authts, post_delete_authts -MODULE_PATH = 'services.modules.teamspeak3' +MODULE_PATH = 'allianceauth.services.modules.teamspeak3' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/teamspeak3/urls.py b/allianceauth/services/modules/teamspeak3/urls.py similarity index 93% rename from services/modules/teamspeak3/urls.py rename to allianceauth/services/modules/teamspeak3/urls.py index c262bdab..bba50ddf 100644 --- a/services/modules/teamspeak3/urls.py +++ b/allianceauth/services/modules/teamspeak3/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/allianceauth/services/modules/teamspeak3/util/__init__.py b/allianceauth/services/modules/teamspeak3/util/__init__.py new file mode 100755 index 00000000..8fdaf87a --- /dev/null +++ b/allianceauth/services/modules/teamspeak3/util/__init__.py @@ -0,0 +1 @@ +__author__ = 'r4stl1n' diff --git a/services/modules/teamspeak3/util/ts3.py b/allianceauth/services/modules/teamspeak3/util/ts3.py similarity index 99% rename from services/modules/teamspeak3/util/ts3.py rename to allianceauth/services/modules/teamspeak3/util/ts3.py index 901dcc93..5c13f9a6 100755 --- a/services/modules/teamspeak3/util/ts3.py +++ b/allianceauth/services/modules/teamspeak3/util/ts3.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import telnetlib import logging diff --git a/services/modules/teamspeak3/views.py b/allianceauth/services/modules/teamspeak3/views.py similarity index 98% rename from services/modules/teamspeak3/views.py rename to allianceauth/services/modules/teamspeak3/views.py index a055fc5f..bdd698bf 100644 --- a/services/modules/teamspeak3/views.py +++ b/allianceauth/services/modules/teamspeak3/views.py @@ -4,11 +4,10 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from services.modules.teamspeak3.manager import Teamspeak3Manager - +from .manager import Teamspeak3Manager from .forms import TeamspeakJoinForm -from .tasks import Teamspeak3Tasks from .models import Teamspeak3User +from .tasks import Teamspeak3Tasks logger = logging.getLogger(__name__) diff --git a/allianceauth/services/modules/xenforo/__init__.py b/allianceauth/services/modules/xenforo/__init__.py new file mode 100644 index 00000000..dc9a52f2 --- /dev/null +++ b/allianceauth/services/modules/xenforo/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.services.modules.xenforo.apps.XenforoServiceConfig' diff --git a/services/modules/xenforo/admin.py b/allianceauth/services/modules/xenforo/admin.py similarity index 86% rename from services/modules/xenforo/admin.py rename to allianceauth/services/modules/xenforo/admin.py index e614fb9c..21321501 100644 --- a/services/modules/xenforo/admin.py +++ b/allianceauth/services/modules/xenforo/admin.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.contrib import admin from .models import XenforoUser diff --git a/services/modules/xenforo/apps.py b/allianceauth/services/modules/xenforo/apps.py similarity index 50% rename from services/modules/xenforo/apps.py rename to allianceauth/services/modules/xenforo/apps.py index cc5d2400..8cead725 100644 --- a/services/modules/xenforo/apps.py +++ b/allianceauth/services/modules/xenforo/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class XenforoServiceConfig(AppConfig): - name = 'xenforo' + name = 'allianceauth.services.modules.xenforo' + label = 'xenforo' diff --git a/services/modules/xenforo/auth_hooks.py b/allianceauth/services/modules/xenforo/auth_hooks.py similarity index 91% rename from services/modules/xenforo/auth_hooks.py rename to allianceauth/services/modules/xenforo/auth_hooks.py index 19d1347c..8b946459 100644 --- a/services/modules/xenforo/auth_hooks.py +++ b/allianceauth/services/modules/xenforo/auth_hooks.py @@ -1,15 +1,11 @@ -from __future__ import unicode_literals +import logging -from django.conf import settings from django.template.loader import render_to_string -from services.hooks import ServicesHook -from alliance_auth import hooks - -from .urls import urlpatterns +from allianceauth import hooks +from allianceauth.services.hooks import ServicesHook from .tasks import XenforoTasks - -import logging +from .urls import urlpatterns logger = logging.getLogger(__name__) diff --git a/services/modules/xenforo/manager.py b/allianceauth/services/modules/xenforo/manager.py similarity index 98% rename from services/modules/xenforo/manager.py rename to allianceauth/services/modules/xenforo/manager.py index 65415b50..82e7018f 100644 --- a/services/modules/xenforo/manager.py +++ b/allianceauth/services/modules/xenforo/manager.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals import random import string import requests diff --git a/services/modules/xenforo/migrations/0001_initial.py b/allianceauth/services/modules/xenforo/migrations/0001_initial.py similarity index 100% rename from services/modules/xenforo/migrations/0001_initial.py rename to allianceauth/services/modules/xenforo/migrations/0001_initial.py diff --git a/services/modules/xenforo/migrations/0002_service_permissions.py b/allianceauth/services/modules/xenforo/migrations/0002_service_permissions.py similarity index 100% rename from services/modules/xenforo/migrations/0002_service_permissions.py rename to allianceauth/services/modules/xenforo/migrations/0002_service_permissions.py diff --git a/services/modules/market/migrations/__init__.py b/allianceauth/services/modules/xenforo/migrations/__init__.py similarity index 100% rename from services/modules/market/migrations/__init__.py rename to allianceauth/services/modules/xenforo/migrations/__init__.py diff --git a/services/modules/xenforo/models.py b/allianceauth/services/modules/xenforo/models.py similarity index 78% rename from services/modules/xenforo/models.py rename to allianceauth/services/modules/xenforo/models.py index a4da6bf7..80d8bb97 100644 --- a/services/modules/xenforo/models.py +++ b/allianceauth/services/modules/xenforo/models.py @@ -1,9 +1,6 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models -@python_2_unicode_compatible class XenforoUser(models.Model): user = models.OneToOneField('auth.User', primary_key=True, diff --git a/services/modules/xenforo/tasks.py b/allianceauth/services/modules/xenforo/tasks.py similarity index 90% rename from services/modules/xenforo/tasks.py rename to allianceauth/services/modules/xenforo/tasks.py index b8acccd5..5768a2db 100644 --- a/services/modules/xenforo/tasks.py +++ b/allianceauth/services/modules/xenforo/tasks.py @@ -1,14 +1,11 @@ -from __future__ import unicode_literals +import logging -from django.conf import settings from django.core.exceptions import ObjectDoesNotExist -from notifications import notify +from allianceauth.notifications import notify from .manager import XenForoManager from .models import XenforoUser -import logging - logger = logging.getLogger(__name__) diff --git a/services/modules/xenforo/tests.py b/allianceauth/services/modules/xenforo/tests.py similarity index 96% rename from services/modules/xenforo/tests.py rename to allianceauth/services/modules/xenforo/tests.py index 43f1de47..6f13f268 100644 --- a/services/modules/xenforo/tests.py +++ b/allianceauth/services/modules/xenforo/tests.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase, RequestFactory from django import urls from django.contrib.auth.models import User, Group, Permission from django.core.exceptions import ObjectDoesNotExist -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils from .auth_hooks import XenforoService from .models import XenforoUser from .tasks import XenforoTasks -MODULE_PATH = 'services.modules.xenforo' +MODULE_PATH = 'allianceauth.services.modules.xenforo' DEFAULT_AUTH_GROUP = 'Member' diff --git a/services/modules/xenforo/urls.py b/allianceauth/services/modules/xenforo/urls.py similarity index 93% rename from services/modules/xenforo/urls.py rename to allianceauth/services/modules/xenforo/urls.py index 6993a33e..64211cd6 100644 --- a/services/modules/xenforo/urls.py +++ b/allianceauth/services/modules/xenforo/urls.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf.urls import url, include from . import views diff --git a/services/modules/xenforo/views.py b/allianceauth/services/modules/xenforo/views.py similarity index 97% rename from services/modules/xenforo/views.py rename to allianceauth/services/modules/xenforo/views.py index e3f4c620..de1341bc 100644 --- a/services/modules/xenforo/views.py +++ b/allianceauth/services/modules/xenforo/views.py @@ -1,13 +1,10 @@ -from __future__ import unicode_literals - import logging from django.contrib import messages from django.contrib.auth.decorators import login_required, permission_required from django.shortcuts import render, redirect -from eveonline.managers import EveManager -from services.forms import ServicePasswordForm +from allianceauth.services.forms import ServicePasswordForm from .manager import XenForoManager from .models import XenforoUser from .tasks import XenforoTasks diff --git a/services/signals.py b/allianceauth/services/signals.py similarity index 97% rename from services/signals.py rename to allianceauth/services/signals.py index 600d9ca0..55478592 100644 --- a/services/signals.py +++ b/allianceauth/services/signals.py @@ -1,5 +1,3 @@ -from __future__ import unicode_literals - import logging from django.contrib.auth.models import User, Group, Permission @@ -8,11 +6,11 @@ from django.db.models.signals import m2m_changed from django.db.models.signals import pre_delete from django.db.models.signals import pre_save from django.dispatch import receiver +from .hooks import ServicesHook +from .tasks import disable_user -from services.hooks import ServicesHook -from services.tasks import disable_user -from authentication.models import State, UserProfile -from authentication.signals import state_changed +from allianceauth.authentication.models import State, UserProfile +from allianceauth.authentication.signals import state_changed logger = logging.getLogger(__name__) diff --git a/services/tasks.py b/allianceauth/services/tasks.py similarity index 92% rename from services/tasks.py rename to allianceauth/services/tasks.py index bcd0aedd..5ec0fcc8 100644 --- a/services/tasks.py +++ b/allianceauth/services/tasks.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals - import logging -from alliance_auth.celeryapp import app - -from services.hooks import ServicesHook import redis +from allianceauth.celeryapp import app +from .hooks import ServicesHook + REDIS_CLIENT = redis.Redis() logger = logging.getLogger(__name__) diff --git a/services/templates/public/menublock.html b/allianceauth/services/templates/public/menublock.html similarity index 100% rename from services/templates/public/menublock.html rename to allianceauth/services/templates/public/menublock.html diff --git a/services/templates/public/menuitem.html b/allianceauth/services/templates/public/menuitem.html similarity index 100% rename from services/templates/public/menuitem.html rename to allianceauth/services/templates/public/menuitem.html diff --git a/services/modules/mumble/__init__.py b/allianceauth/services/templatetags/__init__.py similarity index 100% rename from services/modules/mumble/__init__.py rename to allianceauth/services/templatetags/__init__.py diff --git a/services/templatetags/menu_items.py b/allianceauth/services/templatetags/menu_items.py similarity index 86% rename from services/templatetags/menu_items.py rename to allianceauth/services/templatetags/menu_items.py index 9b108aa9..6485641a 100644 --- a/services/templatetags/menu_items.py +++ b/allianceauth/services/templatetags/menu_items.py @@ -1,8 +1,6 @@ -from __future__ import unicode_literals - from django import template -from alliance_auth.hooks import get_hooks +from allianceauth.hooks import get_hooks register = template.Library() diff --git a/services/modules/mumble/migrations/__init__.py b/allianceauth/services/tests/__init__.py similarity index 100% rename from services/modules/mumble/migrations/__init__.py rename to allianceauth/services/tests/__init__.py diff --git a/services/tests/test_signals.py b/allianceauth/services/tests/test_signals.py similarity index 88% rename from services/tests/test_signals.py rename to allianceauth/services/tests/test_signals.py index 8b11efce..83c1313a 100644 --- a/services/tests/test_signals.py +++ b/allianceauth/services/tests/test_signals.py @@ -1,16 +1,9 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase from django.contrib.auth.models import Group, Permission -from alliance_auth.tests.auth_utils import AuthUtils -from authentication.models import State +from allianceauth.tests.auth_utils import AuthUtils +from allianceauth.authentication.models import State class ServicesSignalsTestCase(TestCase): @@ -18,8 +11,8 @@ class ServicesSignalsTestCase(TestCase): self.member = AuthUtils.create_user('auth_member', disconnect_signals=True) self.none_user = AuthUtils.create_user('none_user', disconnect_signals=True) - @mock.patch('services.signals.transaction') - @mock.patch('services.signals.ServicesHook') + @mock.patch('allianceauth.services.signals.transaction') + @mock.patch('allianceauth.services.signals.ServicesHook') def test_m2m_changed_user_groups(self, services_hook, transaction): """ Test that update_groups hook function is called on user groups change @@ -50,7 +43,7 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = svc.validate_user.call_args self.assertEqual(self.member, args[0]) - @mock.patch('services.signals.disable_user') + @mock.patch('allianceauth.services.signals.disable_user') def test_pre_delete_user(self, disable_user): """ @@ -62,7 +55,7 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = disable_user.call_args self.assertEqual(self.none_user, args[0]) - @mock.patch('services.signals.disable_user') + @mock.patch('allianceauth.services.signals.disable_user') def test_pre_save_user_inactivation(self, disable_user): """ Test a user set inactive has disable_member called @@ -74,8 +67,8 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = disable_user.call_args self.assertEqual(self.member, args[0]) - @mock.patch('services.signals.transaction') - @mock.patch('services.signals.ServicesHook') + @mock.patch('allianceauth.services.signals.transaction') + @mock.patch('allianceauth.services.signals.ServicesHook') def test_m2m_changed_group_permissions(self, services_hook, transaction): from django.contrib.contenttypes.models import ContentType svc = mock.Mock() @@ -106,8 +99,8 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = svc.validate_user.call_args self.assertEqual(self.member, args[0]) - @mock.patch('services.signals.transaction') - @mock.patch('services.signals.ServicesHook') + @mock.patch('allianceauth.services.signals.transaction') + @mock.patch('allianceauth.services.signals.ServicesHook') def test_m2m_changed_user_permissions(self, services_hook, transaction): from django.contrib.contenttypes.models import ContentType svc = mock.Mock() @@ -133,8 +126,8 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = svc.validate_user.call_args self.assertEqual(self.member, args[0]) - @mock.patch('services.signals.transaction') - @mock.patch('services.signals.ServicesHook') + @mock.patch('allianceauth.services.signals.transaction') + @mock.patch('allianceauth.services.signals.ServicesHook') def test_m2m_changed_user_state_permissions(self, services_hook, transaction): from django.contrib.contenttypes.models import ContentType svc = mock.Mock() @@ -166,7 +159,7 @@ class ServicesSignalsTestCase(TestCase): args, kwargs = svc.validate_user.call_args self.assertEqual(self.member, args[0]) - @mock.patch('services.signals.ServicesHook') + @mock.patch('allianceauth.services.signals.ServicesHook') def test_state_changed_services_valudation(self, services_hook): """ Test a user changing state has service accounts validated diff --git a/services/tests/test_tasks.py b/allianceauth/services/tests/test_tasks.py similarity index 70% rename from services/tests/test_tasks.py rename to allianceauth/services/tests/test_tasks.py index ab8d9cc3..25dc2570 100644 --- a/services/tests/test_tasks.py +++ b/allianceauth/services/tests/test_tasks.py @@ -1,24 +1,17 @@ -from __future__ import unicode_literals - -try: - # Py3 - from unittest import mock -except ImportError: - # Py2 - import mock +from unittest import mock from django.test import TestCase -from alliance_auth.tests.auth_utils import AuthUtils +from allianceauth.tests.auth_utils import AuthUtils -from services.tasks import validate_services +from allianceauth.services.tasks import validate_services class ServicesTasksTestCase(TestCase): def setUp(self): self.member = AuthUtils.create_user('auth_member') - @mock.patch('services.tasks.ServicesHook') + @mock.patch('allianceauth.services.tasks.ServicesHook') def test_validate_services(self, services_hook): svc = mock.Mock() svc.validate_user.return_value = None diff --git a/services/views.py b/allianceauth/services/views.py similarity index 94% rename from services/views.py rename to allianceauth/services/views.py index a2d6256e..1e1a4525 100755 --- a/services/views.py +++ b/allianceauth/services/views.py @@ -1,12 +1,10 @@ -from __future__ import unicode_literals +import logging from django.contrib.auth.decorators import login_required from django.shortcuts import render -from alliance_auth.hooks import get_hooks -from services.forms import FleetFormatterForm - -import logging +from allianceauth.hooks import get_hooks +from .forms import FleetFormatterForm logger = logging.getLogger(__name__) diff --git a/allianceauth/srp/__init__.py b/allianceauth/srp/__init__.py new file mode 100755 index 00000000..bd500477 --- /dev/null +++ b/allianceauth/srp/__init__.py @@ -0,0 +1,2 @@ +default_app_config = 'allianceauth.srp.apps.SRPConfig' + diff --git a/allianceauth/srp/admin.py b/allianceauth/srp/admin.py new file mode 100755 index 00000000..9a6685b8 --- /dev/null +++ b/allianceauth/srp/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin + +from allianceauth.srp.models import SrpFleetMain +from allianceauth.srp.models import SrpUserRequest + +admin.site.register(SrpFleetMain) +admin.site.register(SrpUserRequest) diff --git a/srp/apps.py b/allianceauth/srp/apps.py similarity index 52% rename from srp/apps.py rename to allianceauth/srp/apps.py index 93027128..85f0f73f 100644 --- a/srp/apps.py +++ b/allianceauth/srp/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class SRPConfig(AppConfig): - name = 'srp' + name = 'allianceauth.srp' + label = 'srp' diff --git a/srp/auth_hooks.py b/allianceauth/srp/auth_hooks.py similarity index 84% rename from srp/auth_hooks.py rename to allianceauth/srp/auth_hooks.py index 91fc25c9..3e9755aa 100644 --- a/srp/auth_hooks.py +++ b/allianceauth/srp/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from srp import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from . import urls class SrpMenu(MenuItemHook): diff --git a/srp/form.py b/allianceauth/srp/form.py similarity index 96% rename from srp/form.py rename to allianceauth/srp/form.py index 036d6438..192f546d 100755 --- a/srp/form.py +++ b/allianceauth/srp/form.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django import forms from django.utils.translation import ugettext_lazy as _ diff --git a/srp/managers.py b/allianceauth/srp/managers.py similarity index 96% rename from srp/managers.py rename to allianceauth/srp/managers.py index dbb99428..2c394c91 100644 --- a/srp/managers.py +++ b/allianceauth/srp/managers.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django.conf import settings import requests diff --git a/srp/migrations/0001_initial.py b/allianceauth/srp/migrations/0001_initial.py similarity index 100% rename from srp/migrations/0001_initial.py rename to allianceauth/srp/migrations/0001_initial.py diff --git a/srp/migrations/0002_srpuserrequest_srp_status_choices.py b/allianceauth/srp/migrations/0002_srpuserrequest_srp_status_choices.py similarity index 100% rename from srp/migrations/0002_srpuserrequest_srp_status_choices.py rename to allianceauth/srp/migrations/0002_srpuserrequest_srp_status_choices.py diff --git a/srp/migrations/0003_make_strings_more_stringy.py b/allianceauth/srp/migrations/0003_make_strings_more_stringy.py similarity index 100% rename from srp/migrations/0003_make_strings_more_stringy.py rename to allianceauth/srp/migrations/0003_make_strings_more_stringy.py diff --git a/services/modules/openfire/__init__.py b/allianceauth/srp/migrations/__init__.py similarity index 100% rename from services/modules/openfire/__init__.py rename to allianceauth/srp/migrations/__init__.py diff --git a/srp/models.py b/allianceauth/srp/models.py similarity index 90% rename from srp/models.py rename to allianceauth/srp/models.py index 836ad27e..6effbef4 100755 --- a/srp/models.py +++ b/allianceauth/srp/models.py @@ -1,11 +1,9 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible from django.db import models from django.utils import timezone -from eveonline.models import EveCharacter + +from allianceauth.eveonline.models import EveCharacter -@python_2_unicode_compatible class SrpFleetMain(models.Model): fleet_name = models.CharField(max_length=254, default="") fleet_doctrine = models.CharField(max_length=254, default="") @@ -30,7 +28,6 @@ class SrpFleetMain(models.Model): permissions = (('access_srp', 'Can access SRP module'),) -@python_2_unicode_compatible class SrpUserRequest(models.Model): SRP_STATUS_CHOICES = ( ('Pending', 'Pending'), diff --git a/srp/templates/srp/add.html b/allianceauth/srp/templates/srp/add.html similarity index 100% rename from srp/templates/srp/add.html rename to allianceauth/srp/templates/srp/add.html diff --git a/srp/templates/srp/data.html b/allianceauth/srp/templates/srp/data.html similarity index 100% rename from srp/templates/srp/data.html rename to allianceauth/srp/templates/srp/data.html diff --git a/srp/templates/srp/management.html b/allianceauth/srp/templates/srp/management.html similarity index 100% rename from srp/templates/srp/management.html rename to allianceauth/srp/templates/srp/management.html diff --git a/srp/templates/srp/request.html b/allianceauth/srp/templates/srp/request.html similarity index 100% rename from srp/templates/srp/request.html rename to allianceauth/srp/templates/srp/request.html diff --git a/srp/templates/srp/update.html b/allianceauth/srp/templates/srp/update.html similarity index 100% rename from srp/templates/srp/update.html rename to allianceauth/srp/templates/srp/update.html diff --git a/srp/tests.py b/allianceauth/srp/tests.py similarity index 100% rename from srp/tests.py rename to allianceauth/srp/tests.py diff --git a/allianceauth/srp/urls.py b/allianceauth/srp/urls.py new file mode 100644 index 00000000..7aef37b4 --- /dev/null +++ b/allianceauth/srp/urls.py @@ -0,0 +1,32 @@ +from django.conf.urls import url + +from . import views + +app_name = 'srp' + +urlpatterns = [ + # SRP URLS + url(r'^$', views.srp_management, name='management'), + url(r'^all/$', views.srp_management_all, name='all'), + url(r'^(\w+)/view$', views.srp_fleet_view, name='fleet'), + url(r'^add/$', views.srp_fleet_add_view, name='add'), + url(r'^(\w+)/edit$', views.srp_fleet_edit_view, name='edit'), + url(r'^(\w+)/request', views.srp_request_view, name='request'), + + # SRP URLS + url(r'^(\w+)/remove$', views.srp_fleet_remove, name='remove'), + url(r'^(\w+)/disable$', views.srp_fleet_disable, name='disable'), + url(r'^(\w+)/enable$', views.srp_fleet_enable, name='enable'), + url(r'^(\w+)/complete$', views.srp_fleet_mark_completed, + name='mark_completed'), + url(r'^(\w+)/incomplete$', views.srp_fleet_mark_uncompleted, + name='mark_uncompleted'), + url(r'^request/remove/', views.srp_request_remove, + name="request_remove"), + url(r'request/approve/', views.srp_request_approve, + name='request_approve'), + url(r'request/reject/', views.srp_request_reject, + name='request_reject'), + url(r'^request/(\w+)/update', views.srp_request_update_amount, + name="request_update_amount"), + ] \ No newline at end of file diff --git a/srp/views.py b/allianceauth/srp/views.py similarity index 98% rename from srp/views.py rename to allianceauth/srp/views.py index fc5faec0..13a5342c 100755 --- a/srp/views.py +++ b/allianceauth/srp/views.py @@ -1,23 +1,22 @@ -from __future__ import unicode_literals -from django.shortcuts import render, redirect, get_object_or_404 -from django.contrib.auth.decorators import login_required -from django.contrib.auth.decorators import permission_required -from django.contrib import messages -from django.http import JsonResponse -from eveonline.managers import EveManager -from srp.models import SrpFleetMain -from srp.models import SrpUserRequest -from srp.form import SrpFleetMainForm -from srp.form import SrpFleetUserRequestForm -from srp.form import SrpFleetMainUpdateForm -from srp.managers import SRPManager -from notifications import notify -from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ -from django.contrib.humanize.templatetags.humanize import intcomma +import logging import uuid -import logging +from django.contrib import messages +from django.contrib.auth.decorators import login_required +from django.contrib.auth.decorators import permission_required +from django.contrib.humanize.templatetags.humanize import intcomma +from django.http import JsonResponse +from django.shortcuts import render, redirect, get_object_or_404 +from django.utils import timezone +from django.utils.translation import ugettext_lazy as _ +from allianceauth.eveonline.managers import EveManager +from allianceauth.notifications import notify +from .form import SrpFleetMainForm +from .form import SrpFleetMainUpdateForm +from .form import SrpFleetUserRequestForm +from .models import SrpFleetMain +from .models import SrpUserRequest +from .managers import SRPManager logger = logging.getLogger(__name__) diff --git a/stock/static/css/auth-base.css b/allianceauth/static/css/auth-base.css similarity index 100% rename from stock/static/css/auth-base.css rename to allianceauth/static/css/auth-base.css diff --git a/stock/static/css/checkbox.css b/allianceauth/static/css/checkbox.css similarity index 100% rename from stock/static/css/checkbox.css rename to allianceauth/static/css/checkbox.css diff --git a/stock/static/js/timers.js b/allianceauth/static/js/timers.js similarity index 100% rename from stock/static/js/timers.js rename to allianceauth/static/js/timers.js diff --git a/stock/templates/bundles/bootstrap-css.html b/allianceauth/templates/bundles/bootstrap-css.html similarity index 100% rename from stock/templates/bundles/bootstrap-css.html rename to allianceauth/templates/bundles/bootstrap-css.html diff --git a/stock/templates/bundles/bootstrap-js.html b/allianceauth/templates/bundles/bootstrap-js.html similarity index 100% rename from stock/templates/bundles/bootstrap-js.html rename to allianceauth/templates/bundles/bootstrap-js.html diff --git a/stock/templates/bundles/datatables-css.html b/allianceauth/templates/bundles/datatables-css.html similarity index 100% rename from stock/templates/bundles/datatables-css.html rename to allianceauth/templates/bundles/datatables-css.html diff --git a/stock/templates/bundles/datatables-js.html b/allianceauth/templates/bundles/datatables-js.html similarity index 100% rename from stock/templates/bundles/datatables-js.html rename to allianceauth/templates/bundles/datatables-js.html diff --git a/stock/templates/bundles/fontawesome.html b/allianceauth/templates/bundles/fontawesome.html similarity index 100% rename from stock/templates/bundles/fontawesome.html rename to allianceauth/templates/bundles/fontawesome.html diff --git a/stock/templates/bundles/jquery-datetimepicker-css.html b/allianceauth/templates/bundles/jquery-datetimepicker-css.html similarity index 100% rename from stock/templates/bundles/jquery-datetimepicker-css.html rename to allianceauth/templates/bundles/jquery-datetimepicker-css.html diff --git a/stock/templates/bundles/jquery-datetimepicker-js.html b/allianceauth/templates/bundles/jquery-datetimepicker-js.html similarity index 100% rename from stock/templates/bundles/jquery-datetimepicker-js.html rename to allianceauth/templates/bundles/jquery-datetimepicker-js.html diff --git a/stock/templates/bundles/moment-js.html b/allianceauth/templates/bundles/moment-js.html similarity index 100% rename from stock/templates/bundles/moment-js.html rename to allianceauth/templates/bundles/moment-js.html diff --git a/stock/templates/bundles/x-editable-js.html b/allianceauth/templates/bundles/x-editable-js.html similarity index 100% rename from stock/templates/bundles/x-editable-js.html rename to allianceauth/templates/bundles/x-editable-js.html diff --git a/stock/templates/bundles/x-editable.css.html b/allianceauth/templates/bundles/x-editable.css.html similarity index 100% rename from stock/templates/bundles/x-editable.css.html rename to allianceauth/templates/bundles/x-editable.css.html diff --git a/stock/templates/registered/fleetformattertool.html b/allianceauth/templates/registered/fleetformattertool.html similarity index 100% rename from stock/templates/registered/fleetformattertool.html rename to allianceauth/templates/registered/fleetformattertool.html diff --git a/stock/templates/registered/groupmanagement.html b/allianceauth/templates/registered/groupmanagement.html similarity index 100% rename from stock/templates/registered/groupmanagement.html rename to allianceauth/templates/registered/groupmanagement.html diff --git a/stock/templates/registered/groupmanagementmenu.html b/allianceauth/templates/registered/groupmanagementmenu.html similarity index 100% rename from stock/templates/registered/groupmanagementmenu.html rename to allianceauth/templates/registered/groupmanagementmenu.html diff --git a/stock/templates/registered/groupmembers.html b/allianceauth/templates/registered/groupmembers.html similarity index 100% rename from stock/templates/registered/groupmembers.html rename to allianceauth/templates/registered/groupmembers.html diff --git a/stock/templates/registered/groupmembership.html b/allianceauth/templates/registered/groupmembership.html similarity index 100% rename from stock/templates/registered/groupmembership.html rename to allianceauth/templates/registered/groupmembership.html diff --git a/stock/templates/registered/groups.html b/allianceauth/templates/registered/groups.html similarity index 100% rename from stock/templates/registered/groups.html rename to allianceauth/templates/registered/groups.html diff --git a/stock/templates/registered/help.html b/allianceauth/templates/registered/help.html similarity index 100% rename from stock/templates/registered/help.html rename to allianceauth/templates/registered/help.html diff --git a/stock/templates/registered/jabberbroadcast.html b/allianceauth/templates/registered/jabberbroadcast.html similarity index 100% rename from stock/templates/registered/jabberbroadcast.html rename to allianceauth/templates/registered/jabberbroadcast.html diff --git a/stock/templates/registered/notification_list.html b/allianceauth/templates/registered/notification_list.html similarity index 100% rename from stock/templates/registered/notification_list.html rename to allianceauth/templates/registered/notification_list.html diff --git a/stock/templates/registered/notification_view.html b/allianceauth/templates/registered/notification_view.html similarity index 100% rename from stock/templates/registered/notification_view.html rename to allianceauth/templates/registered/notification_view.html diff --git a/stock/templates/registered/service_credentials.html b/allianceauth/templates/registered/service_credentials.html similarity index 100% rename from stock/templates/registered/service_credentials.html rename to allianceauth/templates/registered/service_credentials.html diff --git a/stock/templates/registered/service_password.html b/allianceauth/templates/registered/service_password.html similarity index 100% rename from stock/templates/registered/service_password.html rename to allianceauth/templates/registered/service_password.html diff --git a/stock/templates/registered/services.html b/allianceauth/templates/registered/services.html similarity index 100% rename from stock/templates/registered/services.html rename to allianceauth/templates/registered/services.html diff --git a/stock/templates/registered/services_ctrl.html b/allianceauth/templates/registered/services_ctrl.html similarity index 100% rename from stock/templates/registered/services_ctrl.html rename to allianceauth/templates/registered/services_ctrl.html diff --git a/stock/templates/registered/teamspeakjoin.html b/allianceauth/templates/registered/teamspeakjoin.html similarity index 100% rename from stock/templates/registered/teamspeakjoin.html rename to allianceauth/templates/registered/teamspeakjoin.html diff --git a/services/modules/openfire/migrations/__init__.py b/allianceauth/tests/__init__.py similarity index 100% rename from services/modules/openfire/migrations/__init__.py rename to allianceauth/tests/__init__.py diff --git a/alliance_auth/tests/auth_utils.py b/allianceauth/tests/auth_utils.py similarity index 92% rename from alliance_auth/tests/auth_utils.py rename to allianceauth/tests/auth_utils.py index bfaa3539..5ae1d6a9 100644 --- a/alliance_auth/tests/auth_utils.py +++ b/allianceauth/tests/auth_utils.py @@ -1,14 +1,15 @@ -from __future__ import unicode_literals - -from django.test import TestCase -from django.db.models.signals import m2m_changed, pre_save, post_save +from allianceauth.authentication.models import UserProfile, State, get_guest_state +from allianceauth.authentication.signals import state_member_alliances_changed, state_member_characters_changed, \ + state_member_corporations_changed, state_saved from django.contrib.auth.models import User, Group -from services.signals import m2m_changed_user_groups, pre_save_user -from services.signals import m2m_changed_group_permissions, m2m_changed_user_permissions, m2m_changed_state_permissions -from authentication.models import UserProfile, State, get_guest_state -from authentication.signals import state_member_alliances_changed, state_member_characters_changed, state_member_corporations_changed, state_saved -from eveonline.models import EveCharacter +from django.db.models.signals import m2m_changed, pre_save, post_save +from django.test import TestCase from esi.models import Token +from allianceauth.eveonline.models import EveCharacter + +from allianceauth.services.signals import m2m_changed_group_permissions, m2m_changed_user_permissions, \ + m2m_changed_state_permissions +from allianceauth.services.signals import m2m_changed_user_groups, pre_save_user class AuthUtils: diff --git a/services/modules/phpbb3/__init__.py b/allianceauth/thirdparty/__init__.py similarity index 100% rename from services/modules/phpbb3/__init__.py rename to allianceauth/thirdparty/__init__.py diff --git a/services/modules/phpbb3/migrations/__init__.py b/allianceauth/thirdparty/navhelper/__init__.py similarity index 100% rename from services/modules/phpbb3/migrations/__init__.py rename to allianceauth/thirdparty/navhelper/__init__.py diff --git a/services/modules/seat/__init__.py b/allianceauth/thirdparty/navhelper/templatetags/__init__.py similarity index 100% rename from services/modules/seat/__init__.py rename to allianceauth/thirdparty/navhelper/templatetags/__init__.py diff --git a/allianceauth/thirdparty/navhelper/templatetags/navactive.py b/allianceauth/thirdparty/navhelper/templatetags/navactive.py new file mode 100644 index 00000000..ebd7b83c --- /dev/null +++ b/allianceauth/thirdparty/navhelper/templatetags/navactive.py @@ -0,0 +1,63 @@ +""" +The MIT License (MIT) + +Copyright (c) 2013 Guillaume Luchet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" +from django.template import Library +from django.core.urlresolvers import resolve +from django.conf import settings +import re + +register = Library() + + +@register.simple_tag +def renavactive(request, pattern): + """ + {% renavactive request "^/a_regex" %} + """ + if re.search(pattern, request.path): + return getattr(settings, "NAVHELPER_ACTIVE_CLASS", "active") + return getattr(settings, "NAVHELPER_NOT_ACTIVE_CLASS", "") + + +@register.simple_tag +def navactive(request, urls): + """ + {% navactive request "view_name another_view_name" %} + """ + url_list = set(urls.split()) + + resolved = resolve(request.path) + resolved_urls = set() + if resolved.url_name: + resolved_urls.add(resolved.url_name) + if resolved.namespaces: + resolved_urls = resolved_urls.union(["{}:{}".format(namespace, resolved.url_name) for namespace in resolved.namespaces]) + resolved_urls = resolved_urls.union(["{}:".format(namespace) for namespace in resolved.namespaces]) + if getattr(resolved, 'app_name', None): + resolved_urls = resolved_urls.union(["{}:{}".format(resolved.app_name, resolved.url_name), "{}:".format(resolved.app_name)]) + if getattr(resolved, 'app_names', []): + resolved_urls = resolved_urls.union(["{}:{}".format(app_name, resolved.url_name) for app_name in resolved.app_names]) + resolved_urls = resolved_urls.union(["{}:".format(app_name) for app_name in resolved.app_names]) + if url_list and resolved_urls and bool(resolved_urls & url_list): + return getattr(settings, "NAVHELPER_ACTIVE_CLASS", "active") + return getattr(settings, "NAVHELPER_NOT_ACTIVE_CLASS", "") diff --git a/allianceauth/thirdparty/navhelper/tests.py b/allianceauth/thirdparty/navhelper/tests.py new file mode 100644 index 00000000..70d1bc9a --- /dev/null +++ b/allianceauth/thirdparty/navhelper/tests.py @@ -0,0 +1,88 @@ +""" +The MIT License (MIT) + +Copyright (c) 2013 Guillaume Luchet + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +""" +# -*- coding: utf-8 -*- + +from django.template import Context, Template +from django.test import TestCase, RequestFactory + + +class NavhelperTemplateTagTests(TestCase): + def setUp(self): + self.factory = RequestFactory() + + def test_navactive(self): + self._navactive_common('active', '') + + with self.settings(NAVHELPER_ACTIVE_CLASS='my-active-class', + NAVHELPER_NOT_ACTIVE_CLASS='my-not-active-class'): + self._navactive_common('my-active-class', 'my-not-active-class') + + def test_renavactive(self): + self._renavactive_common('active', '') + + with self.settings(NAVHELPER_ACTIVE_CLASS='my-active-class', + NAVHELPER_NOT_ACTIVE_CLASS='my-not-active-class'): + self._renavactive_common('my-active-class', 'my-not-active-class') + + def _navactive_common(self, active, not_active): + request = self.factory.get('/main-page/') + + out = Template( + "{% load navactive %}" + "{% navactive request 'p1' %}" + ).render(Context({"request": request})) + self.assertEqual(out, active) + + out = Template( + "{% load navactive %}" + "{% navactive request 'p1-s1' %}" + ).render(Context({"request": request})) + self.assertEqual(out, not_active) + + out = Template( + "{% load navactive %}" + "{% navactive request 'p1 p1-s1' %}" + ).render(Context({"request": request})) + self.assertEqual(out, active) + + out = Template( + "{% load navactive %}" + "{% navactive request 'p2' %}" + ).render(Context({"request": request})) + self.assertEqual(out, not_active) + + def _renavactive_common(self, active, not_active): + t1 = "{% load navactive %}{% renavactive request '^/main-page' %}" + + request = self.factory.get('/main-page/') + out = Template(t1).render(Context({"request": request})) + self.assertEqual(out, active) + + request = self.factory.get('/main-page/sub-section/') + out = Template(t1).render(Context({"request": request})) + self.assertEqual(out, active) + + request = self.factory.get('/second-page/') + out = Template(t1).render(Context({"request": request})) + self.assertEqual(out, not_active) diff --git a/allianceauth/timerboard/__init__.py b/allianceauth/timerboard/__init__.py new file mode 100755 index 00000000..57b671a6 --- /dev/null +++ b/allianceauth/timerboard/__init__.py @@ -0,0 +1 @@ +default_app_config = 'allianceauth.timerboard.apps.TimerBoardConfig' diff --git a/allianceauth/timerboard/admin.py b/allianceauth/timerboard/admin.py new file mode 100755 index 00000000..24235c49 --- /dev/null +++ b/allianceauth/timerboard/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin + +from allianceauth.timerboard.models import Timer + +admin.site.register(Timer) diff --git a/timerboard/apps.py b/allianceauth/timerboard/apps.py similarity index 52% rename from timerboard/apps.py rename to allianceauth/timerboard/apps.py index 221cfa62..ef872491 100644 --- a/timerboard/apps.py +++ b/allianceauth/timerboard/apps.py @@ -1,7 +1,6 @@ -from __future__ import unicode_literals - from django.apps import AppConfig class TimerBoardConfig(AppConfig): - name = 'timerboard' + name = 'allianceauth.timerboard' + label = 'timerboard' diff --git a/timerboard/auth_hooks.py b/allianceauth/timerboard/auth_hooks.py similarity index 84% rename from timerboard/auth_hooks.py rename to allianceauth/timerboard/auth_hooks.py index f4963d99..5fae2213 100644 --- a/timerboard/auth_hooks.py +++ b/allianceauth/timerboard/auth_hooks.py @@ -1,6 +1,7 @@ -from services.hooks import MenuItemHook, UrlHook -from alliance_auth import hooks -from timerboard import urls +from allianceauth.services.hooks import MenuItemHook, UrlHook + +from allianceauth import hooks +from . import urls class TimerboardMenu(MenuItemHook): diff --git a/timerboard/form.py b/allianceauth/timerboard/form.py similarity index 96% rename from timerboard/form.py rename to allianceauth/timerboard/form.py index c4db4102..261c11cf 100755 --- a/timerboard/form.py +++ b/allianceauth/timerboard/form.py @@ -1,4 +1,3 @@ -from __future__ import unicode_literals from django import forms from django.core.validators import MaxValueValidator, MinValueValidator from django.utils.translation import ugettext_lazy as _ diff --git a/timerboard/migrations/0001_initial.py b/allianceauth/timerboard/migrations/0001_initial.py similarity index 100% rename from timerboard/migrations/0001_initial.py rename to allianceauth/timerboard/migrations/0001_initial.py diff --git a/timerboard/migrations/0002_make_strings_more_stringy.py b/allianceauth/timerboard/migrations/0002_make_strings_more_stringy.py similarity index 100% rename from timerboard/migrations/0002_make_strings_more_stringy.py rename to allianceauth/timerboard/migrations/0002_make_strings_more_stringy.py diff --git a/services/modules/seat/migrations/__init__.py b/allianceauth/timerboard/migrations/__init__.py similarity index 100% rename from services/modules/seat/migrations/__init__.py rename to allianceauth/timerboard/migrations/__init__.py diff --git a/timerboard/models.py b/allianceauth/timerboard/models.py similarity index 78% rename from timerboard/models.py rename to allianceauth/timerboard/models.py index 560bfae7..d1a10c0f 100755 --- a/timerboard/models.py +++ b/allianceauth/timerboard/models.py @@ -1,13 +1,10 @@ -from __future__ import unicode_literals -from django.utils.encoding import python_2_unicode_compatible -from django.db import models from django.contrib.auth.models import User +from django.db import models -from eveonline.models import EveCharacter -from eveonline.models import EveCorporationInfo +from allianceauth.eveonline.models import EveCharacter +from allianceauth.eveonline.models import EveCorporationInfo -@python_2_unicode_compatible class Timer(models.Model): class Meta: ordering = ['eve_time'] diff --git a/timerboard/templates/timerboard/add.html b/allianceauth/timerboard/templates/timerboard/add.html similarity index 100% rename from timerboard/templates/timerboard/add.html rename to allianceauth/timerboard/templates/timerboard/add.html diff --git a/timerboard/templates/timerboard/management.html b/allianceauth/timerboard/templates/timerboard/management.html similarity index 98% rename from timerboard/templates/timerboard/management.html rename to allianceauth/timerboard/templates/timerboard/management.html index a37cbf9a..4c19b230 100644 --- a/timerboard/templates/timerboard/management.html +++ b/allianceauth/timerboard/templates/timerboard/management.html @@ -145,10 +145,10 @@ {{ timer.eve_character.character_name }} {% if perms.auth.timer_management %} - + - + @@ -415,10 +415,10 @@ {{ timer.eve_character.character_name }} {% if perms.auth.timer_management %} - + - + diff --git a/timerboard/templates/timerboard/update.html b/allianceauth/timerboard/templates/timerboard/update.html similarity index 100% rename from timerboard/templates/timerboard/update.html rename to allianceauth/timerboard/templates/timerboard/update.html diff --git a/timerboard/tests.py b/allianceauth/timerboard/tests.py similarity index 100% rename from timerboard/tests.py rename to allianceauth/timerboard/tests.py diff --git a/allianceauth/timerboard/urls.py b/allianceauth/timerboard/urls.py new file mode 100644 index 00000000..2a7ef7d6 --- /dev/null +++ b/allianceauth/timerboard/urls.py @@ -0,0 +1,12 @@ +from django.conf.urls import url + +from . import views + +app_name = 'timerboard' + +urlpatterns = [ + url(r'^$', views.timer_view, name='view'), + url(r'^add/$', views.add_timer_view, name='add'), + url(r'^remove/(\w+)$', views.remove_timer, name='remove'), + url(r'^edit/(\w+)$', views.edit_timer, name='edit'), + ] diff --git a/timerboard/views.py b/allianceauth/timerboard/views.py similarity index 96% rename from timerboard/views.py rename to allianceauth/timerboard/views.py index e832d8df..df904b28 100755 --- a/timerboard/views.py +++ b/allianceauth/timerboard/views.py @@ -1,18 +1,17 @@ -from __future__ import unicode_literals import datetime +import logging -from django.shortcuts import render, redirect +from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import permission_required from django.shortcuts import get_object_or_404 +from django.shortcuts import render, redirect from django.utils import timezone from django.utils.translation import ugettext_lazy as _ -from django.contrib import messages -from eveonline.managers import EveManager -from timerboard.form import TimerForm -from timerboard.models import Timer +from allianceauth.eveonline.managers import EveManager -import logging +from .form import TimerForm +from .models import Timer logger = logging.getLogger(__name__) @@ -76,7 +75,7 @@ def add_timer_view(request): timer.save() logger.info("Created new timer in %s at %s by user %s" % (timer.system, timer.eve_time, request.user)) messages.success(request, _('Added new timer in %(system)s at %(time)s.') % {"system": timer.system, "time": timer.eve_time}) - return redirect("/timers/") + return redirect("timerboard:view") else: logger.debug("Returning new TimerForm") form = TimerForm() @@ -95,7 +94,7 @@ def remove_timer(request, timer_id): logger.debug("Deleting timer id %s by user %s" % (timer_id, request.user)) messages.success(request, _('Deleted timer in %(system)s at %(time)s.') % {'system': timer.system, 'time': timer.eve_time}) - return redirect("auth_timer_view") + return redirect("timerboard:view") @login_required @@ -131,7 +130,7 @@ def edit_timer(request, timer_id): logger.info("User %s updating timer id %s " % (request.user, timer_id)) messages.success(request, _('Saved changes to the timer.')) timer.save() - return redirect("auth_timer_view") + return redirect("timerboard:view") else: current_time = timezone.now() td = timer.eve_time - current_time diff --git a/allianceauth/urls.py b/allianceauth/urls.py new file mode 100755 index 00000000..f66f47a9 --- /dev/null +++ b/allianceauth/urls.py @@ -0,0 +1,92 @@ +import esi.urls +import allianceauth.groupmanagement.views +import allianceauth.notifications.views +import allianceauth.services.views +from django.conf.urls import include, url +from django.conf.urls.i18n import i18n_patterns +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ +from django.views.generic.base import TemplateView + +import allianceauth.authentication.views +import allianceauth.authentication.urls +from allianceauth import NAME + +from allianceauth.authentication import hmac_urls +from allianceauth.hooks import get_hooks + +admin.site.site_header = NAME + + +# Functional/Untranslated URL's +urlpatterns = [ + # Locale + url(r'^i18n/', include('django.conf.urls.i18n')), + + # Authentication + url(r'', include(allianceauth.authentication.urls, namespace='authentication')), + url(r'^account/login/$', TemplateView.as_view(template_name='public/login.html'), name='auth_login_user'), + url(r'account/', include(hmac_urls)), + + # Admin urls + url(r'^admin/', include(admin.site.urls)), + + # SSO + url(r'^sso/', include(esi.urls, namespace='esi')), + url(r'^sso/login$', allianceauth.authentication.views.sso_login, name='auth_sso_login'), + + # Notifications + url(r'^remove_notifications/(\w+)/$', allianceauth.notifications.views.remove_notification, name='auth_remove_notification'), + url(r'^notifications/mark_all_read/$', allianceauth.notifications.views.mark_all_read, name='auth_mark_all_notifications_read'), + url(r'^notifications/delete_all_read/$', allianceauth.notifications.views.delete_all_read, + name='auth_delete_all_read_notifications'), +] + +# User viewed/translated URLS +urlpatterns += i18n_patterns( + # Group management + url(_(r'^groups/'), allianceauth.groupmanagement.views.groups_view, name='auth_groups'), + url(_(r'^group/management/'), allianceauth.groupmanagement.views.group_management, + name='auth_group_management'), + url(_(r'^group/membership/$'), allianceauth.groupmanagement.views.group_membership, + name='auth_group_membership'), + url(_(r'^group/membership/(\w+)/$'), allianceauth.groupmanagement.views.group_membership_list, + name='auth_group_membership_list'), + url(_(r'^group/membership/(\w+)/remove/(\w+)/$'), allianceauth.groupmanagement.views.group_membership_remove, + name='auth_group_membership_remove'), + url(_(r'^group/request_add/(\w+)'), allianceauth.groupmanagement.views.group_request_add, + name='auth_group_request_add'), + url(_(r'^group/request/accept/(\w+)'), allianceauth.groupmanagement.views.group_accept_request, + name='auth_group_accept_request'), + url(_(r'^group/request/reject/(\w+)'), allianceauth.groupmanagement.views.group_reject_request, + name='auth_group_reject_request'), + + url(_(r'^group/request_leave/(\w+)'), allianceauth.groupmanagement.views.group_request_leave, + name='auth_group_request_leave'), + url(_(r'group/leave_request/accept/(\w+)'), allianceauth.groupmanagement.views.group_leave_accept_request, + name='auth_group_leave_accept_request'), + url(_(r'^group/leave_request/reject/(\w+)'), allianceauth.groupmanagement.views.group_leave_reject_request, + name='auth_group_leave_reject_request'), + + url(_(r'^services/$'), allianceauth.services.views.services_view, name='auth_services'), + + # Tools + url(_(r'^tool/fleet_formatter_tool/$'), allianceauth.services.views.fleet_formatter_view, + name='auth_fleet_format_tool_view'), + + # Notifications + url(_(r'^notifications/$'), allianceauth.notifications.views.notification_list, name='auth_notification_list'), + url(_(r'^notifications/(\w+)/$'), allianceauth.notifications.views.notification_view, name='auth_notification_view'), + + +) + +# Append hooked service urls +services = get_hooks('services_hook') +for svc in services: + urlpatterns += svc().urlpatterns + +# Append app urls +app_urls = get_hooks('url_hook') +for app in app_urls: + urlpatterns += [app().include_pattern] diff --git a/authentication/__init__.py b/authentication/__init__.py deleted file mode 100644 index 8c013e8e..00000000 --- a/authentication/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -default_app_config = 'authentication.apps.AuthenticationConfig' diff --git a/corputils/__init__.py b/corputils/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/corputils/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/corputils/urls.py b/corputils/urls.py deleted file mode 100644 index 874d4b24..00000000 --- a/corputils/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.conf.urls import url -import corputils.views - -app_name = 'corputils' -urlpatterns = [ - url(r'^$', corputils.views.corpstats_view, name='view'), - url(r'^add/$', corputils.views.corpstats_add, name='add'), - url(r'^(?P(\d)*)/$', corputils.views.corpstats_view, name='view_corp'), - url(r'^(?P(\d)+)/update/$', corputils.views.corpstats_update, name='update'), - url(r'^search/$', corputils.views.corpstats_search, name='search'), - ] diff --git a/customization/.gitignore b/customization/.gitignore deleted file mode 100644 index 2120a1ca..00000000 --- a/customization/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -#Ignore everything -* -#Except these -!.gitignore -!README.md -!templates -!static diff --git a/customization/README.md b/customization/README.md deleted file mode 100644 index 04749c5c..00000000 --- a/customization/README.md +++ /dev/null @@ -1,7 +0,0 @@ -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. diff --git a/customization/static/.gitignore b/customization/static/.gitignore deleted file mode 100644 index e15381a8..00000000 --- a/customization/static/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -# Ignore everything in this directory -* -# Except this file -!.gitignore -!README.md diff --git a/customization/static/README.md b/customization/static/README.md deleted file mode 100644 index 3edc5785..00000000 --- a/customization/static/README.md +++ /dev/null @@ -1,7 +0,0 @@ -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. diff --git a/customization/templates/.gitignore b/customization/templates/.gitignore deleted file mode 100644 index 1d9c3463..00000000 --- a/customization/templates/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -#Ignore everything in this directory -* -# Except this file -!.gitignore -!README.md diff --git a/customization/templates/README.md b/customization/templates/README.md deleted file mode 100644 index 57cd34bc..00000000 --- a/customization/templates/README.md +++ /dev/null @@ -1,7 +0,0 @@ -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. diff --git a/eveonline/__init__.py b/eveonline/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/eveonline/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/eveonline/views.py b/eveonline/views.py deleted file mode 100755 index 73d342bc..00000000 --- a/eveonline/views.py +++ /dev/null @@ -1,3 +0,0 @@ -from __future__ import unicode_literals - - diff --git a/fleetactivitytracking/__init__.py b/fleetactivitytracking/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/fleetactivitytracking/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/fleetactivitytracking/admin.py b/fleetactivitytracking/admin.py deleted file mode 100644 index b000d7f2..00000000 --- a/fleetactivitytracking/admin.py +++ /dev/null @@ -1,7 +0,0 @@ -from __future__ import unicode_literals -from django.contrib import admin -from fleetactivitytracking.models import Fatlink, Fat - - -admin.site.register(Fatlink) -admin.site.register(Fat) diff --git a/fleetactivitytracking/apps.py b/fleetactivitytracking/apps.py deleted file mode 100644 index 219e0b38..00000000 --- a/fleetactivitytracking/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from __future__ import unicode_literals - -from django.apps import AppConfig - - -class FatConfig(AppConfig): - name = 'fleetactivitytracking' diff --git a/fleetactivitytracking/urls.py b/fleetactivitytracking/urls.py deleted file mode 100644 index e0565f1c..00000000 --- a/fleetactivitytracking/urls.py +++ /dev/null @@ -1,32 +0,0 @@ -from django.conf.urls import url -import fleetactivitytracking.views - -urlpatterns = [ - # FleetActivityTracking (FAT) - url(r'^$', fleetactivitytracking.views.fatlink_view, name='view'), - url(r'^statistics/$', fleetactivitytracking.views.fatlink_statistics_view, name='statistics'), - url(r'^statistics/corp/(\w+)$', fleetactivitytracking.views.fatlink_statistics_corp_view, - name='statistics_corp'), - url(r'^statistics/corp/(?P\w+)/(?P[0-9]+)/(?P[0-9]+)/', - fleetactivitytracking.views.fatlink_statistics_corp_view, - name='statistics_corp_month'), - url(r'^statistics/(?P[0-9]+)/(?P[0-9]+)/$', fleetactivitytracking.views.fatlink_statistics_view, - name='statistics_month'), - url(r'^user/statistics/$', fleetactivitytracking.views.fatlink_personal_statistics_view, - name='personal_statistics'), - url(r'^user/statistics/(?P[0-9]+)/$', fleetactivitytracking.views.fatlink_personal_statistics_view, - name='personal_statistics_year'), - url(r'^user/statistics/(?P[0-9]+)/(?P[0-9]+)/$', - fleetactivitytracking.views.fatlink_monthly_personal_statistics_view, - name='personal_statistics_month'), - url(r'^user/(?P[0-9]+)/statistics/(?P[0-9]+)/(?P[0-9]+)/$', - fleetactivitytracking.views.fatlink_monthly_personal_statistics_view, - name='user_statistics_month'), - url(r'^create/$', fleetactivitytracking.views.create_fatlink_view, name='create'), - url(r'^modify/$', fleetactivitytracking.views.modify_fatlink_view, name='modify'), - url(r'^modify/(?P[a-zA-Z0-9_-]+)/([a-z0-9_-]+)$', - fleetactivitytracking.views.modify_fatlink_view), - url(r'^link/$', fleetactivitytracking.views.fatlink_view, name='click_fatlink'), - url(r'^link/(?P[a-zA-Z0-9]+)/(?P[a-z0-9_-]+)/$', - fleetactivitytracking.views.click_fatlink_view), - ] \ No newline at end of file diff --git a/fleetup/__init__.py b/fleetup/__init__.py deleted file mode 100755 index 37827002..00000000 --- a/fleetup/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -default_app_config = 'fleetup.apps.FleetupConfig' diff --git a/groupmanagement/__init__.py b/groupmanagement/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/groupmanagement/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/hrapplications/__init__.py b/hrapplications/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/hrapplications/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/hrapplications/urls.py b/hrapplications/urls.py deleted file mode 100644 index 2d0d1bea..00000000 --- a/hrapplications/urls.py +++ /dev/null @@ -1,30 +0,0 @@ -from django.conf.urls import url -import hrapplications.views - -app_name = 'hrapplications' - -urlpatterns = [ - url(r'^$', hrapplications.views.hr_application_management_view, - name="index"), - url(r'^create/$', hrapplications.views.hr_application_create_view, - name="create_view"), - url(r'^create/(\d+)', hrapplications.views.hr_application_create_view, - name="create_view"), - url(r'^remove/(\w+)', hrapplications.views.hr_application_remove, - name="remove"), - url(r'view/(\w+)', hrapplications.views.hr_application_view, - name="view"), - url(r'personal/view/(\w+)', hrapplications.views.hr_application_personal_view, - name="personal_view"), - url(r'personal/removal/(\w+)', - hrapplications.views.hr_application_personal_removal, - name="personal_removal"), - url(r'approve/(\w+)', hrapplications.views.hr_application_approve, - name="approve"), - url(r'reject/(\w+)', hrapplications.views.hr_application_reject, - name="reject"), - url(r'search/', hrapplications.views.hr_application_search, - name="search"), - url(r'mark_in_progress/(\w+)', hrapplications.views.hr_application_mark_in_progress, - name="mark_in_progress"), - ] diff --git a/locale/de/LC_MESSAGES/django.mo b/locale/de/LC_MESSAGES/django.mo deleted file mode 100644 index 1d8276ac..00000000 Binary files a/locale/de/LC_MESSAGES/django.mo and /dev/null differ diff --git a/log/.gitignore b/log/.gitignore deleted file mode 100755 index d6b7ef32..00000000 --- a/log/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/manage.py b/manage.py index b65130b0..e6768c3c 100644 --- a/manage.py +++ b/manage.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -from __future__ import unicode_literals import os import sys diff --git a/notifications/admin.py b/notifications/admin.py deleted file mode 100644 index c9bd4f21..00000000 --- a/notifications/admin.py +++ /dev/null @@ -1,5 +0,0 @@ -from __future__ import unicode_literals -from django.contrib import admin -from.models import Notification - -admin.site.register(Notification) diff --git a/optimer/__init__.py b/optimer/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/optimer/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/optimer/admin.py b/optimer/admin.py deleted file mode 100644 index fff104db..00000000 --- a/optimer/admin.py +++ /dev/null @@ -1,6 +0,0 @@ -from __future__ import unicode_literals -from django.contrib import admin - -from optimer.models import OpTimer - -admin.site.register(OpTimer) diff --git a/optimer/urls.py b/optimer/urls.py deleted file mode 100644 index ae6cbaf9..00000000 --- a/optimer/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.conf.urls import url -import optimer.views - -app_name = 'optimer' - -urlpatterns = [ - url(r'^$', optimer.views.optimer_view, name='view'), - url(r'^add$', optimer.views.add_optimer_view, name='add'), - url(r'^(\w+)/remove$', optimer.views.remove_optimer, name='remove'), - url(r'^(\w+)/edit$', optimer.views.edit_optimer, name='edit'), - ] diff --git a/permissions_tool/apps.py b/permissions_tool/apps.py deleted file mode 100644 index 487a8b63..00000000 --- a/permissions_tool/apps.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import unicode_literals - -from django.apps import AppConfig - - -class ServicesConfig(AppConfig): - name = 'permissions_tool' - diff --git a/requirements.txt b/requirements.txt index 4440f7e7..dc019010 100755 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,6 @@ -# Python Stuff # - see bootstrap.sh +# Python dependencies +# Any changes in these package requirements +# should be reflected in setup.py as well. mysqlclient evelink dnspython @@ -7,7 +9,7 @@ requests>=2.9.1 bcrypt python-slugify>=1.2 requests-oauthlib -sleekxmpp + redis celery>=4.0.2 @@ -20,9 +22,9 @@ django-sortedm2m django-redis-cache>=1.7.1 django-recaptcha django-celery-beat -git+https://github.com/adarnof/django-navhelper -# awating pyghassen/openfire-restapi #1 to fix installation issues -git+https://github.com/adarnof/openfire-restapi +# Openfire +sleekxmpp +openfire-restapi -git+https://github.com/adarnof/adarnauth-esi +adarnauth-esi<2.0 diff --git a/runtests.py b/runtests.py index 4088735c..45c5201c 100644 --- a/runtests.py +++ b/runtests.py @@ -1,10 +1,9 @@ #!/usr/bin/env python -from __future__ import unicode_literals import os import sys if __name__ == "__main__": - os.environ['DJANGO_SETTINGS_MODULE'] = 'alliance_auth.tests.test_settings' + os.environ['DJANGO_SETTINGS_MODULE'] = 'test_allianceauth.settings' try: from django.core.management import execute_from_command_line diff --git a/services/__init__.py b/services/__init__.py deleted file mode 100644 index 5f118bbb..00000000 --- a/services/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -default_app_config = 'services.apps.ServicesConfig' diff --git a/services/apps.py b/services/apps.py deleted file mode 100644 index 7b4755de..00000000 --- a/services/apps.py +++ /dev/null @@ -1,10 +0,0 @@ -from __future__ import unicode_literals - -from django.apps import AppConfig - - -class ServicesConfig(AppConfig): - name = 'services' - - def ready(self): - import services.signals \ No newline at end of file diff --git a/services/managers/__init__.py b/services/managers/__init__.py deleted file mode 100644 index baffc488..00000000 --- a/services/managers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/services/modules/example/apps.py b/services/modules/example/apps.py deleted file mode 100644 index 8d49787c..00000000 --- a/services/modules/example/apps.py +++ /dev/null @@ -1,7 +0,0 @@ -from __future__ import unicode_literals - -from django.apps import AppConfig - - -class ExampleServiceConfig(AppConfig): - name = 'example_service' diff --git a/services/modules/smf/migrations/__init__.py b/services/modules/smf/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/modules/teamspeak3/__init__.py b/services/modules/teamspeak3/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/modules/teamspeak3/migrations/__init__.py b/services/modules/teamspeak3/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/modules/teamspeak3/util/__init__.py b/services/modules/teamspeak3/util/__init__.py deleted file mode 100755 index 81a621a7..00000000 --- a/services/modules/teamspeak3/util/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -__author__ = 'r4stl1n' diff --git a/services/modules/xenforo/__init__.py b/services/modules/xenforo/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/modules/xenforo/migrations/__init__.py b/services/modules/xenforo/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/templatetags/__init__.py b/services/templatetags/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/services/tests/__init__.py b/services/tests/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..a920f75a --- /dev/null +++ b/setup.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +from setuptools import setup +import allianceauth + + +setup( + name='allianceauth', + version=allianceauth.__version__, + author='Alliance Auth', + author_email='adarnof@gmail.com', + description='Eve alliance auth for the 99 percent', + # Any changes in these package requirements + # should be reflected in requirements.txt as well. + install_requires=[ + 'mysqlclient', + 'evelink', + 'dnspython', + 'passlib', + 'requests>=2.9.1', + 'bcrypt', + 'python-slugify>=1.2', + 'requests-oauthlib', + + 'redis', + 'celery>=4.0.2', + + 'django>=1.10,<2.0', + 'django-bootstrap-form', + 'django-bootstrap-pagination', + 'django-registration', + 'django-sortedm2m', + 'django-redis-cache>=1.7.1', + 'django-recaptcha', + 'django-celery-beat', + + # Openfire + 'openfire-restapi', + 'sleekxmpp', + + 'adarnauth-esi', + ], + license='GPLv2', + packages=['allianceauth'], + url='https://github.com/allianceauth/allianceauth', + zip_safe=False, + include_package_data=True, +) diff --git a/srp/__init__.py b/srp/__init__.py deleted file mode 100755 index baffc488..00000000 --- a/srp/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/srp/admin.py b/srp/admin.py deleted file mode 100755 index 53eff30a..00000000 --- a/srp/admin.py +++ /dev/null @@ -1,8 +0,0 @@ -from __future__ import unicode_literals -from django.contrib import admin - -from srp.models import SrpFleetMain -from srp.models import SrpUserRequest - -admin.site.register(SrpFleetMain) -admin.site.register(SrpUserRequest) diff --git a/srp/migrations/__init__.py b/srp/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/srp/urls.py b/srp/urls.py deleted file mode 100644 index 7d2da650..00000000 --- a/srp/urls.py +++ /dev/null @@ -1,31 +0,0 @@ -from django.conf.urls import url -import srp.views - -app_name = 'srp' - -urlpatterns = [ - # SRP URLS - url(r'^$', srp.views.srp_management, name='management'), - url(r'^all/$', srp.views.srp_management_all, name='all'), - url(r'^(\w+)/view$', srp.views.srp_fleet_view, name='fleet'), - url(r'^add/$', srp.views.srp_fleet_add_view, name='add'), - url(r'^(\w+)/edit$', srp.views.srp_fleet_edit_view, name='edit'), - url(r'^(\w+)/request', srp.views.srp_request_view, name='request'), - - # SRP URLS - url(r'^(\w+)/remove$', srp.views.srp_fleet_remove, name='remove'), - url(r'^(\w+)/disable$', srp.views.srp_fleet_disable, name='disable'), - url(r'^(\w+)/enable$', srp.views.srp_fleet_enable, name='enable'), - url(r'^(\w+)/complete$', srp.views.srp_fleet_mark_completed, - name='mark_completed'), - url(r'^(\w+)/incomplete$', srp.views.srp_fleet_mark_uncompleted, - name='mark_uncompleted'), - url(r'^request/remove/', srp.views.srp_request_remove, - name="request_remove"), - url(r'request/approve/', srp.views.srp_request_approve, - name='request_approve'), - url(r'request/reject/', srp.views.srp_request_reject, - name='request_reject'), - url(r'^request/(\w+)/update', srp.views.srp_request_update_amount, - name="request_update_amount"), - ] \ No newline at end of file diff --git a/static/.gitignore b/static/.gitignore deleted file mode 100644 index 7c9d611b..00000000 --- a/static/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -* -!.gitignore -!README.md diff --git a/static/README.md b/static/README.md deleted file mode 100644 index a402c777..00000000 --- a/static/README.md +++ /dev/null @@ -1,5 +0,0 @@ -Don't edit files in this folder. - -Populate the required static files with the command: - -`python manage.py collectstatic` diff --git a/services/modules/smf/__init__.py b/test_allianceauth/__init__.py similarity index 100% rename from services/modules/smf/__init__.py rename to test_allianceauth/__init__.py diff --git a/alliance_auth/tests/test_settings.py b/test_allianceauth/settings.py similarity index 85% rename from alliance_auth/tests/test_settings.py rename to test_allianceauth/settings.py index c3836c94..5399b1ba 100644 --- a/alliance_auth/tests/test_settings.py +++ b/test_allianceauth/settings.py @@ -39,34 +39,36 @@ INSTALLED_APPS = [ 'django.contrib.humanize', 'django_celery_beat', 'bootstrapform', - 'authentication', - 'services', - 'eveonline', - 'groupmanagement', - 'hrapplications', - 'timerboard', - 'srp', - 'optimer', - 'corputils', - 'fleetactivitytracking', - 'fleetup', - 'notifications', 'esi', - 'permissions_tool', - 'geelweb.django.navhelper', 'bootstrap_pagination', - 'services.modules.mumble', - 'services.modules.discord', - 'services.modules.discourse', - 'services.modules.ipboard', - 'services.modules.ips4', - 'services.modules.market', - 'services.modules.openfire', - 'services.modules.seat', - 'services.modules.smf', - 'services.modules.phpbb3', - 'services.modules.xenforo', - 'services.modules.teamspeak3', + 'allianceauth', + 'allianceauth.authentication', + 'allianceauth.services', + 'allianceauth.eveonline', + 'allianceauth.groupmanagement', + 'allianceauth.hrapplications', + 'allianceauth.timerboard', + 'allianceauth.srp', + 'allianceauth.optimer', + 'allianceauth.corputils', + 'allianceauth.fleetactivitytracking', + 'allianceauth.fleetup', + 'allianceauth.notifications', + 'allianceauth.permissions_tool', + 'allianceauth.thirdparty.navhelper', + + 'allianceauth.services.modules.mumble', + 'allianceauth.services.modules.discord', + 'allianceauth.services.modules.discourse', + 'allianceauth.services.modules.ipboard', + 'allianceauth.services.modules.ips4', + 'allianceauth.services.modules.market', + 'allianceauth.services.modules.openfire', + 'allianceauth.services.modules.seat', + 'allianceauth.services.modules.smf', + 'allianceauth.services.modules.phpbb3', + 'allianceauth.services.modules.xenforo', + 'allianceauth.services.modules.teamspeak3', 'django_nose', ] @@ -81,7 +83,7 @@ MIDDLEWARE = [ 'django.middleware.locale.LocaleMiddleware', ] -ROOT_URLCONF = 'alliance_auth.urls' +ROOT_URLCONF = 'test_allianceauth.urls' LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale/'), @@ -96,10 +98,7 @@ LOGIN_TOKEN_SCOPES = ['esi-characters.read_opportunities.v1'] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [ - os.path.join(BASE_DIR, 'customization/templates'), - os.path.join(BASE_DIR, 'stock/templates'), - ], + 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -111,9 +110,9 @@ TEMPLATES = [ 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', - 'services.context_processors.auth_settings', - 'notifications.context_processors.user_notification_count', - 'groupmanagement.context_processors.can_manage_groups', + 'allianceauth.services.context_processors.auth_settings', + 'allianceauth.notifications.context_processors.user_notification_count', + 'allianceauth.groupmanagement.context_processors.can_manage_groups', ], }, }, @@ -154,10 +153,6 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, "static") -STATICFILES_DIRS = ( - os.path.join(BASE_DIR, "customization/static"), - os.path.join(BASE_DIR, "stock/static"), -) # Bootstrap messaging css workaround MESSAGE_TAGS = { @@ -170,7 +165,7 @@ CACHES = { } } -AUTHENTICATION_BACKENDS = ['authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend'] +AUTHENTICATION_BACKENDS = ['allianceauth.authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend'] ##################################################### ## @@ -468,12 +463,12 @@ LOGGING = { }, 'notifications': { # creates notifications for users with logging_notifications permission 'level': 'ERROR', # edit this line to change logging level to notifications - 'class': 'notifications.handlers.NotificationHandler', + 'class': 'allianceauth.notifications.handlers.NotificationHandler', 'formatter': 'verbose', }, }, 'loggers': { - 'authentication': { + 'allianceauth': { 'handlers': ['console', 'notifications'], 'level': 'DEBUG', }, @@ -481,58 +476,6 @@ LOGGING = { 'handlers': ['console', 'notifications'], 'level': 'DEBUG', }, - 'eveonline': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'groupmanagement': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'hrapplications': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'portal': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'registration': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'services': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'srp': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'timerboard': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'sigtracker': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'optimer': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'corputils': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, - 'fleetactivitytracking': { - 'handlers': ['console', 'notifications'], - 'level': 'ERROR', - }, - 'util': { - 'handlers': ['console', 'notifications'], - 'level': 'DEBUG', - }, 'django': { 'handlers': ['console', 'notifications'], 'level': 'ERROR', diff --git a/test_allianceauth/urls.py b/test_allianceauth/urls.py new file mode 100644 index 00000000..53993dfd --- /dev/null +++ b/test_allianceauth/urls.py @@ -0,0 +1,14 @@ +from django.conf.urls import url +import allianceauth.urls +from . import views + +urlpatterns = allianceauth.urls.urlpatterns + +urlpatterns += [ + # Navhelper test urls + url(r'^main-page/$', views.page, name='p1'), + url(r'^main-page/sub-section/$', views.page, name='p1-s1'), + url(r'^second-page/$', views.page, name='p1'), +] + + diff --git a/test_allianceauth/views.py b/test_allianceauth/views.py new file mode 100644 index 00000000..bc14824c --- /dev/null +++ b/test_allianceauth/views.py @@ -0,0 +1,5 @@ +from django.http import HttpResponse + + +def page(request): + return HttpResponse('Hello World!') diff --git a/timerboard/__init__.py b/timerboard/__init__.py deleted file mode 100755 index baffc488..00000000 --- a/timerboard/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/timerboard/admin.py b/timerboard/admin.py deleted file mode 100755 index 7fa7802f..00000000 --- a/timerboard/admin.py +++ /dev/null @@ -1,6 +0,0 @@ -from __future__ import unicode_literals -from django.contrib import admin - -from timerboard.models import Timer - -admin.site.register(Timer) diff --git a/timerboard/migrations/__init__.py b/timerboard/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/timerboard/urls.py b/timerboard/urls.py deleted file mode 100644 index 88301cf1..00000000 --- a/timerboard/urls.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.conf.urls import url -import timerboard.views - -app_name = 'timerboard' - -urlpatterns = [ - url(r'^$', timerboard.views.timer_view, name='view'), - url(r'^add/$', timerboard.views.add_timer_view, name='add'), - url(r'^remove/(\w+)$', timerboard.views.remove_timer, name='remove'), - url(r'^edit/(\w+)$', timerboard.views.edit_timer, name='edit'), - ]