diff --git a/TODO.md b/TODO.md index 0042680b..9522428c 100644 --- a/TODO.md +++ b/TODO.md @@ -282,13 +282,10 @@ from django.utils import translation translation.activate('ca') ugettext("Description") - - * saas validate_creation generic approach, for all backends. standard output * html code x: × for bill line verbose quantity - * periodic task to cleanup backendlogs, monitor data and metricstorage * create orchestrate databases.Database pk=1 -n --dry-run | --noinput --action save (default)|delete --backend name (limit to this backend) --help @@ -301,12 +298,10 @@ celery max-tasks-per-child * make base home for systemusers that ara homed into main account systemuser, and prevent shell users to have nested homes (if nnot implemented already) - * autoscale celery workers http://docs.celeryproject.org/en/latest/userguide/workers.html#autoscaling * webapp has_website list filter - glic3rinu's django-fluent-dashboard * gevent is not ported to python3 :'( * uwsgi python3 @@ -322,13 +317,6 @@ https://code.djangoproject.com/ticket/24576 * read https://docs.djangoproject.com/en/dev/releases/1.8/ and fix deprecation warnings * remove admin object links , like contents webapps -* SaaS and WebApp fieldsets, and helptexts ! +* SaaS and WebApp types and services fieldsets, and helptexts ! -* remove all six stuff "from django.utils.six.moves import input" * replace make_option in management commands - - -* rename apps to contrib find . -type f -name "*py"|xargs grep apps | grep -v 'orchestra\.apps\.' - -* replace staticcheck by run(flake8 {orchestra,project} | grep -v "W293\|E501") -* rename utils.system to utils.sys diff --git a/orchestra/admin/menu.py b/orchestra/admin/menu.py index b653307f..a776611d 100644 --- a/orchestra/admin/menu.py +++ b/orchestra/admin/menu.py @@ -41,10 +41,10 @@ def get_services(): def get_accounts(): childrens=[] - if isinstalled('orchestra.apps.payments'): + if isinstalled('orchestra.contrib.payments'): url = reverse('admin:payments_transactionprocess_changelist') childrens.append(items.MenuItem(_("Transaction processes"), url)) - if isinstalled('orchestra.apps.issues'): + if isinstalled('orchestra.contrib.issues'): url = reverse('admin:issues_ticket_changelist') childrens.append(items.MenuItem(_("Tickets"), url)) for model, options in accounts.get().items(): @@ -59,12 +59,12 @@ def get_accounts(): def get_administration_items(): childrens = [] - if isinstalled('orchestra.apps.services'): + if isinstalled('orchestra.contrib.services'): url = reverse('admin:services_service_changelist') childrens.append(items.MenuItem(_("Services"), url)) url = reverse('admin:plans_plan_changelist') childrens.append(items.MenuItem(_("Plans"), url)) - if isinstalled('orchestra.apps.orchestration'): + if isinstalled('orchestra.contrib.orchestration'): route = reverse('admin:orchestration_route_changelist') backendlog = reverse('admin:orchestration_backendlog_changelist') server = reverse('admin:orchestration_server_changelist') @@ -73,7 +73,7 @@ def get_administration_items(): items.MenuItem(_("Backend logs"), backendlog), items.MenuItem(_("Servers"), server), ])) - if isinstalled('orchestra.apps.resources'): + if isinstalled('orchestra.contrib.resources'): resource = reverse('admin:resources_resource_changelist') data = reverse('admin:resources_resourcedata_changelist') monitor = reverse('admin:resources_monitordata_changelist') @@ -82,10 +82,10 @@ def get_administration_items(): items.MenuItem(_("Data"), data), items.MenuItem(_("Monitoring"), monitor), ])) - if isinstalled('orchestra.apps.miscellaneous'): + if isinstalled('orchestra.contrib.miscellaneous'): url = reverse('admin:miscellaneous_miscservice_changelist') childrens.append(items.MenuItem(_("Miscellaneous"), url)) - if isinstalled('orchestra.apps.issues'): + if isinstalled('orchestra.contrib.issues'): url = reverse('admin:issues_queue_changelist') childrens.append(items.MenuItem(_("Ticket queues"), url)) if isinstalled('djcelery'): diff --git a/orchestra/apps/resources/__init__.py b/orchestra/apps/resources/__init__.py deleted file mode 100644 index 3cc6c2dd..00000000 --- a/orchestra/apps/resources/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -from .backends import ServiceMonitor - - -default_app_config = 'orchestra.apps.resources.apps.ResourcesConfig' diff --git a/orchestra/conf/base_settings.py b/orchestra/conf/base_settings.py index a58cee8b..fee78fd1 100644 --- a/orchestra/conf/base_settings.py +++ b/orchestra/conf/base_settings.py @@ -36,7 +36,7 @@ MEDIA_URL = '/media/' ALLOWED_HOSTS = '*' # Set this to True to wrap each HTTP request in a transaction on this database. -# ATOMIC REQUESTS do not wrap middlewares (orchestra.apps.orchestration.middlewares.OperationsMiddleware) +# ATOMIC REQUESTS do not wrap middlewares (orchestra.contrib.orchestration.middlewares.OperationsMiddleware) ATOMIC_REQUESTS = False @@ -49,7 +49,7 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.messages.middleware.MessageMiddleware', 'orchestra.core.caches.RequestCacheMiddleware', # also handles transations, ATOMIC_REQUESTS does not wrap middlewares - 'orchestra.apps.orchestration.middlewares.OperationsMiddleware', + 'orchestra.contrib.orchestration.middlewares.OperationsMiddleware', # Uncomment the next line for simple clickjacking protection: # 'django.middleware.clickjacking.XFrameOptionsMiddleware', ) @@ -69,25 +69,25 @@ TEMPLATE_CONTEXT_PROCESSORS =( INSTALLED_APPS = ( # django-orchestra apps 'orchestra', - 'orchestra.apps.accounts', - 'orchestra.apps.contacts', - 'orchestra.apps.orchestration', - 'orchestra.apps.domains', - 'orchestra.apps.systemusers', - 'orchestra.apps.mailboxes', - 'orchestra.apps.lists', - 'orchestra.apps.webapps', - 'orchestra.apps.websites', - 'orchestra.apps.databases', - 'orchestra.apps.vps', - 'orchestra.apps.saas', - 'orchestra.apps.issues', - 'orchestra.apps.services', - 'orchestra.apps.plans', - 'orchestra.apps.orders', - 'orchestra.apps.miscellaneous', - 'orchestra.apps.bills', - 'orchestra.apps.payments', + 'orchestra.contrib.accounts', + 'orchestra.contrib.contacts', + 'orchestra.contrib.orchestration', + 'orchestra.contrib.domains', + 'orchestra.contrib.systemusers', + 'orchestra.contrib.mailboxes', + 'orchestra.contrib.lists', + 'orchestra.contrib.webapps', + 'orchestra.contrib.websites', + 'orchestra.contrib.databases', + 'orchestra.contrib.vps', + 'orchestra.contrib.saas', + 'orchestra.contrib.issues', + 'orchestra.contrib.services', + 'orchestra.contrib.plans', + 'orchestra.contrib.orders', + 'orchestra.contrib.miscellaneous', + 'orchestra.contrib.bills', + 'orchestra.contrib.payments', # Third-party apps 'django_extensions', @@ -111,7 +111,7 @@ INSTALLED_APPS = ( 'django.contrib.admin.apps.SimpleAdminConfig', # Last to load - 'orchestra.apps.resources', + 'orchestra.contrib.resources', ) @@ -144,29 +144,29 @@ FLUENT_DASHBOARD_APP_GROUPS = ( # Services group is generated by orchestra.admin.dashboard ('Accounts', { 'models': ( - 'orchestra.apps.accounts.models.Account', - 'orchestra.apps.contacts.models.Contact', - 'orchestra.apps.orders.models.Order', - 'orchestra.apps.plans.models.ContractedPlan', - 'orchestra.apps.bills.models.Bill', -# 'orchestra.apps.payments.models.PaymentSource', - 'orchestra.apps.payments.models.Transaction', -# 'orchestra.apps.payments.models.TransactionProcess', - 'orchestra.apps.issues.models.Ticket', + 'orchestra.contrib.accounts.models.Account', + 'orchestra.contrib.contacts.models.Contact', + 'orchestra.contrib.orders.models.Order', + 'orchestra.contrib.plans.models.ContractedPlan', + 'orchestra.contrib.bills.models.Bill', +# 'orchestra.contrib.payments.models.PaymentSource', + 'orchestra.contrib.payments.models.Transaction', +# 'orchestra.contrib.payments.models.TransactionProcess', + 'orchestra.contrib.issues.models.Ticket', ), 'collapsible': True, }), ('Administration', { 'models': ( 'djcelery.models.TaskState', - 'orchestra.apps.orchestration.models.Route', - 'orchestra.apps.orchestration.models.BackendLog', - 'orchestra.apps.orchestration.models.Server', - 'orchestra.apps.resources.models.Resource', - 'orchestra.apps.resources.models.ResourceData', - 'orchestra.apps.services.models.Service', - 'orchestra.apps.plans.models.Plan', - 'orchestra.apps.miscellaneous.models.MiscService', + 'orchestra.contrib.orchestration.models.Route', + 'orchestra.contrib.orchestration.models.BackendLog', + 'orchestra.contrib.orchestration.models.Server', + 'orchestra.contrib.resources.models.Resource', + 'orchestra.contrib.resources.models.ResourceData', + 'orchestra.contrib.services.models.Service', + 'orchestra.contrib.plans.models.Plan', + 'orchestra.contrib.miscellaneous.models.MiscService', ), 'collapsible': True, }), diff --git a/orchestra/apps/__init__.py b/orchestra/contrib/__init__.py similarity index 100% rename from orchestra/apps/__init__.py rename to orchestra/contrib/__init__.py diff --git a/orchestra/apps/accounts/__init__.py b/orchestra/contrib/accounts/__init__.py similarity index 100% rename from orchestra/apps/accounts/__init__.py rename to orchestra/contrib/accounts/__init__.py diff --git a/orchestra/apps/accounts/actions.py b/orchestra/contrib/accounts/actions.py similarity index 100% rename from orchestra/apps/accounts/actions.py rename to orchestra/contrib/accounts/actions.py diff --git a/orchestra/apps/accounts/admin.py b/orchestra/contrib/accounts/admin.py similarity index 98% rename from orchestra/apps/accounts/admin.py rename to orchestra/contrib/accounts/admin.py index 0e67ffea..f6952a79 100644 --- a/orchestra/apps/accounts/admin.py +++ b/orchestra/contrib/accounts/admin.py @@ -1,5 +1,6 @@ import copy import re +from urllib.parse import parse_qsl from django import forms from django.conf.urls import patterns, url @@ -8,7 +9,6 @@ from django.contrib.admin.util import unquote from django.contrib.auth import admin as auth from django.http import HttpResponseRedirect from django.utils.safestring import mark_safe -from django.utils.six.moves.urllib.parse import parse_qsl from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin @@ -80,11 +80,11 @@ class AccountAdmin(ChangePasswordAdminMixin, auth.UserAdmin, ExtendedModelAdmin) messages.warning(request, 'This account is disabled.') context = { 'services': sorted( - [ model._meta for model in services.get() if model is not Account ], + [model._meta for model in services.get() if model is not Account], key=lambda i: i.verbose_name_plural.lower() ), 'accounts': sorted( - [ model._meta for model in accounts.get() if model is not Account ], + [model._meta for model in accounts.get() if model is not Account], key=lambda i: i.verbose_name_plural.lower() ) } diff --git a/orchestra/apps/accounts/api.py b/orchestra/contrib/accounts/api.py similarity index 100% rename from orchestra/apps/accounts/api.py rename to orchestra/contrib/accounts/api.py diff --git a/orchestra/apps/accounts/filters.py b/orchestra/contrib/accounts/filters.py similarity index 100% rename from orchestra/apps/accounts/filters.py rename to orchestra/contrib/accounts/filters.py diff --git a/orchestra/apps/accounts/forms.py b/orchestra/contrib/accounts/forms.py similarity index 100% rename from orchestra/apps/accounts/forms.py rename to orchestra/contrib/accounts/forms.py diff --git a/orchestra/apps/accounts/models.py b/orchestra/contrib/accounts/models.py similarity index 86% rename from orchestra/apps/accounts/models.py rename to orchestra/contrib/accounts/models.py index 40b8fc94..2ba91360 100644 --- a/orchestra/apps/accounts/models.py +++ b/orchestra/contrib/accounts/models.py @@ -5,8 +5,8 @@ from django.db.models.loading import get_model from django.utils import timezone from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration.middlewares import OperationsMiddleware -from orchestra.apps.orchestration.models import BackendOperation as Operation +from orchestra.contrib.orchestration.middlewares import OperationsMiddleware +from orchestra.contrib.orchestration.models import BackendOperation as Operation from orchestra.core import services, accounts from orchestra.utils import send_email_template @@ -16,26 +16,27 @@ from . import settings class Account(auth.AbstractBaseUser): # Username max_length determined by LINUX system user lentgh: 32 username = models.CharField(_("username"), max_length=32, unique=True, - help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), - validators=[validators.RegexValidator(r'^[\w.-]+$', - _("Enter a valid username."), 'invalid')]) + help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), + validators=[ + validators.RegexValidator(r'^[\w.-]+$', _("Enter a valid username."), 'invalid') + ]) main_systemuser = models.ForeignKey(settings.ACCOUNTS_SYSTEMUSER_MODEL, null=True, - related_name='accounts_main', editable=False) + related_name='accounts_main', editable=False) short_name = models.CharField(_("short name"), max_length=64, blank=True) full_name = models.CharField(_("full name"), max_length=256) email = models.EmailField(_('email address'), help_text=_("Used for password recovery")) type = models.CharField(_("type"), choices=settings.ACCOUNTS_TYPES, - max_length=32, default=settings.ACCOUNTS_DEFAULT_TYPE) + max_length=32, default=settings.ACCOUNTS_DEFAULT_TYPE) language = models.CharField(_("language"), max_length=2, - choices=settings.ACCOUNTS_LANGUAGES, - default=settings.ACCOUNTS_DEFAULT_LANGUAGE) + choices=settings.ACCOUNTS_LANGUAGES, + default=settings.ACCOUNTS_DEFAULT_LANGUAGE) comments = models.TextField(_("comments"), max_length=256, blank=True) is_superuser = models.BooleanField(_("superuser status"), default=False, - help_text=_("Designates that this user has all permissions without " - "explicitly assigning them.")) + help_text=_("Designates that this user has all permissions without " + "explicitly assigning them.")) is_active = models.BooleanField(_("active"), default=True, - help_text=_("Designates whether this account should be treated as active. " - "Unselect this instead of deleting accounts.")) + help_text=_("Designates whether this account should be treated as active. " + "Unselect this instead of deleting accounts.")) date_joined = models.DateTimeField(_("date joined"), default=timezone.now) objects = auth.UserManager() diff --git a/orchestra/apps/accounts/serializers.py b/orchestra/contrib/accounts/serializers.py similarity index 100% rename from orchestra/apps/accounts/serializers.py rename to orchestra/contrib/accounts/serializers.py diff --git a/orchestra/apps/accounts/settings.py b/orchestra/contrib/accounts/settings.py similarity index 100% rename from orchestra/apps/accounts/settings.py rename to orchestra/contrib/accounts/settings.py diff --git a/orchestra/apps/accounts/templates/admin/accounts/account/change_form.html b/orchestra/contrib/accounts/templates/admin/accounts/account/change_form.html similarity index 100% rename from orchestra/apps/accounts/templates/admin/accounts/account/change_form.html rename to orchestra/contrib/accounts/templates/admin/accounts/account/change_form.html diff --git a/orchestra/apps/accounts/templates/admin/accounts/account/change_list.html b/orchestra/contrib/accounts/templates/admin/accounts/account/change_list.html similarity index 100% rename from orchestra/apps/accounts/templates/admin/accounts/account/change_list.html rename to orchestra/contrib/accounts/templates/admin/accounts/account/change_list.html diff --git a/orchestra/apps/accounts/templates/admin/accounts/account/service_report.html b/orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html similarity index 100% rename from orchestra/apps/accounts/templates/admin/accounts/account/service_report.html rename to orchestra/contrib/accounts/templates/admin/accounts/account/service_report.html diff --git a/orchestra/apps/bills/__init__.py b/orchestra/contrib/bills/__init__.py similarity index 100% rename from orchestra/apps/bills/__init__.py rename to orchestra/contrib/bills/__init__.py diff --git a/orchestra/apps/bills/actions.py b/orchestra/contrib/bills/actions.py similarity index 100% rename from orchestra/apps/bills/actions.py rename to orchestra/contrib/bills/actions.py diff --git a/orchestra/apps/bills/admin.py b/orchestra/contrib/bills/admin.py similarity index 99% rename from orchestra/apps/bills/admin.py rename to orchestra/contrib/bills/admin.py index 020e665c..74448d89 100644 --- a/orchestra/apps/bills/admin.py +++ b/orchestra/contrib/bills/admin.py @@ -10,7 +10,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import admin_date, insertattr -from orchestra.apps.accounts.admin import AccountAdminMixin, AccountAdmin +from orchestra.contrib.accounts.admin import AccountAdminMixin, AccountAdmin from orchestra.forms.widgets import paddingCheckboxSelectMultiple from . import settings, actions diff --git a/orchestra/apps/bills/api.py b/orchestra/contrib/bills/api.py similarity index 93% rename from orchestra/apps/bills/api.py rename to orchestra/contrib/bills/api.py index f7f6054c..c0ae655d 100644 --- a/orchestra/apps/bills/api.py +++ b/orchestra/contrib/bills/api.py @@ -3,7 +3,7 @@ from rest_framework import viewsets from rest_framework.decorators import detail_route from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from orchestra.utils.html import html_to_pdf from .models import Bill diff --git a/orchestra/apps/bills/filters.py b/orchestra/contrib/bills/filters.py similarity index 100% rename from orchestra/apps/bills/filters.py rename to orchestra/contrib/bills/filters.py diff --git a/orchestra/apps/bills/forms.py b/orchestra/contrib/bills/forms.py similarity index 95% rename from orchestra/apps/bills/forms.py rename to orchestra/contrib/bills/forms.py index 71378909..955fb8f8 100644 --- a/orchestra/apps/bills/forms.py +++ b/orchestra/contrib/bills/forms.py @@ -6,12 +6,10 @@ from orchestra.forms.widgets import ShowTextWidget class SelectSourceForm(forms.ModelForm): - bill_link = forms.CharField(label=_("Number"), required=False, - widget=ShowTextWidget()) + bill_link = forms.CharField(label=_("Number"), required=False, widget=ShowTextWidget()) account_link = forms.CharField(label=_("Account"), required=False) display_total = forms.CharField(label=_("Total"), required=False) - display_type = forms.CharField(label=_("Type"), required=False, - widget=ShowTextWidget()) + display_type = forms.CharField(label=_("Type"), required=False, widget=ShowTextWidget()) source = forms.ChoiceField(label=_("Source"), required=False) class Meta: diff --git a/orchestra/apps/bills/helpers.py b/orchestra/contrib/bills/helpers.py similarity index 100% rename from orchestra/apps/bills/helpers.py rename to orchestra/contrib/bills/helpers.py diff --git a/orchestra/apps/bills/locale/ca/LC_MESSAGES/django.mo b/orchestra/contrib/bills/locale/ca/LC_MESSAGES/django.mo similarity index 100% rename from orchestra/apps/bills/locale/ca/LC_MESSAGES/django.mo rename to orchestra/contrib/bills/locale/ca/LC_MESSAGES/django.mo diff --git a/orchestra/apps/bills/locale/ca/LC_MESSAGES/django.po b/orchestra/contrib/bills/locale/ca/LC_MESSAGES/django.po similarity index 100% rename from orchestra/apps/bills/locale/ca/LC_MESSAGES/django.po rename to orchestra/contrib/bills/locale/ca/LC_MESSAGES/django.po diff --git a/orchestra/apps/bills/models.py b/orchestra/contrib/bills/models.py similarity index 95% rename from orchestra/apps/bills/models.py rename to orchestra/contrib/bills/models.py index 4b9804bc..e46778ec 100644 --- a/orchestra/apps/bills/models.py +++ b/orchestra/contrib/bills/models.py @@ -8,8 +8,8 @@ from django.utils.encoding import force_text from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.accounts.models import Account -from orchestra.apps.contacts.models import Contact +from orchestra.contrib.accounts.models import Account +from orchestra.contrib.contacts.models import Contact from orchestra.core import accounts, validators from orchestra.utils.html import html_to_pdf @@ -18,17 +18,17 @@ from . import settings class BillContact(models.Model): account = models.OneToOneField('accounts.Account', verbose_name=_("account"), - related_name='billcontact') + related_name='billcontact') name = models.CharField(_("name"), max_length=256, blank=True, - help_text=_("Account full name will be used when left blank.")) + help_text=_("Account full name will be used when left blank.")) address = models.TextField(_("address")) city = models.CharField(_("city"), max_length=128, - default=settings.BILLS_CONTACT_DEFAULT_CITY) + default=settings.BILLS_CONTACT_DEFAULT_CITY) zipcode = models.CharField(_("zip code"), max_length=10, - validators=[RegexValidator(r'^[0-9A-Z]{3,10}$', _("Enter a valid zipcode."))]) + validators=[RegexValidator(r'^[0-9A-Z]{3,10}$', _("Enter a valid zipcode."))]) country = models.CharField(_("country"), max_length=20, - choices=settings.BILLS_CONTACT_COUNTRIES, - default=settings.BILLS_CONTACT_DEFAULT_COUNTRY) + choices=settings.BILLS_CONTACT_COUNTRIES, + default=settings.BILLS_CONTACT_DEFAULT_COUNTRY) vat = models.CharField(_("VAT number"), max_length=64) def __str__(self): @@ -81,7 +81,7 @@ class Bill(models.Model): number = models.CharField(_("number"), max_length=16, unique=True, blank=True) account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='%(class)s') + related_name='%(class)s') type = models.CharField(_("type"), max_length=16, choices=TYPES) created_on = models.DateField(_("created on"), auto_now_add=True) closed_on = models.DateField(_("closed on"), blank=True, null=True) @@ -279,7 +279,7 @@ class BillLine(models.Model): # end = models.DateTimeField(null=True) order = models.ForeignKey(settings.BILLS_ORDER_MODEL, null=True, blank=True, - help_text=_("Informative link back to the order"), on_delete=models.SET_NULL) + help_text=_("Informative link back to the order"), on_delete=models.SET_NULL) order_billed_on = models.DateField(_("order billed"), null=True, blank=True) order_billed_until = models.DateField(_("order billed until"), null=True, blank=True) created_on = models.DateField(_("created"), auto_now_add=True) diff --git a/orchestra/apps/bills/serializers.py b/orchestra/contrib/bills/serializers.py similarity index 86% rename from orchestra/apps/bills/serializers.py rename to orchestra/contrib/bills/serializers.py index b4dc2548..b74d8f2e 100644 --- a/orchestra/apps/bills/serializers.py +++ b/orchestra/contrib/bills/serializers.py @@ -1,8 +1,8 @@ from rest_framework import serializers from orchestra.api import router -from orchestra.apps.accounts.models import Account -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.models import Account +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .models import Bill, BillLine, BillContact diff --git a/orchestra/apps/bills/settings.py b/orchestra/contrib/bills/settings.py similarity index 100% rename from orchestra/apps/bills/settings.py rename to orchestra/contrib/bills/settings.py diff --git a/orchestra/apps/bills/templates/bills/base.html b/orchestra/contrib/bills/templates/bills/base.html similarity index 100% rename from orchestra/apps/bills/templates/bills/base.html rename to orchestra/contrib/bills/templates/bills/base.html diff --git a/orchestra/apps/bills/templates/bills/bill-notification.email b/orchestra/contrib/bills/templates/bills/bill-notification.email similarity index 100% rename from orchestra/apps/bills/templates/bills/bill-notification.email rename to orchestra/contrib/bills/templates/bills/bill-notification.email diff --git a/orchestra/apps/bills/templates/bills/invoice.html b/orchestra/contrib/bills/templates/bills/invoice.html similarity index 100% rename from orchestra/apps/bills/templates/bills/invoice.html rename to orchestra/contrib/bills/templates/bills/invoice.html diff --git a/orchestra/apps/bills/templates/bills/microspective-fee.html b/orchestra/contrib/bills/templates/bills/microspective-fee.html similarity index 100% rename from orchestra/apps/bills/templates/bills/microspective-fee.html rename to orchestra/contrib/bills/templates/bills/microspective-fee.html diff --git a/orchestra/apps/bills/templates/bills/microspective-proforma.html b/orchestra/contrib/bills/templates/bills/microspective-proforma.html similarity index 100% rename from orchestra/apps/bills/templates/bills/microspective-proforma.html rename to orchestra/contrib/bills/templates/bills/microspective-proforma.html diff --git a/orchestra/apps/bills/templates/bills/microspective.css b/orchestra/contrib/bills/templates/bills/microspective.css similarity index 100% rename from orchestra/apps/bills/templates/bills/microspective.css rename to orchestra/contrib/bills/templates/bills/microspective.css diff --git a/orchestra/apps/bills/templates/bills/microspective.html b/orchestra/contrib/bills/templates/bills/microspective.html similarity index 100% rename from orchestra/apps/bills/templates/bills/microspective.html rename to orchestra/contrib/bills/templates/bills/microspective.html diff --git a/orchestra/apps/contacts/__init__.py b/orchestra/contrib/contacts/__init__.py similarity index 100% rename from orchestra/apps/contacts/__init__.py rename to orchestra/contrib/contacts/__init__.py diff --git a/orchestra/apps/contacts/admin.py b/orchestra/contrib/contacts/admin.py similarity index 98% rename from orchestra/apps/contacts/admin.py rename to orchestra/contrib/contacts/admin.py index b23d10df..965e4732 100644 --- a/orchestra/apps/contacts/admin.py +++ b/orchestra/contrib/contacts/admin.py @@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import AtLeastOneRequiredInlineFormSet, ExtendedModelAdmin from orchestra.admin.actions import SendEmail from orchestra.admin.utils import insertattr, change_url -from orchestra.apps.accounts.admin import AccountAdmin, AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdmin, AccountAdminMixin from orchestra.forms.widgets import paddingCheckboxSelectMultiple from .filters import EmailUsageListFilter diff --git a/orchestra/apps/contacts/api.py b/orchestra/contrib/contacts/api.py similarity index 84% rename from orchestra/apps/contacts/api.py rename to orchestra/contrib/contacts/api.py index 72574f5f..164ae2d4 100644 --- a/orchestra/apps/contacts/api.py +++ b/orchestra/contrib/contacts/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import Contact from .serializers import ContactSerializer diff --git a/orchestra/apps/contacts/filters.py b/orchestra/contrib/contacts/filters.py similarity index 100% rename from orchestra/apps/contacts/filters.py rename to orchestra/contrib/contacts/filters.py diff --git a/orchestra/apps/contacts/models.py b/orchestra/contrib/contacts/models.py similarity index 86% rename from orchestra/apps/contacts/models.py rename to orchestra/contrib/contacts/models.py index 1001a93d..0f29547a 100644 --- a/orchestra/apps/contacts/models.py +++ b/orchestra/contrib/contacts/models.py @@ -35,25 +35,27 @@ class Contact(models.Model): objects = ContactQuerySet.as_manager() account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='contacts', null=True) + related_name='contacts', null=True) short_name = models.CharField(_("short name"), max_length=128) full_name = models.CharField(_("full name"), max_length=256, blank=True) email = models.EmailField() email_usage = MultiSelectField(_("email usage"), max_length=256, blank=True, - choices=EMAIL_USAGES, - default=settings.CONTACTS_DEFAULT_EMAIL_USAGES) + choices=EMAIL_USAGES, + default=settings.CONTACTS_DEFAULT_EMAIL_USAGES) phone = models.CharField(_("phone"), max_length=32, blank=True, - validators=[validate_phone]) + validators=[validate_phone]) phone2 = models.CharField(_("alternative phone"), max_length=32, blank=True, - validators=[validate_phone]) + validators=[validate_phone]) address = models.TextField(_("address"), blank=True) city = models.CharField(_("city"), max_length=128, blank=True) zipcode = models.CharField(_("zip code"), max_length=10, blank=True, - validators=[RegexValidator(r'^[0-9,A-Z]{3,10}$', - _("Enter a valid zipcode."), 'invalid')]) + validators=[ + RegexValidator(r'^[0-9,A-Z]{3,10}$', + _("Enter a valid zipcode."), 'invalid') + ]) country = models.CharField(_("country"), max_length=20, blank=True, - choices=settings.CONTACTS_COUNTRIES, - default=settings.CONTACTS_DEFAULT_COUNTRY) + choices=settings.CONTACTS_COUNTRIES, + default=settings.CONTACTS_DEFAULT_COUNTRY) def __str__(self): return self.full_name or self.short_name diff --git a/orchestra/apps/contacts/serializers.py b/orchestra/contrib/contacts/serializers.py similarity index 86% rename from orchestra/apps/contacts/serializers.py rename to orchestra/contrib/contacts/serializers.py index 41f3240d..3d25d911 100644 --- a/orchestra/apps/contacts/serializers.py +++ b/orchestra/contrib/contacts/serializers.py @@ -1,7 +1,7 @@ from rest_framework import serializers from orchestra.api.serializers import MultiSelectField -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .models import Contact diff --git a/orchestra/apps/contacts/settings.py b/orchestra/contrib/contacts/settings.py similarity index 100% rename from orchestra/apps/contacts/settings.py rename to orchestra/contrib/contacts/settings.py diff --git a/orchestra/apps/databases/__init__.py b/orchestra/contrib/databases/__init__.py similarity index 100% rename from orchestra/apps/databases/__init__.py rename to orchestra/contrib/databases/__init__.py diff --git a/orchestra/apps/databases/admin.py b/orchestra/contrib/databases/admin.py similarity index 98% rename from orchestra/apps/databases/admin.py rename to orchestra/contrib/databases/admin.py index 9cc6727c..df02e8f0 100644 --- a/orchestra/apps/databases/admin.py +++ b/orchestra/contrib/databases/admin.py @@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin from orchestra.admin.utils import change_url -from orchestra.apps.accounts.admin import SelectAccountAdminMixin +from orchestra.contrib.accounts.admin import SelectAccountAdminMixin from .forms import DatabaseCreationForm, DatabaseUserChangeForm, DatabaseUserCreationForm from .models import Database, DatabaseUser diff --git a/orchestra/apps/databases/api.py b/orchestra/contrib/databases/api.py similarity index 91% rename from orchestra/apps/databases/api.py rename to orchestra/contrib/databases/api.py index a04ee569..645e20e1 100644 --- a/orchestra/apps/databases/api.py +++ b/orchestra/contrib/databases/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router, SetPasswordApiMixin -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import Database, DatabaseUser from .serializers import DatabaseSerializer, DatabaseUserSerializer diff --git a/orchestra/apps/databases/backends.py b/orchestra/contrib/databases/backends.py similarity index 97% rename from orchestra/apps/databases/backends.py rename to orchestra/contrib/databases/backends.py index 6c311383..4746c5e7 100644 --- a/orchestra/apps/databases/backends.py +++ b/orchestra/contrib/databases/backends.py @@ -2,8 +2,8 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.resources import ServiceMonitor from . import settings diff --git a/orchestra/apps/databases/forms.py b/orchestra/contrib/databases/forms.py similarity index 100% rename from orchestra/apps/databases/forms.py rename to orchestra/contrib/databases/forms.py diff --git a/orchestra/apps/databases/models.py b/orchestra/contrib/databases/models.py similarity index 100% rename from orchestra/apps/databases/models.py rename to orchestra/contrib/databases/models.py diff --git a/orchestra/apps/databases/serializers.py b/orchestra/contrib/databases/serializers.py similarity index 97% rename from orchestra/apps/databases/serializers.py rename to orchestra/contrib/databases/serializers.py index f191403f..e07d2d7b 100644 --- a/orchestra/apps/databases/serializers.py +++ b/orchestra/contrib/databases/serializers.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from orchestra.core.validators import validate_password from .models import Database, DatabaseUser diff --git a/orchestra/apps/databases/settings.py b/orchestra/contrib/databases/settings.py similarity index 100% rename from orchestra/apps/databases/settings.py rename to orchestra/contrib/databases/settings.py diff --git a/orchestra/apps/databases/tests/__init__.py b/orchestra/contrib/databases/tests/__init__.py similarity index 100% rename from orchestra/apps/databases/tests/__init__.py rename to orchestra/contrib/databases/tests/__init__.py diff --git a/orchestra/apps/databases/tests/functional_tests/__init__.py b/orchestra/contrib/databases/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/databases/tests/functional_tests/__init__.py rename to orchestra/contrib/databases/tests/functional_tests/__init__.py diff --git a/orchestra/apps/databases/tests/functional_tests/tests.py b/orchestra/contrib/databases/tests/functional_tests/tests.py similarity index 98% rename from orchestra/apps/databases/tests/functional_tests/tests.py rename to orchestra/contrib/databases/tests/functional_tests/tests.py index b3f19afd..ea07c813 100644 --- a/orchestra/apps/databases/tests/functional_tests/tests.py +++ b/orchestra/contrib/databases/tests/functional_tests/tests.py @@ -9,8 +9,8 @@ from django.core.urlresolvers import reverse from selenium.webdriver.support.select import Select from orchestra.admin.utils import change_url -from orchestra.apps.orchestration.models import Server, Route -from orchestra.utils.system import sshrun +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.utils.sys import sshrun from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, save_response_on_error, snapshot_on_error) @@ -21,7 +21,7 @@ from ...models import Database, DatabaseUser class DatabaseTestMixin(object): MASTER_SERVER = os.environ.get('ORCHESTRA_SECOND_SERVER', 'localhost') DEPENDENCIES = ( - 'orchestra.apps.orchestration', + 'orchestra.contrib.orchestration', 'orcgestra.apps.databases', ) diff --git a/orchestra/apps/domains/__init__.py b/orchestra/contrib/domains/__init__.py similarity index 100% rename from orchestra/apps/domains/__init__.py rename to orchestra/contrib/domains/__init__.py diff --git a/orchestra/apps/domains/actions.py b/orchestra/contrib/domains/actions.py similarity index 100% rename from orchestra/apps/domains/actions.py rename to orchestra/contrib/domains/actions.py diff --git a/orchestra/apps/domains/admin.py b/orchestra/contrib/domains/admin.py similarity index 96% rename from orchestra/apps/domains/admin.py rename to orchestra/contrib/domains/admin.py index 0769ebb5..d55dfb38 100644 --- a/orchestra/apps/domains/admin.py +++ b/orchestra/contrib/domains/admin.py @@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import admin_link, change_url -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from orchestra.utils import apps from .actions import view_zone @@ -86,7 +86,7 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin): display_is_top.admin_order_field = 'top' def display_websites(self, domain): - if apps.isinstalled('orchestra.apps.websites'): + if apps.isinstalled('orchestra.contrib.websites'): webs = domain.websites.all() if webs: links = [] @@ -111,7 +111,7 @@ class DomainAdmin(AccountAdminMixin, ExtendedModelAdmin): 'structured_name': 'CONCAT({table}.name, domains_domain.name)'.format(table=table) }, ).order_by('structured_name') - if apps.isinstalled('orchestra.apps.websites'): + if apps.isinstalled('orchestra.contrib.websites'): qs = qs.prefetch_related('websites') return qs diff --git a/orchestra/apps/domains/api.py b/orchestra/contrib/domains/api.py similarity index 94% rename from orchestra/apps/domains/api.py rename to orchestra/contrib/domains/api.py index e4e62045..d9728994 100644 --- a/orchestra/apps/domains/api.py +++ b/orchestra/contrib/domains/api.py @@ -3,7 +3,7 @@ from rest_framework.decorators import link from rest_framework.response import Response from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from . import settings from .models import Domain diff --git a/orchestra/apps/domains/backends.py b/orchestra/contrib/domains/backends.py similarity index 96% rename from orchestra/apps/domains/backends.py rename to orchestra/contrib/domains/backends.py index 45a6a9c8..c5570646 100644 --- a/orchestra/apps/domains/backends.py +++ b/orchestra/contrib/domains/backends.py @@ -3,8 +3,8 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.orchestration.models import BackendOperation as Operation +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.orchestration.models import BackendOperation as Operation from . import settings @@ -79,7 +79,7 @@ class Bind9MasterDomainBackend(ServiceController): def get_servers(self, domain, backend): """ Get related server IPs from registered backend routes """ - from orchestra.apps.orchestration.manager import router + from orchestra.contrib.orchestration.manager import router operation = Operation.create(backend, domain, Operation.SAVE) servers = [] for server in router.get_servers(operation): diff --git a/orchestra/apps/domains/filters.py b/orchestra/contrib/domains/filters.py similarity index 100% rename from orchestra/apps/domains/filters.py rename to orchestra/contrib/domains/filters.py diff --git a/orchestra/apps/domains/forms.py b/orchestra/contrib/domains/forms.py similarity index 96% rename from orchestra/apps/domains/forms.py rename to orchestra/contrib/domains/forms.py index 3b2c96b1..1b853a06 100644 --- a/orchestra/apps/domains/forms.py +++ b/orchestra/contrib/domains/forms.py @@ -9,7 +9,7 @@ from .models import Domain class BatchDomainCreationAdminForm(forms.ModelForm): name = forms.CharField(label=_("Names"), widget=forms.Textarea(attrs={'rows': 5, 'cols': 50}), - help_text=_("Domain per line. All domains will share the same attributes.")) + help_text=_("Domain per line. All domains will share the same attributes.")) def clean_name(self): self.extra_names = [] diff --git a/orchestra/apps/domains/helpers.py b/orchestra/contrib/domains/helpers.py similarity index 100% rename from orchestra/apps/domains/helpers.py rename to orchestra/contrib/domains/helpers.py diff --git a/orchestra/apps/domains/models.py b/orchestra/contrib/domains/models.py similarity index 94% rename from orchestra/apps/domains/models.py rename to orchestra/contrib/domains/models.py index 87ad0b80..8984b252 100644 --- a/orchestra/apps/domains/models.py +++ b/orchestra/contrib/domains/models.py @@ -11,17 +11,17 @@ from . import settings, validators, utils class Domain(models.Model): name = models.CharField(_("name"), max_length=256, unique=True, - help_text=_("Domain or subdomain name."), - validators=[ - validators.validate_domain_name, - validators.validate_allowed_domain - ]) + help_text=_("Domain or subdomain name."), + validators=[ + validators.validate_domain_name, + validators.validate_allowed_domain + ]) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), blank=True, - related_name='domains', help_text=_("Automatically selected for subdomains.")) + related_name='domains', help_text=_("Automatically selected for subdomains.")) top = models.ForeignKey('domains.Domain', null=True, related_name='subdomain_set', - editable=False) + editable=False) serial = models.IntegerField(_("serial"), default=utils.generate_zone_serial, - help_text=_("Serial number")) + help_text=_("Serial number")) def __str__(self): return self.name @@ -223,8 +223,8 @@ class Record(models.Model): domain = models.ForeignKey(Domain, verbose_name=_("domain"), related_name='records') ttl = models.CharField(_("TTL"), max_length=8, blank=True, - help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL, - validators=[validators.validate_zone_interval]) + help_text=_("Record TTL, defaults to %s") % settings.DOMAINS_DEFAULT_TTL, + validators=[validators.validate_zone_interval]) type = models.CharField(_("type"), max_length=32, choices=TYPE_CHOICES) value = models.CharField(_("value"), max_length=256) diff --git a/orchestra/apps/domains/serializers.py b/orchestra/contrib/domains/serializers.py similarity index 95% rename from orchestra/apps/domains/serializers.py rename to orchestra/contrib/domains/serializers.py index 8e3a0b63..8be6de8d 100644 --- a/orchestra/apps/domains/serializers.py +++ b/orchestra/contrib/domains/serializers.py @@ -3,7 +3,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .helpers import domain_for_validation from .models import Domain, Record diff --git a/orchestra/apps/domains/settings.py b/orchestra/contrib/domains/settings.py similarity index 99% rename from orchestra/apps/domains/settings.py rename to orchestra/contrib/domains/settings.py index bbcd4dbc..094ff445 100644 --- a/orchestra/apps/domains/settings.py +++ b/orchestra/contrib/domains/settings.py @@ -88,4 +88,5 @@ DOMAINS_FORBIDDEN = getattr(settings, 'DOMAINS_FORBIDDEN', # unzip -p /tmp/top-1m.csv.zip | head -n 5000 | sed "s/^.*,//" > forbidden_domains.list # '%(site_dir)s/forbidden_domains.list') - '') + '' +) diff --git a/orchestra/apps/domains/templates/admin/domains/domain/change_form.html b/orchestra/contrib/domains/templates/admin/domains/domain/change_form.html similarity index 100% rename from orchestra/apps/domains/templates/admin/domains/domain/change_form.html rename to orchestra/contrib/domains/templates/admin/domains/domain/change_form.html diff --git a/orchestra/apps/domains/templates/admin/domains/domain/view_zone.html b/orchestra/contrib/domains/templates/admin/domains/domain/view_zone.html similarity index 100% rename from orchestra/apps/domains/templates/admin/domains/domain/view_zone.html rename to orchestra/contrib/domains/templates/admin/domains/domain/view_zone.html diff --git a/orchestra/apps/domains/tests/__init__.py b/orchestra/contrib/domains/tests/__init__.py similarity index 100% rename from orchestra/apps/domains/tests/__init__.py rename to orchestra/contrib/domains/tests/__init__.py diff --git a/orchestra/apps/domains/tests/functional_tests/__init__.py b/orchestra/contrib/domains/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/domains/tests/functional_tests/__init__.py rename to orchestra/contrib/domains/tests/functional_tests/__init__.py diff --git a/orchestra/apps/domains/tests/functional_tests/tests.py b/orchestra/contrib/domains/tests/functional_tests/tests.py similarity index 98% rename from orchestra/apps/domains/tests/functional_tests/tests.py rename to orchestra/contrib/domains/tests/functional_tests/tests.py index 981f703f..5bff4901 100644 --- a/orchestra/apps/domains/tests/functional_tests/tests.py +++ b/orchestra/contrib/domains/tests/functional_tests/tests.py @@ -7,9 +7,9 @@ from django.conf import settings as djsettings from django.core.urlresolvers import reverse from selenium.webdriver.support.select import Select -from orchestra.apps.orchestration.models import Server, Route +from orchestra.contrib.orchestration.models import Server, Route from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error -from orchestra.utils.system import run +from orchestra.utils.sys import run from ... import settings, utils, backends from ...models import Domain, Record @@ -305,7 +305,7 @@ class RESTDomainMixin(DomainTestMixin): class Bind9BackendMixin(object): DEPENDENCIES = ( - 'orchestra.apps.orchestration', + 'orchestra.contrib.orchestration', ) def add_route(self): diff --git a/orchestra/apps/domains/tests/test_domains.py b/orchestra/contrib/domains/tests/test_domains.py similarity index 100% rename from orchestra/apps/domains/tests/test_domains.py rename to orchestra/contrib/domains/tests/test_domains.py diff --git a/orchestra/apps/domains/utils.py b/orchestra/contrib/domains/utils.py similarity index 100% rename from orchestra/apps/domains/utils.py rename to orchestra/contrib/domains/utils.py diff --git a/orchestra/apps/domains/validators.py b/orchestra/contrib/domains/validators.py similarity index 99% rename from orchestra/apps/domains/validators.py rename to orchestra/contrib/domains/validators.py index b8c46f28..56d37770 100644 --- a/orchestra/apps/domains/validators.py +++ b/orchestra/contrib/domains/validators.py @@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.core.validators import validate_hostname from orchestra.utils import paths -from orchestra.utils.system import run +from orchestra.utils.sys import run from . import settings diff --git a/orchestra/apps/issues/__init__.py b/orchestra/contrib/issues/__init__.py similarity index 100% rename from orchestra/apps/issues/__init__.py rename to orchestra/contrib/issues/__init__.py diff --git a/orchestra/apps/issues/actions.py b/orchestra/contrib/issues/actions.py similarity index 100% rename from orchestra/apps/issues/actions.py rename to orchestra/contrib/issues/actions.py diff --git a/orchestra/apps/issues/admin.py b/orchestra/contrib/issues/admin.py similarity index 99% rename from orchestra/apps/issues/admin.py rename to orchestra/contrib/issues/admin.py index a80d3d5d..cc8bc631 100644 --- a/orchestra/apps/issues/admin.py +++ b/orchestra/contrib/issues/admin.py @@ -11,7 +11,7 @@ from markdown import markdown from orchestra.admin import ChangeListDefaultFilter, ExtendedModelAdmin#, ChangeViewActions from orchestra.admin.utils import admin_link, admin_colored, wrap_admin_view, admin_date -from orchestra.apps.contacts.models import Contact +from orchestra.contrib.contacts.models import Contact from .actions import (reject_tickets, resolve_tickets, take_tickets, close_tickets, mark_as_unread, mark_as_read, set_default_queue) diff --git a/orchestra/apps/issues/api.py b/orchestra/contrib/issues/api.py similarity index 100% rename from orchestra/apps/issues/api.py rename to orchestra/contrib/issues/api.py diff --git a/orchestra/apps/issues/filters.py b/orchestra/contrib/issues/filters.py similarity index 100% rename from orchestra/apps/issues/filters.py rename to orchestra/contrib/issues/filters.py diff --git a/orchestra/apps/issues/forms.py b/orchestra/contrib/issues/forms.py similarity index 99% rename from orchestra/apps/issues/forms.py rename to orchestra/contrib/issues/forms.py index ac317d85..01b1b6a8 100644 --- a/orchestra/apps/issues/forms.py +++ b/orchestra/contrib/issues/forms.py @@ -108,4 +108,4 @@ class TicketForm(forms.ModelForm): class ChangeReasonForm(forms.Form): reason = forms.CharField(widget=forms.Textarea(attrs={'cols': '100', 'rows': '10'}), - required=False) + required=False) diff --git a/orchestra/apps/issues/helpers.py b/orchestra/contrib/issues/helpers.py similarity index 100% rename from orchestra/apps/issues/helpers.py rename to orchestra/contrib/issues/helpers.py diff --git a/orchestra/apps/issues/models.py b/orchestra/contrib/issues/models.py similarity index 91% rename from orchestra/apps/issues/models.py rename to orchestra/contrib/issues/models.py index 9613a79c..40e27b88 100644 --- a/orchestra/apps/issues/models.py +++ b/orchestra/contrib/issues/models.py @@ -2,8 +2,8 @@ from django.conf import settings as djsettings from django.db import models from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.contacts import settings as contacts_settings -from orchestra.apps.contacts.models import Contact +from orchestra.contrib.contacts import settings as contacts_settings +from orchestra.contrib.contacts.models import Contact from orchestra.core.translations import ModelTranslation from orchestra.models.fields import MultiSelectField from orchestra.utils import send_email_template @@ -16,9 +16,9 @@ class Queue(models.Model): verbose_name = models.CharField(_("verbose_name"), max_length=128, blank=True) default = models.BooleanField(_("default"), default=False) notify = MultiSelectField(_("notify"), max_length=256, blank=True, - choices=Contact.EMAIL_USAGES, - default=contacts_settings.CONTACTS_DEFAULT_EMAIL_USAGES, - help_text=_("Contacts to notify by email")) + choices=Contact.EMAIL_USAGES, + default=contacts_settings.CONTACTS_DEFAULT_EMAIL_USAGES, + help_text=_("Contacts to notify by email")) def __str__(self): return self.verbose_name or self.name @@ -59,15 +59,15 @@ class Ticket(models.Model): ) creator = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("created by"), - related_name='tickets_created', null=True) + related_name='tickets_created', null=True) creator_name = models.CharField(_("creator name"), max_length=256, blank=True) owner = models.ForeignKey(djsettings.AUTH_USER_MODEL, null=True, blank=True, - related_name='tickets_owned', verbose_name=_("assigned to")) + related_name='tickets_owned', verbose_name=_("assigned to")) queue = models.ForeignKey(Queue, related_name='tickets', null=True, blank=True) subject = models.CharField(_("subject"), max_length=256) description = models.TextField(_("description")) priority = models.CharField(_("priority"), max_length=32, choices=PRIORITIES, - default=MEDIUM) + default=MEDIUM) state = models.CharField(_("state"), max_length=32, choices=STATES, default=NEW) created_at = models.DateTimeField(_("created"), auto_now_add=True) updated_at = models.DateTimeField(_("modified"), auto_now=True) @@ -154,9 +154,9 @@ class Ticket(models.Model): class Message(models.Model): ticket = models.ForeignKey('issues.Ticket', verbose_name=_("ticket"), - related_name='messages') + related_name='messages') author = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("author"), - related_name='ticket_messages') + related_name='ticket_messages') author_name = models.CharField(_("author name"), max_length=256, blank=True) content = models.TextField(_("content")) created_on = models.DateTimeField(_("created on"), auto_now_add=True) @@ -183,10 +183,9 @@ class Message(models.Model): class TicketTracker(models.Model): """ Keeps track of user read tickets """ - ticket = models.ForeignKey(Ticket, verbose_name=_("ticket"), - related_name='trackers') + ticket = models.ForeignKey(Ticket, verbose_name=_("ticket"), related_name='trackers') user = models.ForeignKey(djsettings.AUTH_USER_MODEL, verbose_name=_("user"), - related_name='ticket_trackers') + related_name='ticket_trackers') class Meta: unique_together = ( diff --git a/orchestra/apps/issues/serializers.py b/orchestra/contrib/issues/serializers.py similarity index 100% rename from orchestra/apps/issues/serializers.py rename to orchestra/contrib/issues/serializers.py diff --git a/orchestra/apps/issues/settings.py b/orchestra/contrib/issues/settings.py similarity index 100% rename from orchestra/apps/issues/settings.py rename to orchestra/contrib/issues/settings.py diff --git a/orchestra/apps/issues/static/issues/css/ticket-admin.css b/orchestra/contrib/issues/static/issues/css/ticket-admin.css similarity index 100% rename from orchestra/apps/issues/static/issues/css/ticket-admin.css rename to orchestra/contrib/issues/static/issues/css/ticket-admin.css diff --git a/orchestra/apps/issues/static/issues/images/btn_edit.gif b/orchestra/contrib/issues/static/issues/images/btn_edit.gif similarity index 100% rename from orchestra/apps/issues/static/issues/images/btn_edit.gif rename to orchestra/contrib/issues/static/issues/images/btn_edit.gif diff --git a/orchestra/apps/issues/static/issues/images/unread_ticket.gif b/orchestra/contrib/issues/static/issues/images/unread_ticket.gif similarity index 100% rename from orchestra/apps/issues/static/issues/images/unread_ticket.gif rename to orchestra/contrib/issues/static/issues/images/unread_ticket.gif diff --git a/orchestra/apps/issues/static/issues/js/admin-ticket.js b/orchestra/contrib/issues/static/issues/js/admin-ticket.js similarity index 100% rename from orchestra/apps/issues/static/issues/js/admin-ticket.js rename to orchestra/contrib/issues/static/issues/js/admin-ticket.js diff --git a/orchestra/apps/issues/static/issues/js/ticket-admin.js b/orchestra/contrib/issues/static/issues/js/ticket-admin.js similarity index 100% rename from orchestra/apps/issues/static/issues/js/ticket-admin.js rename to orchestra/contrib/issues/static/issues/js/ticket-admin.js diff --git a/orchestra/apps/issues/static/issues/markdown_syntax.html b/orchestra/contrib/issues/static/issues/markdown_syntax.html similarity index 100% rename from orchestra/apps/issues/static/issues/markdown_syntax.html rename to orchestra/contrib/issues/static/issues/markdown_syntax.html diff --git a/orchestra/apps/issues/templates/issues/ticket_notification.mail b/orchestra/contrib/issues/templates/issues/ticket_notification.mail similarity index 100% rename from orchestra/apps/issues/templates/issues/ticket_notification.mail rename to orchestra/contrib/issues/templates/issues/ticket_notification.mail diff --git a/orchestra/apps/issues/templates/issues/ticket_notification_html.mail b/orchestra/contrib/issues/templates/issues/ticket_notification_html.mail similarity index 100% rename from orchestra/apps/issues/templates/issues/ticket_notification_html.mail rename to orchestra/contrib/issues/templates/issues/ticket_notification_html.mail diff --git a/orchestra/apps/issues/tests.py b/orchestra/contrib/issues/tests.py similarity index 100% rename from orchestra/apps/issues/tests.py rename to orchestra/contrib/issues/tests.py diff --git a/orchestra/apps/lists/__init__.py b/orchestra/contrib/lists/__init__.py similarity index 100% rename from orchestra/apps/lists/__init__.py rename to orchestra/contrib/lists/__init__.py diff --git a/orchestra/apps/lists/admin.py b/orchestra/contrib/lists/admin.py similarity index 96% rename from orchestra/apps/lists/admin.py rename to orchestra/contrib/lists/admin.py index 4e8942cd..00c26473 100644 --- a/orchestra/apps/lists/admin.py +++ b/orchestra/contrib/lists/admin.py @@ -5,7 +5,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin from orchestra.admin.utils import admin_link -from orchestra.apps.accounts.admin import SelectAccountAdminMixin +from orchestra.contrib.accounts.admin import SelectAccountAdminMixin from .forms import ListCreationForm, ListChangeForm from .models import List diff --git a/orchestra/apps/lists/api.py b/orchestra/contrib/lists/api.py similarity index 86% rename from orchestra/apps/lists/api.py rename to orchestra/contrib/lists/api.py index d8061893..9430e4a2 100644 --- a/orchestra/apps/lists/api.py +++ b/orchestra/contrib/lists/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router, SetPasswordApiMixin -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import List from .serializers import ListSerializer diff --git a/orchestra/apps/lists/backends.py b/orchestra/contrib/lists/backends.py similarity index 99% rename from orchestra/apps/lists/backends.py rename to orchestra/contrib/lists/backends.py index 05092085..1216c2c5 100644 --- a/orchestra/apps/lists/backends.py +++ b/orchestra/contrib/lists/backends.py @@ -2,8 +2,8 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.resources import ServiceMonitor from . import settings from .models import List diff --git a/orchestra/apps/lists/forms.py b/orchestra/contrib/lists/forms.py similarity index 72% rename from orchestra/apps/lists/forms.py rename to orchestra/contrib/lists/forms.py index 4f5fd79f..0fefbaa9 100644 --- a/orchestra/apps/lists/forms.py +++ b/orchestra/contrib/lists/forms.py @@ -17,10 +17,10 @@ class CleanAddressMixin(object): class ListCreationForm(CleanAddressMixin, forms.ModelForm): password1 = forms.CharField(label=_("Password"), validators=[validate_password], - widget=forms.PasswordInput) + widget=forms.PasswordInput) password2 = forms.CharField(label=_("Password confirmation"), - widget=forms.PasswordInput, - help_text=_("Enter the same password as above, for verification.")) + widget=forms.PasswordInput, + help_text=_("Enter the same password as above, for verification.")) def clean_password2(self): password1 = self.cleaned_data.get("password1") @@ -33,7 +33,7 @@ class ListCreationForm(CleanAddressMixin, forms.ModelForm): class ListChangeForm(CleanAddressMixin, forms.ModelForm): password = forms.CharField(label=_("Password"), - widget=ReadOnlyWidget('Unknown password'), - help_text=_("List passwords are not stored, so there is no way to see this " - "list's password, but you can change the password using " - "this form.")) + widget=ReadOnlyWidget('Unknown password'), + help_text=_("List passwords are not stored, so there is no way to see this " + "list's password, but you can change the password using " + "this form.")) diff --git a/orchestra/apps/lists/models.py b/orchestra/contrib/lists/models.py similarity index 85% rename from orchestra/apps/lists/models.py rename to orchestra/contrib/lists/models.py index 2bbef0e4..5f6f99e6 100644 --- a/orchestra/apps/lists/models.py +++ b/orchestra/contrib/lists/models.py @@ -12,15 +12,15 @@ from . import settings class List(models.Model): name = models.CharField(_("name"), max_length=128, unique=True, validators=[validate_name], - help_text=_("Default list address <name>@%s") % settings.LISTS_DEFAULT_DOMAIN) + help_text=_("Default list address <name>@%s") % settings.LISTS_DEFAULT_DOMAIN) address_name = models.CharField(_("address name"), max_length=128, - validators=[validate_name], blank=True) + validators=[validate_name], blank=True) address_domain = models.ForeignKey(settings.LISTS_DOMAIN_MODEL, - verbose_name=_("address domain"), blank=True, null=True) + verbose_name=_("address domain"), blank=True, null=True) admin_email = models.EmailField(_("admin email"), - help_text=_("Administration email address")) + help_text=_("Administration email address")) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='lists') + related_name='lists') # TODO also admin # TODO is_active = models.BooleanField(_("active"), default=True, # help_text=_("Designates whether this account should be treated as active. " diff --git a/orchestra/apps/lists/serializers.py b/orchestra/contrib/lists/serializers.py similarity index 96% rename from orchestra/apps/lists/serializers.py rename to orchestra/contrib/lists/serializers.py index b3668660..296ef1f7 100644 --- a/orchestra/apps/lists/serializers.py +++ b/orchestra/contrib/lists/serializers.py @@ -4,7 +4,7 @@ from django.shortcuts import get_object_or_404 from rest_framework import serializers from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from orchestra.core.validators import validate_password from .models import List diff --git a/orchestra/apps/lists/settings.py b/orchestra/contrib/lists/settings.py similarity index 100% rename from orchestra/apps/lists/settings.py rename to orchestra/contrib/lists/settings.py diff --git a/orchestra/apps/lists/tests/__init__.py b/orchestra/contrib/lists/tests/__init__.py similarity index 100% rename from orchestra/apps/lists/tests/__init__.py rename to orchestra/contrib/lists/tests/__init__.py diff --git a/orchestra/apps/lists/tests/functional_tests/__init__.py b/orchestra/contrib/lists/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/lists/tests/functional_tests/__init__.py rename to orchestra/contrib/lists/tests/functional_tests/__init__.py diff --git a/orchestra/apps/lists/tests/functional_tests/tests.py b/orchestra/contrib/lists/tests/functional_tests/tests.py similarity index 97% rename from orchestra/apps/lists/tests/functional_tests/tests.py rename to orchestra/contrib/lists/tests/functional_tests/tests.py index 412e4403..01bee755 100644 --- a/orchestra/apps/lists/tests/functional_tests/tests.py +++ b/orchestra/contrib/lists/tests/functional_tests/tests.py @@ -10,9 +10,9 @@ from django.core.urlresolvers import reverse from selenium.webdriver.support.select import Select from orchestra.admin.utils import change_url -from orchestra.apps.domains.models import Domain -from orchestra.apps.orchestration.models import Server, Route -from orchestra.utils.system import sshrun +from orchestra.contrib.domains.models import Domain +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.utils.sys import sshrun from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error) @@ -23,9 +23,9 @@ from ...models import List class ListMixin(object): MASTER_SERVER = os.environ.get('ORCHESTRA_SLAVE_SERVER', 'localhost') DEPENDENCIES = ( - 'orchestra.apps.orchestration', - 'orchestra.apps.domains', - 'orchestra.apps.lists', + 'orchestra.contrib.orchestration', + 'orchestra.contrib.domains', + 'orchestra.contrib.lists', ) def setUp(self): diff --git a/orchestra/apps/mailboxes/__init__.py b/orchestra/contrib/mailboxes/__init__.py similarity index 100% rename from orchestra/apps/mailboxes/__init__.py rename to orchestra/contrib/mailboxes/__init__.py diff --git a/orchestra/apps/mailboxes/actions.py b/orchestra/contrib/mailboxes/actions.py similarity index 100% rename from orchestra/apps/mailboxes/actions.py rename to orchestra/contrib/mailboxes/actions.py diff --git a/orchestra/apps/mailboxes/admin.py b/orchestra/contrib/mailboxes/admin.py similarity index 97% rename from orchestra/apps/mailboxes/admin.py rename to orchestra/contrib/mailboxes/admin.py index 8968816b..a0871c38 100644 --- a/orchestra/apps/mailboxes/admin.py +++ b/orchestra/contrib/mailboxes/admin.py @@ -7,8 +7,8 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin from orchestra.admin.utils import admin_link, change_url -from orchestra.apps.accounts.admin import SelectAccountAdminMixin -from orchestra.apps.accounts.filters import IsActiveListFilter +from orchestra.contrib.accounts.admin import SelectAccountAdminMixin +from orchestra.contrib.accounts.filters import IsActiveListFilter from . import settings from .actions import SendMailboxEmail diff --git a/orchestra/apps/mailboxes/api.py b/orchestra/contrib/mailboxes/api.py similarity index 90% rename from orchestra/apps/mailboxes/api.py rename to orchestra/contrib/mailboxes/api.py index 9e452c68..40d3e85b 100644 --- a/orchestra/apps/mailboxes/api.py +++ b/orchestra/contrib/mailboxes/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router, SetPasswordApiMixin -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import Address, Mailbox from .serializers import AddressSerializer, MailboxSerializer diff --git a/orchestra/apps/mailboxes/backends.py b/orchestra/contrib/mailboxes/backends.py similarity index 99% rename from orchestra/apps/mailboxes/backends.py rename to orchestra/contrib/mailboxes/backends.py index 11f4f8e1..760ed76c 100644 --- a/orchestra/apps/mailboxes/backends.py +++ b/orchestra/contrib/mailboxes/backends.py @@ -4,8 +4,8 @@ import textwrap from django.core.exceptions import ObjectDoesNotExist from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.resources import ServiceMonitor #from orchestra.utils.humanize import unit_to_bytes from . import settings diff --git a/orchestra/apps/mailboxes/filters.py b/orchestra/contrib/mailboxes/filters.py similarity index 100% rename from orchestra/apps/mailboxes/filters.py rename to orchestra/contrib/mailboxes/filters.py diff --git a/orchestra/apps/mailboxes/forms.py b/orchestra/contrib/mailboxes/forms.py similarity index 95% rename from orchestra/apps/mailboxes/forms.py rename to orchestra/contrib/mailboxes/forms.py index 0e54b37c..2f515058 100644 --- a/orchestra/apps/mailboxes/forms.py +++ b/orchestra/contrib/mailboxes/forms.py @@ -13,8 +13,9 @@ class MailboxForm(forms.ModelForm): """ hacky form for adding reverse M2M form field for Mailbox.addresses """ # TODO keep track of this ticket for future reimplementation # https://code.djangoproject.com/ticket/897 - addresses = forms.ModelMultipleChoiceField(queryset=Address.objects.select_related('domain'), required=False, - widget=widgets.FilteredSelectMultiple(verbose_name=_('addresses'), is_stacked=False)) + addresses = forms.ModelMultipleChoiceField(queryset=Address.objects.select_related('domain'), + required=False, + widget=widgets.FilteredSelectMultiple(verbose_name=_('addresses'), is_stacked=False)) def __init__(self, *args, **kwargs): super(MailboxForm, self).__init__(*args, **kwargs) diff --git a/orchestra/apps/mailboxes/models.py b/orchestra/contrib/mailboxes/models.py similarity index 79% rename from orchestra/apps/mailboxes/models.py rename to orchestra/contrib/mailboxes/models.py index 0fa123a0..16731218 100644 --- a/orchestra/apps/mailboxes/models.py +++ b/orchestra/contrib/mailboxes/models.py @@ -15,22 +15,22 @@ class Mailbox(models.Model): CUSTOM = 'CUSTOM' name = models.CharField(_("name"), max_length=64, unique=True, - help_text=_("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), - validators=[ - RegexValidator(r'^[\w.@+-]+$', _("Enter a valid mailbox name.")) - ]) + help_text=_("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), + validators=[ + RegexValidator(r'^[\w.@+-]+$', _("Enter a valid mailbox name.")) + ]) password = models.CharField(_("password"), max_length=128) account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='mailboxes') + related_name='mailboxes') filtering = models.CharField(max_length=16, - default=settings.MAILBOXES_MAILBOX_DEFAULT_FILTERING, - choices=[ - (k, v[0]) for k,v in settings.MAILBOXES_MAILBOX_FILTERINGS.items() - ]) + default=settings.MAILBOXES_MAILBOX_DEFAULT_FILTERING, + choices=[ + (k, v[0]) for k,v in settings.MAILBOXES_MAILBOX_FILTERINGS.items() + ]) custom_filtering = models.TextField(_("filtering"), blank=True, - validators=[validators.validate_sieve], - help_text=_("Arbitrary email filtering in sieve language. " - "This overrides any automatic junk email filtering")) + validators=[validators.validate_sieve], + help_text=_("Arbitrary email filtering in sieve language. " + "This overrides any automatic junk email filtering")) is_active = models.BooleanField(_("active"), default=True) class Meta: @@ -86,19 +86,17 @@ class Mailbox(models.Model): class Address(models.Model): name = models.CharField(_("name"), max_length=64, blank=True, - validators=[validators.validate_emailname], - help_text=_("Address name, left blank for a catch-all address")) + validators=[validators.validate_emailname], + help_text=_("Address name, left blank for a catch-all address")) domain = models.ForeignKey(settings.MAILBOXES_DOMAIN_MODEL, - verbose_name=_("domain"), - related_name='addresses') - mailboxes = models.ManyToManyField(Mailbox, - verbose_name=_("mailboxes"), - related_name='addresses', blank=True) + verbose_name=_("domain"), related_name='addresses') + mailboxes = models.ManyToManyField(Mailbox, verbose_name=_("mailboxes"), + related_name='addresses', blank=True) forward = models.CharField(_("forward"), max_length=256, blank=True, - validators=[validators.validate_forward], - help_text=_("Space separated email addresses or mailboxes")) + validators=[validators.validate_forward], + help_text=_("Space separated email addresses or mailboxes")) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='addresses') + related_name='addresses') class Meta: verbose_name_plural = _("addresses") @@ -148,7 +146,7 @@ class Address(models.Model): class Autoresponse(models.Model): address = models.OneToOneField(Address, verbose_name=_("address"), - related_name='autoresponse') + related_name='autoresponse') # TODO initial_date subject = models.CharField(_("subject"), max_length=256) message = models.TextField(_("message")) diff --git a/orchestra/apps/mailboxes/serializers.py b/orchestra/contrib/mailboxes/serializers.py similarity index 97% rename from orchestra/apps/mailboxes/serializers.py rename to orchestra/contrib/mailboxes/serializers.py index a273003f..c7086b27 100644 --- a/orchestra/apps/mailboxes/serializers.py +++ b/orchestra/contrib/mailboxes/serializers.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from orchestra.core.validators import validate_password from .models import Mailbox, Address diff --git a/orchestra/apps/mailboxes/settings.py b/orchestra/contrib/mailboxes/settings.py similarity index 100% rename from orchestra/apps/mailboxes/settings.py rename to orchestra/contrib/mailboxes/settings.py diff --git a/orchestra/apps/mailboxes/tests/__init__.py b/orchestra/contrib/mailboxes/tests/__init__.py similarity index 100% rename from orchestra/apps/mailboxes/tests/__init__.py rename to orchestra/contrib/mailboxes/tests/__init__.py diff --git a/orchestra/apps/mailboxes/tests/functional_tests/__init__.py b/orchestra/contrib/mailboxes/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/mailboxes/tests/functional_tests/__init__.py rename to orchestra/contrib/mailboxes/tests/functional_tests/__init__.py diff --git a/orchestra/apps/mailboxes/tests/functional_tests/tests.py b/orchestra/contrib/mailboxes/tests/functional_tests/tests.py similarity index 98% rename from orchestra/apps/mailboxes/tests/functional_tests/tests.py rename to orchestra/contrib/mailboxes/tests/functional_tests/tests.py index a1c4a336..c9d35c30 100644 --- a/orchestra/apps/mailboxes/tests/functional_tests/tests.py +++ b/orchestra/contrib/mailboxes/tests/functional_tests/tests.py @@ -13,9 +13,9 @@ from django.core.management.base import CommandError from django.core.urlresolvers import reverse from selenium.webdriver.support.select import Select -from orchestra.apps.orchestration.models import Server, Route -from orchestra.apps.resources.models import Resource -from orchestra.utils.system import sshrun +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.contrib.resources.models import Resource +from orchestra.utils.sys import sshrun from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error from ... import backends, settings @@ -25,9 +25,9 @@ from ...models import Mailbox class MailboxMixin(object): MASTER_SERVER = os.environ.get('ORCHESTRA_SLAVE_SERVER', 'localhost') DEPENDENCIES = ( - 'orchestra.apps.orchestration', - 'orchestra.apps.mails', - 'orchestra.apps.resources', + 'orchestra.contrib.orchestration', + 'orchestra.contrib.mails', + 'orchestra.contrib.resources', ) def setUp(self): diff --git a/orchestra/apps/mailboxes/validators.py b/orchestra/contrib/mailboxes/validators.py similarity index 98% rename from orchestra/apps/mailboxes/validators.py rename to orchestra/contrib/mailboxes/validators.py index 709851d0..6f63a1cf 100644 --- a/orchestra/apps/mailboxes/validators.py +++ b/orchestra/contrib/mailboxes/validators.py @@ -7,7 +7,7 @@ from django.core.validators import ValidationError, EmailValidator from django.utils.translation import ugettext_lazy as _ from orchestra.utils import paths -from orchestra.utils.system import run +from orchestra.utils.sys import run from . import settings diff --git a/orchestra/apps/miscellaneous/__init__.py b/orchestra/contrib/miscellaneous/__init__.py similarity index 100% rename from orchestra/apps/miscellaneous/__init__.py rename to orchestra/contrib/miscellaneous/__init__.py diff --git a/orchestra/apps/miscellaneous/admin.py b/orchestra/contrib/miscellaneous/admin.py similarity index 98% rename from orchestra/apps/miscellaneous/admin.py rename to orchestra/contrib/miscellaneous/admin.py index 35b35085..3ba411b1 100644 --- a/orchestra/apps/miscellaneous/admin.py +++ b/orchestra/contrib/miscellaneous/admin.py @@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import admin_link -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from orchestra.plugins import PluginModelAdapter from orchestra.plugins.admin import SelectPluginAdminMixin diff --git a/orchestra/apps/miscellaneous/migrations/0001_initial.py b/orchestra/contrib/miscellaneous/migrations/0001_initial.py similarity index 100% rename from orchestra/apps/miscellaneous/migrations/0001_initial.py rename to orchestra/contrib/miscellaneous/migrations/0001_initial.py diff --git a/orchestra/apps/miscellaneous/migrations/0002_auto_20141112_1853.py b/orchestra/contrib/miscellaneous/migrations/0002_auto_20141112_1853.py similarity index 100% rename from orchestra/apps/miscellaneous/migrations/0002_auto_20141112_1853.py rename to orchestra/contrib/miscellaneous/migrations/0002_auto_20141112_1853.py diff --git a/orchestra/apps/miscellaneous/migrations/__init__.py b/orchestra/contrib/miscellaneous/migrations/__init__.py similarity index 100% rename from orchestra/apps/miscellaneous/migrations/__init__.py rename to orchestra/contrib/miscellaneous/migrations/__init__.py diff --git a/orchestra/apps/miscellaneous/models.py b/orchestra/contrib/miscellaneous/models.py similarity index 71% rename from orchestra/apps/miscellaneous/models.py rename to orchestra/contrib/miscellaneous/models.py index bd567eb1..3db29560 100644 --- a/orchestra/apps/miscellaneous/models.py +++ b/orchestra/contrib/miscellaneous/models.py @@ -10,20 +10,20 @@ from orchestra.models.fields import NullableCharField class MiscService(models.Model): name = models.CharField(_("name"), max_length=32, unique=True, validators=[validate_name], - help_text=_("Raw name used for internal referenciation, i.e. service match definition")) + help_text=_("Raw name used for internal referenciation, i.e. service match definition")) verbose_name = models.CharField(_("verbose name"), max_length=256, blank=True, - help_text=_("Human readable name")) + help_text=_("Human readable name")) description = models.TextField(_("description"), blank=True, - help_text=_("Optional description")) + help_text=_("Optional description")) has_identifier = models.BooleanField(_("has identifier"), default=True, - help_text=_("Designates if this service has a unique text field that " - "identifies it or not.")) + help_text=_("Designates if this service has a unique text field that " + "identifies it or not.")) has_amount = models.BooleanField(_("has amount"), default=False, - help_text=_("Designates whether this service has amount " - "property or not.")) + help_text=_("Designates whether this service has amount " + "property or not.")) is_active = models.BooleanField(_("active"), default=True, - help_text=_("Whether new instances of this service can be created " - "or not. Unselect this instead of deleting services.")) + help_text=_("Whether new instances of this service can be created " + "or not. Unselect this instead of deleting services.")) def __str__(self): return self.name @@ -37,16 +37,16 @@ class MiscService(models.Model): class Miscellaneous(models.Model): service = models.ForeignKey(MiscService, verbose_name=_("service"), - related_name='instances') + related_name='instances') account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='miscellaneous') + related_name='miscellaneous') identifier = NullableCharField(_("identifier"), max_length=256, null=True, unique=True, - help_text=_("A unique identifier for this service.")) + help_text=_("A unique identifier for this service.")) description = models.TextField(_("description"), blank=True) amount = models.PositiveIntegerField(_("amount"), default=1) is_active = models.BooleanField(_("active"), default=True, - help_text=_("Designates whether this service should be treated as " - "active. Unselect this instead of deleting services.")) + help_text=_("Designates whether this service should be treated as " + "active. Unselect this instead of deleting services.")) class Meta: verbose_name_plural = _("miscellaneous") diff --git a/orchestra/apps/miscellaneous/settings.py b/orchestra/contrib/miscellaneous/settings.py similarity index 100% rename from orchestra/apps/miscellaneous/settings.py rename to orchestra/contrib/miscellaneous/settings.py diff --git a/orchestra/apps/orchestration/README.md b/orchestra/contrib/orchestration/README.md similarity index 100% rename from orchestra/apps/orchestration/README.md rename to orchestra/contrib/orchestration/README.md diff --git a/orchestra/apps/orchestration/__init__.py b/orchestra/contrib/orchestration/__init__.py similarity index 100% rename from orchestra/apps/orchestration/__init__.py rename to orchestra/contrib/orchestration/__init__.py diff --git a/orchestra/apps/orchestration/admin.py b/orchestra/contrib/orchestration/admin.py similarity index 100% rename from orchestra/apps/orchestration/admin.py rename to orchestra/contrib/orchestration/admin.py diff --git a/orchestra/apps/orchestration/backends.py b/orchestra/contrib/orchestration/backends.py similarity index 100% rename from orchestra/apps/orchestration/backends.py rename to orchestra/contrib/orchestration/backends.py diff --git a/orchestra/apps/orchestration/helpers.py b/orchestra/contrib/orchestration/helpers.py similarity index 100% rename from orchestra/apps/orchestration/helpers.py rename to orchestra/contrib/orchestration/helpers.py diff --git a/orchestra/apps/orchestration/management/__init__.py b/orchestra/contrib/orchestration/management/__init__.py similarity index 100% rename from orchestra/apps/orchestration/management/__init__.py rename to orchestra/contrib/orchestration/management/__init__.py diff --git a/orchestra/apps/orchestration/management/commands/__init__.py b/orchestra/contrib/orchestration/management/commands/__init__.py similarity index 100% rename from orchestra/apps/orchestration/management/commands/__init__.py rename to orchestra/contrib/orchestration/management/commands/__init__.py diff --git a/orchestra/apps/orchestration/management/commands/orchestrate.py b/orchestra/contrib/orchestration/management/commands/orchestrate.py similarity index 95% rename from orchestra/apps/orchestration/management/commands/orchestrate.py rename to orchestra/contrib/orchestration/management/commands/orchestrate.py index bb6310ea..a3f0c229 100644 --- a/orchestra/apps/orchestration/management/commands/orchestrate.py +++ b/orchestra/contrib/orchestration/management/commands/orchestrate.py @@ -2,9 +2,8 @@ import sys from django.core.management.base import BaseCommand from django.db.models.loading import get_model -from django.utils.six.moves import input -from orchestra.apps.orchestration import manager +from orchestra.contrib.orchestration import manager class Command(BaseCommand): diff --git a/orchestra/apps/orchestration/manager.py b/orchestra/contrib/orchestration/manager.py similarity index 100% rename from orchestra/apps/orchestration/manager.py rename to orchestra/contrib/orchestration/manager.py diff --git a/orchestra/apps/orchestration/methods.py b/orchestra/contrib/orchestration/methods.py similarity index 100% rename from orchestra/apps/orchestration/methods.py rename to orchestra/contrib/orchestration/methods.py diff --git a/orchestra/apps/orchestration/middlewares.py b/orchestra/contrib/orchestration/middlewares.py similarity index 100% rename from orchestra/apps/orchestration/middlewares.py rename to orchestra/contrib/orchestration/middlewares.py diff --git a/orchestra/apps/orchestration/models.py b/orchestra/contrib/orchestration/models.py similarity index 93% rename from orchestra/apps/orchestration/models.py rename to orchestra/contrib/orchestration/models.py index 370538af..0a16478d 100644 --- a/orchestra/apps/orchestration/models.py +++ b/orchestra/contrib/orchestration/models.py @@ -19,11 +19,11 @@ class Server(models.Model): """ Machine runing daemons (services) """ name = models.CharField(_("name"), max_length=256, unique=True) address = NullableCharField(_("address"), max_length=256, blank=True, - null=True, unique=True, help_text=_("IP address or domain name")) + null=True, unique=True, help_text=_("IP address or domain name")) description = models.TextField(_("description"), blank=True) os = models.CharField(_("operative system"), max_length=32, - choices=settings.ORCHESTRATION_OS_CHOICES, - default=settings.ORCHESTRATION_DEFAULT_OS) + choices=settings.ORCHESTRATION_OS_CHOICES, + default=settings.ORCHESTRATION_DEFAULT_OS) def __str__(self): return self.name @@ -67,16 +67,16 @@ class BackendLog(models.Model): backend = models.CharField(_("backend"), max_length=256) state = models.CharField(_("state"), max_length=16, choices=STATES, - default=RECEIVED) + default=RECEIVED) server = models.ForeignKey(Server, verbose_name=_("server"), - related_name='execution_logs') + related_name='execution_logs') script = models.TextField(_("script")) stdout = models.TextField(_("stdout")) stderr = models.TextField(_("stdin")) traceback = models.TextField(_("traceback")) exit_code = models.IntegerField(_("exit code"), null=True) task_id = models.CharField(_("task ID"), max_length=36, unique=True, null=True, - help_text="Celery task ID when used as execution backend") + help_text="Celery task ID when used as execution backend") created_at = models.DateTimeField(_("created"), auto_now_add=True) updated_at = models.DateTimeField(_("updated"), auto_now=True) @@ -171,11 +171,11 @@ class Route(models.Model): Defines the routing that determine in which server a backend is executed """ backend = models.CharField(_("backend"), max_length=256, - choices=ServiceBackend.get_choices()) + choices=ServiceBackend.get_choices()) host = models.ForeignKey(Server, verbose_name=_("host")) match = models.CharField(_("match"), max_length=256, blank=True, default='True', - help_text=_("Python expression used for selecting the targe host, " - "instance referes to the current object.")) + help_text=_("Python expression used for selecting the targe host, " + "instance referes to the current object.")) # async = models.BooleanField(default=False) # method = models.CharField(_("method"), max_lenght=32, choices=method_choices, # default=MethodBackend.get_default()) diff --git a/orchestra/apps/orchestration/settings.py b/orchestra/contrib/orchestration/settings.py similarity index 91% rename from orchestra/apps/orchestration/settings.py rename to orchestra/contrib/orchestration/settings.py index 86b17ac1..dff4e6d8 100644 --- a/orchestra/apps/orchestration/settings.py +++ b/orchestra/contrib/orchestration/settings.py @@ -16,7 +16,7 @@ ORCHESTRATION_SSH_KEY_PATH = getattr(settings, 'ORCHESTRATION_SSH_KEY_PATH', ORCHESTRATION_ROUTER = getattr(settings, 'ORCHESTRATION_ROUTER', - 'orchestra.apps.orchestration.models.Route' + 'orchestra.contrib.orchestration.models.Route' ) diff --git a/orchestra/apps/orchestration/signals.py b/orchestra/contrib/orchestration/signals.py similarity index 100% rename from orchestra/apps/orchestration/signals.py rename to orchestra/contrib/orchestration/signals.py diff --git a/orchestra/apps/orchestration/tests/__init__.py b/orchestra/contrib/orchestration/tests/__init__.py similarity index 100% rename from orchestra/apps/orchestration/tests/__init__.py rename to orchestra/contrib/orchestration/tests/__init__.py diff --git a/orchestra/apps/orchestration/tests/test_route.py b/orchestra/contrib/orchestration/tests/test_route.py similarity index 100% rename from orchestra/apps/orchestration/tests/test_route.py rename to orchestra/contrib/orchestration/tests/test_route.py diff --git a/orchestra/apps/orchestration/widgets.py b/orchestra/contrib/orchestration/widgets.py similarity index 100% rename from orchestra/apps/orchestration/widgets.py rename to orchestra/contrib/orchestration/widgets.py diff --git a/orchestra/apps/orders/__init__.py b/orchestra/contrib/orders/__init__.py similarity index 100% rename from orchestra/apps/orders/__init__.py rename to orchestra/contrib/orders/__init__.py diff --git a/orchestra/apps/orders/actions.py b/orchestra/contrib/orders/actions.py similarity index 100% rename from orchestra/apps/orders/actions.py rename to orchestra/contrib/orders/actions.py diff --git a/orchestra/apps/orders/admin.py b/orchestra/contrib/orders/admin.py similarity index 98% rename from orchestra/apps/orders/admin.py rename to orchestra/contrib/orders/admin.py index 3c956216..c20e41de 100644 --- a/orchestra/apps/orders/admin.py +++ b/orchestra/contrib/orders/admin.py @@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import admin_link, admin_date -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from orchestra.utils.humanize import naturaldate from .actions import BillSelectedOrders, mark_as_ignored, mark_as_not_ignored diff --git a/orchestra/apps/orders/api.py b/orchestra/contrib/orders/api.py similarity index 83% rename from orchestra/apps/orders/api.py rename to orchestra/contrib/orders/api.py index 2711ff2e..61bc5f02 100644 --- a/orchestra/apps/orders/api.py +++ b/orchestra/contrib/orders/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import Order from .serializers import OrderSerializer diff --git a/orchestra/apps/orders/billing.py b/orchestra/contrib/orders/billing.py similarity index 97% rename from orchestra/apps/orders/billing.py rename to orchestra/contrib/orders/billing.py index 05ba89c4..45cc9b4e 100644 --- a/orchestra/apps/orders/billing.py +++ b/orchestra/contrib/orders/billing.py @@ -2,7 +2,7 @@ import datetime from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.bills.models import Invoice, Fee, ProForma +from orchestra.contrib.bills.models import Invoice, Fee, ProForma class BillsBackend(object): diff --git a/orchestra/apps/orders/filters.py b/orchestra/contrib/orders/filters.py similarity index 100% rename from orchestra/apps/orders/filters.py rename to orchestra/contrib/orders/filters.py diff --git a/orchestra/apps/orders/forms.py b/orchestra/contrib/orders/forms.py similarity index 77% rename from orchestra/apps/orders/forms.py rename to orchestra/contrib/orders/forms.py index c96da35a..410bad4c 100644 --- a/orchestra/apps/orders/forms.py +++ b/orchestra/contrib/orders/forms.py @@ -12,19 +12,19 @@ from .models import Order class BillSelectedOptionsForm(AdminFormMixin, forms.Form): billing_point = forms.DateField(initial=timezone.now, - label=_("Billing point"), widget=widgets.AdminDateWidget, - help_text=_("Date you want to bill selected orders")) + label=_("Billing point"), widget=widgets.AdminDateWidget, + help_text=_("Date you want to bill selected orders")) fixed_point = forms.BooleanField(initial=False, required=False, - label=_("Fixed point"), - help_text=_("Deisgnates whether you want the billing point to be an " - "exact date, or adapt it to the billing period.")) + label=_("Fixed point"), + help_text=_("Deisgnates whether you want the billing point to be an " + "exact date, or adapt it to the billing period.")) proforma = forms.BooleanField(initial=False, required=False, - label=_("Pro-forma (billing simulation)"), - help_text=_("Creates a Pro Forma instead of billing the orders.")) + label=_("Pro-forma (billing simulation)"), + help_text=_("Creates a Pro Forma instead of billing the orders.")) new_open = forms.BooleanField(initial=False, required=False, - label=_("Create a new open bill"), - help_text=_("Deisgnates whether you want to put this orders on a new " - "open bill, or allow to reuse an existing one.")) + label=_("Create a new open bill"), + help_text=_("Deisgnates whether you want to put this orders on a new " + "open bill, or allow to reuse an existing one.")) def selected_related_choices(queryset): @@ -45,8 +45,8 @@ class BillSelectRelatedForm(AdminFormMixin, forms.Form): # "depending on the billed orders. This options designates whether " # "all existing orders will be used for price computation or not.")) selected_related = forms.ModelMultipleChoiceField(label=_("Related orders"), - queryset=Order.objects.none(), widget=forms.CheckboxSelectMultiple, - required=False) + queryset=Order.objects.none(), widget=forms.CheckboxSelectMultiple, + required=False) billing_point = forms.DateField(widget=forms.HiddenInput()) fixed_point = forms.BooleanField(widget=forms.HiddenInput(), required=False) proforma = forms.BooleanField(widget=forms.HiddenInput(), required=False) diff --git a/orchestra/apps/orders/helpers.py b/orchestra/contrib/orders/helpers.py similarity index 100% rename from orchestra/apps/orders/helpers.py rename to orchestra/contrib/orders/helpers.py diff --git a/orchestra/apps/orders/models.py b/orchestra/contrib/orders/models.py similarity index 99% rename from orchestra/apps/orders/models.py rename to orchestra/contrib/orders/models.py index 6bb05551..b7ac4af5 100644 --- a/orchestra/apps/orders/models.py +++ b/orchestra/contrib/orders/models.py @@ -107,11 +107,11 @@ class OrderQuerySet(models.QuerySet): class Order(models.Model): account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='orders') + related_name='orders') content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField(null=True) service = models.ForeignKey(settings.ORDERS_SERVICE_MODEL, verbose_name=_("service"), - related_name='orders') + related_name='orders') registered_on = models.DateField(_("registered"), default=lambda: timezone.now()) cancelled_on = models.DateField(_("cancelled"), null=True, blank=True) billed_on = models.DateField(_("billed"), null=True, blank=True) diff --git a/orchestra/apps/orders/serializers.py b/orchestra/contrib/orders/serializers.py similarity index 81% rename from orchestra/apps/orders/serializers.py rename to orchestra/contrib/orders/serializers.py index 5d146fca..a98e367b 100644 --- a/orchestra/apps/orders/serializers.py +++ b/orchestra/contrib/orders/serializers.py @@ -1,6 +1,6 @@ from rest_framework import serializers -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .models import Order diff --git a/orchestra/apps/orders/settings.py b/orchestra/contrib/orders/settings.py similarity index 93% rename from orchestra/apps/orders/settings.py rename to orchestra/contrib/orders/settings.py index 9b72a63e..e25d7599 100644 --- a/orchestra/apps/orders/settings.py +++ b/orchestra/contrib/orders/settings.py @@ -3,7 +3,7 @@ from django.conf import settings # Pluggable backend for bill generation. ORDERS_BILLING_BACKEND = getattr(settings, 'ORDERS_BILLING_BACKEND', - 'orchestra.apps.orders.billing.BillsBackend' + 'orchestra.contrib.orders.billing.BillsBackend' ) diff --git a/orchestra/apps/orders/templates/admin/orders/order/bill_selected_options.html b/orchestra/contrib/orders/templates/admin/orders/order/bill_selected_options.html similarity index 100% rename from orchestra/apps/orders/templates/admin/orders/order/bill_selected_options.html rename to orchestra/contrib/orders/templates/admin/orders/order/bill_selected_options.html diff --git a/orchestra/apps/orders/tests/__init__.py b/orchestra/contrib/orders/tests/__init__.py similarity index 100% rename from orchestra/apps/orders/tests/__init__.py rename to orchestra/contrib/orders/tests/__init__.py diff --git a/orchestra/apps/payments/__init__.py b/orchestra/contrib/payments/__init__.py similarity index 100% rename from orchestra/apps/payments/__init__.py rename to orchestra/contrib/payments/__init__.py diff --git a/orchestra/apps/payments/actions.py b/orchestra/contrib/payments/actions.py similarity index 100% rename from orchestra/apps/payments/actions.py rename to orchestra/contrib/payments/actions.py diff --git a/orchestra/apps/payments/admin.py b/orchestra/contrib/payments/admin.py similarity index 98% rename from orchestra/apps/payments/admin.py rename to orchestra/contrib/payments/admin.py index 701cff41..6d0038df 100644 --- a/orchestra/apps/payments/admin.py +++ b/orchestra/contrib/payments/admin.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ChangeViewActionsMixin, ExtendedModelAdmin from orchestra.admin.utils import admin_colored, admin_link -from orchestra.apps.accounts.admin import AccountAdminMixin, SelectAccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin, SelectAccountAdminMixin from orchestra.plugins.admin import SelectPluginAdminMixin from . import actions diff --git a/orchestra/apps/payments/api.py b/orchestra/contrib/payments/api.py similarity index 90% rename from orchestra/apps/payments/api.py rename to orchestra/contrib/payments/api.py index 16246b3e..a6976796 100644 --- a/orchestra/apps/payments/api.py +++ b/orchestra/contrib/payments/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import PaymentSource, Transaction from .serializers import PaymentSourceSerializer, TransactionSerializer diff --git a/orchestra/apps/payments/methods/__init__.py b/orchestra/contrib/payments/methods/__init__.py similarity index 100% rename from orchestra/apps/payments/methods/__init__.py rename to orchestra/contrib/payments/methods/__init__.py diff --git a/orchestra/apps/payments/methods/creditcard.py b/orchestra/contrib/payments/methods/creditcard.py similarity index 100% rename from orchestra/apps/payments/methods/creditcard.py rename to orchestra/contrib/payments/methods/creditcard.py diff --git a/orchestra/apps/payments/methods/options.py b/orchestra/contrib/payments/methods/options.py similarity index 100% rename from orchestra/apps/payments/methods/options.py rename to orchestra/contrib/payments/methods/options.py diff --git a/orchestra/apps/payments/methods/pain.001.001.03.xsd b/orchestra/contrib/payments/methods/pain.001.001.03.xsd similarity index 100% rename from orchestra/apps/payments/methods/pain.001.001.03.xsd rename to orchestra/contrib/payments/methods/pain.001.001.03.xsd diff --git a/orchestra/apps/payments/methods/pain.008.001.02.xsd b/orchestra/contrib/payments/methods/pain.008.001.02.xsd similarity index 100% rename from orchestra/apps/payments/methods/pain.008.001.02.xsd rename to orchestra/contrib/payments/methods/pain.008.001.02.xsd diff --git a/orchestra/apps/payments/methods/sepadirectdebit.py b/orchestra/contrib/payments/methods/sepadirectdebit.py similarity index 100% rename from orchestra/apps/payments/methods/sepadirectdebit.py rename to orchestra/contrib/payments/methods/sepadirectdebit.py diff --git a/orchestra/apps/payments/models.py b/orchestra/contrib/payments/models.py similarity index 95% rename from orchestra/apps/payments/models.py rename to orchestra/contrib/payments/models.py index aefeec43..520d681f 100644 --- a/orchestra/apps/payments/models.py +++ b/orchestra/contrib/payments/models.py @@ -18,9 +18,9 @@ class PaymentSourcesQueryset(models.QuerySet): class PaymentSource(models.Model): account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='paymentsources') + related_name='paymentsources') method = models.CharField(_("method"), max_length=32, - choices=PaymentMethod.get_choices()) + choices=PaymentMethod.get_choices()) data = JSONField(_("data"), default={}) is_active = models.BooleanField(_("active"), default=True) @@ -97,13 +97,13 @@ class Transaction(models.Model): ) bill = models.ForeignKey('bills.bill', verbose_name=_("bill"), - related_name='transactions') + related_name='transactions') source = models.ForeignKey(PaymentSource, null=True, blank=True, - verbose_name=_("source"), related_name='transactions') + verbose_name=_("source"), related_name='transactions') process = models.ForeignKey('payments.TransactionProcess', null=True, - blank=True, verbose_name=_("process"), related_name='transactions') + blank=True, verbose_name=_("process"), related_name='transactions') state = models.CharField(_("state"), max_length=32, choices=STATES, - default=WAITTING_PROCESSING) + default=WAITTING_PROCESSING) amount = models.DecimalField(_("amount"), max_digits=12, decimal_places=2) currency = models.CharField(max_length=10, default=settings.PAYMENT_CURRENCY) created_at = models.DateTimeField(_("created"), auto_now_add=True) diff --git a/orchestra/apps/payments/serializers.py b/orchestra/contrib/payments/serializers.py similarity index 94% rename from orchestra/apps/payments/serializers.py rename to orchestra/contrib/payments/serializers.py index d418744b..6af8f629 100644 --- a/orchestra/apps/payments/serializers.py +++ b/orchestra/contrib/payments/serializers.py @@ -1,6 +1,6 @@ from rest_framework import serializers -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .methods import PaymentMethod from .models import PaymentSource, Transaction diff --git a/orchestra/apps/payments/settings.py b/orchestra/contrib/payments/settings.py similarity index 80% rename from orchestra/apps/payments/settings.py rename to orchestra/contrib/payments/settings.py index aee349ba..06fdcaf7 100644 --- a/orchestra/apps/payments/settings.py +++ b/orchestra/contrib/payments/settings.py @@ -23,6 +23,6 @@ PAYMENTS_DD_CREDITOR_AT02_ID = getattr(settings, 'PAYMENTS_DD_CREDITOR_AT02_ID', PAYMENTS_ENABLED_METHODS = getattr(settings, 'PAYMENTS_ENABLED_METHODS', [ - 'orchestra.apps.payments.methods.sepadirectdebit.SEPADirectDebit', - 'orchestra.apps.payments.methods.creditcard.CreditCard', + 'orchestra.contrib.payments.methods.sepadirectdebit.SEPADirectDebit', + 'orchestra.contrib.payments.methods.creditcard.CreditCard', ]) diff --git a/orchestra/apps/payments/templates/admin/payments/transaction/get_processes.html b/orchestra/contrib/payments/templates/admin/payments/transaction/get_processes.html similarity index 100% rename from orchestra/apps/payments/templates/admin/payments/transaction/get_processes.html rename to orchestra/contrib/payments/templates/admin/payments/transaction/get_processes.html diff --git a/orchestra/apps/plans/__init__.py b/orchestra/contrib/plans/__init__.py similarity index 100% rename from orchestra/apps/plans/__init__.py rename to orchestra/contrib/plans/__init__.py diff --git a/orchestra/apps/plans/admin.py b/orchestra/contrib/plans/admin.py similarity index 89% rename from orchestra/apps/plans/admin.py rename to orchestra/contrib/plans/admin.py index cd881354..d40bcc72 100644 --- a/orchestra/apps/plans/admin.py +++ b/orchestra/contrib/plans/admin.py @@ -2,8 +2,8 @@ from django.contrib import admin from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import insertattr -from orchestra.apps.accounts.admin import AccountAdminMixin -from orchestra.apps.services.models import Service +from orchestra.contrib.accounts.admin import AccountAdminMixin +from orchestra.contrib.services.models import Service from .models import Plan, ContractedPlan, Rate diff --git a/orchestra/apps/plans/models.py b/orchestra/contrib/plans/models.py similarity index 98% rename from orchestra/apps/plans/models.py rename to orchestra/contrib/plans/models.py index 33cf70bf..8495dd3f 100644 --- a/orchestra/apps/plans/models.py +++ b/orchestra/contrib/plans/models.py @@ -34,7 +34,7 @@ class Plan(models.Model): class ContractedPlan(models.Model): plan = models.ForeignKey(Plan, verbose_name=_("plan"), related_name='contracts') account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='plans') + related_name='plans') class Meta: verbose_name_plural = _("plans") @@ -68,7 +68,7 @@ class Rate(models.Model): } service = models.ForeignKey('services.Service', verbose_name=_("service"), - related_name='rates') + related_name='rates') plan = models.ForeignKey(Plan, verbose_name=_("plan"), related_name='rates') quantity = models.PositiveIntegerField(_("quantity"), null=True, blank=True) price = models.DecimalField(_("price"), max_digits=12, decimal_places=2) diff --git a/orchestra/apps/plans/rating.py b/orchestra/contrib/plans/rating.py similarity index 100% rename from orchestra/apps/plans/rating.py rename to orchestra/contrib/plans/rating.py diff --git a/orchestra/contrib/resources/__init__.py b/orchestra/contrib/resources/__init__.py new file mode 100644 index 00000000..7c273a58 --- /dev/null +++ b/orchestra/contrib/resources/__init__.py @@ -0,0 +1,4 @@ +from .backends import ServiceMonitor + + +default_app_config = 'orchestra.contrib.resources.apps.ResourcesConfig' diff --git a/orchestra/apps/resources/actions.py b/orchestra/contrib/resources/actions.py similarity index 100% rename from orchestra/apps/resources/actions.py rename to orchestra/contrib/resources/actions.py diff --git a/orchestra/apps/resources/admin.py b/orchestra/contrib/resources/admin.py similarity index 99% rename from orchestra/apps/resources/admin.py rename to orchestra/contrib/resources/admin.py index 17de83a3..6db7fc9c 100644 --- a/orchestra/apps/resources/admin.py +++ b/orchestra/contrib/resources/admin.py @@ -10,7 +10,7 @@ from django.utils.translation import ungettext, ugettext, ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.filters import UsedContentTypeFilter from orchestra.admin.utils import insertattr, get_modeladmin, admin_link, admin_date -from orchestra.apps.orchestration.models import Route +from orchestra.contrib.orchestration.models import Route from orchestra.core import services from orchestra.utils import database_ready diff --git a/orchestra/apps/resources/apps.py b/orchestra/contrib/resources/apps.py similarity index 93% rename from orchestra/apps/resources/apps.py rename to orchestra/contrib/resources/apps.py index d547c4a1..b543e9bc 100644 --- a/orchestra/apps/resources/apps.py +++ b/orchestra/contrib/resources/apps.py @@ -4,7 +4,7 @@ from orchestra.utils import database_ready class ResourcesConfig(AppConfig): - name = 'orchestra.apps.resources' + name = 'orchestra.contrib.resources' verbose_name = 'Resources' def ready(self): diff --git a/orchestra/apps/resources/backends.py b/orchestra/contrib/resources/backends.py similarity index 97% rename from orchestra/apps/resources/backends.py rename to orchestra/contrib/resources/backends.py index 754751f1..6da2c768 100644 --- a/orchestra/apps/resources/backends.py +++ b/orchestra/contrib/resources/backends.py @@ -5,7 +5,7 @@ from django.utils import timezone from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceBackend +from orchestra.contrib.orchestration import ServiceBackend class ServiceMonitor(ServiceBackend): diff --git a/orchestra/apps/resources/forms.py b/orchestra/contrib/resources/forms.py similarity index 97% rename from orchestra/apps/resources/forms.py rename to orchestra/contrib/resources/forms.py index 2a90caad..37e2e5fa 100644 --- a/orchestra/apps/resources/forms.py +++ b/orchestra/contrib/resources/forms.py @@ -6,7 +6,7 @@ from orchestra.forms.widgets import ShowTextWidget, ReadOnlyWidget class ResourceForm(forms.ModelForm): verbose_name = forms.CharField(label=_("Name"), required=False, - widget=ShowTextWidget(bold=True)) + widget=ShowTextWidget(bold=True)) allocated = forms.DecimalField(label=_("Allocated")) unit = forms.CharField(label=_("Unit"), widget=ShowTextWidget(), required=False) diff --git a/orchestra/apps/resources/methods.py b/orchestra/contrib/resources/methods.py similarity index 100% rename from orchestra/apps/resources/methods.py rename to orchestra/contrib/resources/methods.py diff --git a/orchestra/apps/resources/migrations/0001_initial.py b/orchestra/contrib/resources/migrations/0001_initial.py similarity index 97% rename from orchestra/apps/resources/migrations/0001_initial.py rename to orchestra/contrib/resources/migrations/0001_initial.py index 33ca30e5..28dee4d4 100644 --- a/orchestra/apps/resources/migrations/0001_initial.py +++ b/orchestra/contrib/resources/migrations/0001_initial.py @@ -2,7 +2,7 @@ from django.db import models, migrations import orchestra.core.validators -import orchestra.apps.resources.validators +import orchestra.contrib.resources.validators import django.utils.timezone import orchestra.models.fields @@ -41,7 +41,7 @@ class Migration(migrations.Migration): ('on_demand', models.BooleanField(default=False, help_text='If enabled the resource will not be pre-allocated, but allocated under the application demand', verbose_name='on demand')), ('default_allocation', models.PositiveIntegerField(help_text='Default allocation value used when this is not an on demand resource', null=True, verbose_name='default allocation', blank=True)), ('unit', models.CharField(help_text='The unit in which this resource is represented. For example GB, KB or subscribers', max_length=16, verbose_name='unit')), - ('scale', models.CharField(help_text='Scale in which this resource monitoring resoults should be prorcessed to match with unit. e.g. 10**9', max_length=32, verbose_name='scale', validators=[orchestra.apps.resources.validators.validate_scale])), + ('scale', models.CharField(help_text='Scale in which this resource monitoring resoults should be prorcessed to match with unit. e.g. 10**9', max_length=32, verbose_name='scale', validators=[orchestra.contrib.resources.validators.validate_scale])), ('disable_trigger', models.BooleanField(default=False, help_text='Disables monitors exeeded and recovery triggers', verbose_name='disable trigger')), ('monitors', orchestra.models.fields.MultiSelectField(blank=True, help_text='Monitor backends used for monitoring this resource.', max_length=256, verbose_name='monitors', choices=[(b'Apache2Traffic', '[M] Apache 2 Traffic'), (b'MaildirDisk', '[M] Maildir disk usage'), (b'MailmanSubscribers', '[M] Mailman subscribers'), (b'MailmanTraffic', '[M] Mailman traffic'), (b'FTPTraffic', '[M] Main FTP traffic'), (b'SystemUserDisk', '[M] Main user disk'), (b'MysqlDisk', '[M] MySQL disk'), (b'OpenVZTraffic', '[M] OpenVZTraffic')])), ('is_active', models.BooleanField(default=True, verbose_name='active')), diff --git a/orchestra/apps/resources/migrations/0002_auto_20141117_1415.py b/orchestra/contrib/resources/migrations/0002_auto_20141117_1415.py similarity index 100% rename from orchestra/apps/resources/migrations/0002_auto_20141117_1415.py rename to orchestra/contrib/resources/migrations/0002_auto_20141117_1415.py diff --git a/orchestra/apps/resources/migrations/__init__.py b/orchestra/contrib/resources/migrations/__init__.py similarity index 100% rename from orchestra/apps/resources/migrations/__init__.py rename to orchestra/contrib/resources/migrations/__init__.py diff --git a/orchestra/apps/resources/models.py b/orchestra/contrib/resources/models.py similarity index 89% rename from orchestra/apps/resources/models.py rename to orchestra/contrib/resources/models.py index a00177ac..a8c86ed5 100644 --- a/orchestra/apps/resources/models.py +++ b/orchestra/contrib/resources/models.py @@ -12,7 +12,7 @@ from orchestra.core import validators from orchestra.models import queryset, fields from orchestra.models.utils import get_model_field_path from orchestra.utils.paths import get_project_dir -from orchestra.utils.system import run +from orchestra.utils.sys import run from . import tasks from .backends import ServiceMonitor @@ -46,33 +46,33 @@ class Resource(models.Model): validators=[validators.validate_name]) verbose_name = models.CharField(_("verbose name"), max_length=256) content_type = models.ForeignKey(ContentType, - help_text=_("Model where this resource will be hooked.")) + help_text=_("Model where this resource will be hooked.")) # TODO rename to aggregation period = models.CharField(_("aggregation"), max_length=16, - choices=DataMethod.get_choices(), default=DataMethod.get_choices()[0][0], - help_text=_("Method used for aggregating this resource monitored data.")) + choices=DataMethod.get_choices(), default=DataMethod.get_choices()[0][0], + help_text=_("Method used for aggregating this resource monitored data.")) on_demand = models.BooleanField(_("on demand"), default=False, - help_text=_("If enabled the resource will not be pre-allocated, " - "but allocated under the application demand")) + help_text=_("If enabled the resource will not be pre-allocated, " + "but allocated under the application demand")) default_allocation = models.PositiveIntegerField(_("default allocation"), - null=True, blank=True, - help_text=_("Default allocation value used when this is not an " - "on demand resource")) + null=True, blank=True, + help_text=_("Default allocation value used when this is not an " + "on demand resource")) unit = models.CharField(_("unit"), max_length=16, - help_text=_("The unit in which this resource is represented. " - "For example GB, KB or subscribers")) + help_text=_("The unit in which this resource is represented. " + "For example GB, KB or subscribers")) scale = models.CharField(_("scale"), max_length=32, validators=[validate_scale], - help_text=_("Scale in which this resource monitoring resoults should " - "be prorcessed to match with unit. e.g. 10**9")) + help_text=_("Scale in which this resource monitoring resoults should " + "be prorcessed to match with unit. e.g. 10**9")) disable_trigger = models.BooleanField(_("disable trigger"), default=False, - help_text=_("Disables monitors exeeded and recovery triggers")) + help_text=_("Disables monitors exeeded and recovery triggers")) crontab = models.ForeignKey(CrontabSchedule, verbose_name=_("crontab"), - null=True, blank=True, - help_text=_("Crontab for periodic execution. " - "Leave it empty to disable periodic monitoring")) + null=True, blank=True, + help_text=_("Crontab for periodic execution. " + "Leave it empty to disable periodic monitoring")) monitors = fields.MultiSelectField(_("monitors"), max_length=256, blank=True, - choices=ServiceMonitor.get_choices(), - help_text=_("Monitor backends used for monitoring this resource.")) + choices=ServiceMonitor.get_choices(), + help_text=_("Monitor backends used for monitoring this resource.")) is_active = models.BooleanField(_("active"), default=True) objects = ResourceQuerySet.as_manager() @@ -177,10 +177,10 @@ class ResourceData(models.Model): content_type = models.ForeignKey(ContentType, verbose_name=_("content type")) object_id = models.PositiveIntegerField(_("object id")) used = models.DecimalField(_("used"), max_digits=16, decimal_places=3, null=True, - editable=False) + editable=False) updated_at = models.DateTimeField(_("updated"), null=True, editable=False) allocated = models.DecimalField(_("allocated"), max_digits=8, decimal_places=2, - null=True, blank=True) + null=True, blank=True) content_object = GenericForeignKey() diff --git a/orchestra/apps/resources/serializers.py b/orchestra/contrib/resources/serializers.py similarity index 100% rename from orchestra/apps/resources/serializers.py rename to orchestra/contrib/resources/serializers.py diff --git a/orchestra/apps/resources/tasks.py b/orchestra/contrib/resources/tasks.py similarity index 95% rename from orchestra/apps/resources/tasks.py rename to orchestra/contrib/resources/tasks.py index de89fb32..29cd5e2d 100644 --- a/orchestra/apps/resources/tasks.py +++ b/orchestra/contrib/resources/tasks.py @@ -1,6 +1,6 @@ from celery import shared_task -from orchestra.apps.orchestration.models import BackendOperation as Operation +from orchestra.contrib.orchestration.models import BackendOperation as Operation from orchestra.models.utils import get_model_field_path from .backends import ServiceMonitor diff --git a/orchestra/apps/resources/validators.py b/orchestra/contrib/resources/validators.py similarity index 100% rename from orchestra/apps/resources/validators.py rename to orchestra/contrib/resources/validators.py diff --git a/orchestra/apps/saas/__init__.py b/orchestra/contrib/saas/__init__.py similarity index 100% rename from orchestra/apps/saas/__init__.py rename to orchestra/contrib/saas/__init__.py diff --git a/orchestra/apps/saas/admin.py b/orchestra/contrib/saas/admin.py similarity index 94% rename from orchestra/apps/saas/admin.py rename to orchestra/contrib/saas/admin.py index 9fa0b8c9..159d8094 100644 --- a/orchestra/apps/saas/admin.py +++ b/orchestra/contrib/saas/admin.py @@ -2,7 +2,7 @@ from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from orchestra.plugins.admin import SelectPluginAdminMixin from .models import SaaS diff --git a/orchestra/apps/saas/backends/__init__.py b/orchestra/contrib/saas/backends/__init__.py similarity index 100% rename from orchestra/apps/saas/backends/__init__.py rename to orchestra/contrib/saas/backends/__init__.py diff --git a/orchestra/apps/saas/backends/bscw.py b/orchestra/contrib/saas/backends/bscw.py similarity index 96% rename from orchestra/apps/saas/backends/bscw.py rename to orchestra/contrib/saas/backends/bscw.py index 137a6e9c..62fcc6d5 100644 --- a/orchestra/apps/saas/backends/bscw.py +++ b/orchestra/contrib/saas/backends/bscw.py @@ -2,7 +2,7 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/saas/backends/dokuwikimu.py b/orchestra/contrib/saas/backends/dokuwikimu.py similarity index 94% rename from orchestra/apps/saas/backends/dokuwikimu.py rename to orchestra/contrib/saas/backends/dokuwikimu.py index 76eb1b51..9d64d2e5 100644 --- a/orchestra/apps/saas/backends/dokuwikimu.py +++ b/orchestra/contrib/saas/backends/dokuwikimu.py @@ -2,7 +2,7 @@ import os from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/saas/backends/drupalmu.py b/orchestra/contrib/saas/backends/drupalmu.py similarity index 95% rename from orchestra/apps/saas/backends/drupalmu.py rename to orchestra/contrib/saas/backends/drupalmu.py index 7f9caa71..26da93c2 100644 --- a/orchestra/apps/saas/backends/drupalmu.py +++ b/orchestra/contrib/saas/backends/drupalmu.py @@ -3,7 +3,7 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/saas/backends/gitlab.py b/orchestra/contrib/saas/backends/gitlab.py similarity index 98% rename from orchestra/apps/saas/backends/gitlab.py rename to orchestra/contrib/saas/backends/gitlab.py index 70ab5d91..9f2d51a6 100644 --- a/orchestra/apps/saas/backends/gitlab.py +++ b/orchestra/contrib/saas/backends/gitlab.py @@ -3,7 +3,7 @@ import json import requests from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/saas/backends/phplist.py b/orchestra/contrib/saas/backends/phplist.py similarity index 96% rename from orchestra/apps/saas/backends/phplist.py rename to orchestra/contrib/saas/backends/phplist.py index 8834e86f..c257809b 100644 --- a/orchestra/apps/saas/backends/phplist.py +++ b/orchestra/contrib/saas/backends/phplist.py @@ -3,7 +3,7 @@ import re import requests from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController class PhpListSaaSBackend(ServiceController): diff --git a/orchestra/apps/saas/backends/wordpressmu.py b/orchestra/contrib/saas/backends/wordpressmu.py similarity index 98% rename from orchestra/apps/saas/backends/wordpressmu.py rename to orchestra/contrib/saas/backends/wordpressmu.py index e0283611..604a1353 100644 --- a/orchestra/apps/saas/backends/wordpressmu.py +++ b/orchestra/contrib/saas/backends/wordpressmu.py @@ -3,7 +3,7 @@ import re import requests from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/saas/fields.py b/orchestra/contrib/saas/fields.py similarity index 100% rename from orchestra/apps/saas/fields.py rename to orchestra/contrib/saas/fields.py diff --git a/orchestra/apps/saas/models.py b/orchestra/contrib/saas/models.py similarity index 85% rename from orchestra/apps/saas/models.py rename to orchestra/contrib/saas/models.py index f943d0e3..79a70730 100644 --- a/orchestra/apps/saas/models.py +++ b/orchestra/contrib/saas/models.py @@ -13,16 +13,16 @@ from .services import SoftwareService class SaaS(models.Model): service = models.CharField(_("service"), max_length=32, - choices=SoftwareService.get_choices()) + choices=SoftwareService.get_choices()) name = models.CharField(_("Name"), max_length=64, - help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), - validators=[validators.validate_username]) + help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), + validators=[validators.validate_username]) account = models.ForeignKey('accounts.Account', verbose_name=_("account"), - related_name='saas') + related_name='saas') is_active = models.BooleanField(_("active"), default=True, - help_text=_("Designates whether this service should be treated as active. ")) + help_text=_("Designates whether this service should be treated as active. ")) data = JSONField(_("data"), default={}, - help_text=_("Extra information dependent of each service.")) + help_text=_("Extra information dependent of each service.")) database = models.ForeignKey('databases.Database', null=True, blank=True) # Some SaaS sites may need a database, with this virtual field we tell the ORM to delete them diff --git a/orchestra/apps/saas/services/__init__.py b/orchestra/contrib/saas/services/__init__.py similarity index 100% rename from orchestra/apps/saas/services/__init__.py rename to orchestra/contrib/saas/services/__init__.py diff --git a/orchestra/apps/saas/services/bscw.py b/orchestra/contrib/saas/services/bscw.py similarity index 100% rename from orchestra/apps/saas/services/bscw.py rename to orchestra/contrib/saas/services/bscw.py diff --git a/orchestra/apps/saas/services/dokuwiki.py b/orchestra/contrib/saas/services/dokuwiki.py similarity index 100% rename from orchestra/apps/saas/services/dokuwiki.py rename to orchestra/contrib/saas/services/dokuwiki.py diff --git a/orchestra/apps/saas/services/drupal.py b/orchestra/contrib/saas/services/drupal.py similarity index 100% rename from orchestra/apps/saas/services/drupal.py rename to orchestra/contrib/saas/services/drupal.py diff --git a/orchestra/apps/saas/services/gitlab.py b/orchestra/contrib/saas/services/gitlab.py similarity index 100% rename from orchestra/apps/saas/services/gitlab.py rename to orchestra/contrib/saas/services/gitlab.py diff --git a/orchestra/apps/saas/services/moodle.py b/orchestra/contrib/saas/services/moodle.py similarity index 100% rename from orchestra/apps/saas/services/moodle.py rename to orchestra/contrib/saas/services/moodle.py diff --git a/orchestra/apps/saas/services/options.py b/orchestra/contrib/saas/services/options.py similarity index 98% rename from orchestra/apps/saas/services/options.py rename to orchestra/contrib/saas/services/options.py index bdfd5e16..1861f5ae 100644 --- a/orchestra/apps/saas/services/options.py +++ b/orchestra/contrib/saas/services/options.py @@ -3,7 +3,7 @@ from django.core.exceptions import ValidationError from django.utils.translation import ugettext_lazy as _ from orchestra import plugins -from orchestra.apps.orchestration.models import BackendOperation as Operation +from orchestra.contrib.orchestration.models import BackendOperation as Operation from orchestra.core import validators from orchestra.forms import widgets from orchestra.plugins.forms import PluginDataForm diff --git a/orchestra/apps/saas/services/phplist.py b/orchestra/contrib/saas/services/phplist.py similarity index 97% rename from orchestra/apps/saas/services/phplist.py rename to orchestra/contrib/saas/services/phplist.py index 78ca7ff2..6b3e2b44 100644 --- a/orchestra/apps/saas/services/phplist.py +++ b/orchestra/contrib/saas/services/phplist.py @@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.databases.models import Database, DatabaseUser +from orchestra.contrib.databases.models import Database, DatabaseUser from orchestra.forms import widgets from .. import settings diff --git a/orchestra/apps/saas/services/seafile.py b/orchestra/contrib/saas/services/seafile.py similarity index 100% rename from orchestra/apps/saas/services/seafile.py rename to orchestra/contrib/saas/services/seafile.py diff --git a/orchestra/apps/saas/services/wordpress.py b/orchestra/contrib/saas/services/wordpress.py similarity index 100% rename from orchestra/apps/saas/services/wordpress.py rename to orchestra/contrib/saas/services/wordpress.py diff --git a/orchestra/apps/saas/settings.py b/orchestra/contrib/saas/settings.py similarity index 76% rename from orchestra/apps/saas/settings.py rename to orchestra/contrib/saas/settings.py index ae3be3d1..0862aa36 100644 --- a/orchestra/apps/saas/settings.py +++ b/orchestra/contrib/saas/settings.py @@ -4,14 +4,14 @@ from orchestra.settings import BASE_DOMAIN SAAS_ENABLED_SERVICES = getattr(settings, 'SAAS_ENABLED_SERVICES', ( - 'orchestra.apps.saas.services.moodle.MoodleService', - 'orchestra.apps.saas.services.bscw.BSCWService', - 'orchestra.apps.saas.services.gitlab.GitLabService', - 'orchestra.apps.saas.services.phplist.PHPListService', - 'orchestra.apps.saas.services.wordpress.WordPressService', - 'orchestra.apps.saas.services.dokuwiki.DokuWikiService', - 'orchestra.apps.saas.services.drupal.DrupalService', - 'orchestra.apps.saas.services.seafile.SeaFileService', + 'orchestra.contrib.saas.services.moodle.MoodleService', + 'orchestra.contrib.saas.services.bscw.BSCWService', + 'orchestra.contrib.saas.services.gitlab.GitLabService', + 'orchestra.contrib.saas.services.phplist.PHPListService', + 'orchestra.contrib.saas.services.wordpress.WordPressService', + 'orchestra.contrib.saas.services.dokuwiki.DokuWikiService', + 'orchestra.contrib.saas.services.drupal.DrupalService', + 'orchestra.contrib.saas.services.seafile.SeaFileService', )) diff --git a/orchestra/apps/services/__init__.py b/orchestra/contrib/services/__init__.py similarity index 100% rename from orchestra/apps/services/__init__.py rename to orchestra/contrib/services/__init__.py diff --git a/orchestra/apps/services/actions.py b/orchestra/contrib/services/actions.py similarity index 100% rename from orchestra/apps/services/actions.py rename to orchestra/contrib/services/actions.py diff --git a/orchestra/apps/services/admin.py b/orchestra/contrib/services/admin.py similarity index 100% rename from orchestra/apps/services/admin.py rename to orchestra/contrib/services/admin.py diff --git a/orchestra/apps/services/handlers.py b/orchestra/contrib/services/handlers.py similarity index 99% rename from orchestra/apps/services/handlers.py rename to orchestra/contrib/services/handlers.py index 67ae0d41..5ea70bd1 100644 --- a/orchestra/apps/services/handlers.py +++ b/orchestra/contrib/services/handlers.py @@ -117,7 +117,7 @@ class ServiceHandler(plugins.Plugin, metaclass=plugins.PluginMount): 'instance': instance, 'math': math, 'logsteps': lambda n, size=1: \ - round(n/(size*10**int(math.log10(max(n, 1)))))*size*10**int(math.log10(max(n, 1))), + round(n/(decimal.Decimal(size*10**int(math.log10(max(n, 1))))))*size*10**int(math.log10(max(n, 1))), 'log10': math.log10, 'Decimal': decimal.Decimal, } diff --git a/orchestra/apps/services/helpers.py b/orchestra/contrib/services/helpers.py similarity index 100% rename from orchestra/apps/services/helpers.py rename to orchestra/contrib/services/helpers.py diff --git a/orchestra/apps/services/models.py b/orchestra/contrib/services/models.py similarity index 55% rename from orchestra/apps/services/models.py rename to orchestra/contrib/services/models.py index 84c65edf..43a68eae 100644 --- a/orchestra/apps/services/models.py +++ b/orchestra/contrib/services/models.py @@ -47,110 +47,110 @@ class Service(models.Model): description = models.CharField(_("description"), max_length=256, unique=True) content_type = models.ForeignKey(ContentType, verbose_name=_("content type"), - help_text=_("Content type of the related service objects.")) + help_text=_("Content type of the related service objects.")) match = models.CharField(_("match"), max_length=256, blank=True, - help_text=_( - "Python expression " - "that designates wheter a content_type object is related to this service " - "or not, always evaluates True when left blank. " - "Related instance can be instantiated with instance keyword or " - "content_type.model_name.
" - " databaseuser.type == 'MYSQL'
" - " miscellaneous.active and str(miscellaneous.identifier).endswith(('.org', '.net', '.com'))
" - " contractedplan.plan.name == 'association_fee''
" - " instance.active")) + help_text=_( + "Python expression " + "that designates wheter a content_type object is related to this service " + "or not, always evaluates True when left blank. " + "Related instance can be instantiated with instance keyword or " + "content_type.model_name.
" + " databaseuser.type == 'MYSQL'
" + " miscellaneous.active and str(miscellaneous.identifier).endswith(('.org', '.net', '.com'))
" + " contractedplan.plan.name == 'association_fee''
" + " instance.active")) handler_type = models.CharField(_("handler"), max_length=256, blank=True, - help_text=_("Handler used for processing this Service. A handler " - "enables customized behaviour far beyond what options " - "here allow to."), - choices=ServiceHandler.get_choices()) + help_text=_("Handler used for processing this Service. A handler " + "enables customized behaviour far beyond what options " + "here allow to."), + choices=ServiceHandler.get_choices()) is_active = models.BooleanField(_("active"), default=True) ignore_superusers = models.BooleanField(_("ignore %s") % _ignore_types, default=True, - help_text=_("Designates whether %s orders are marked as ignored by default or not.") % _ignore_types) + help_text=_("Designates whether %s orders are marked as ignored by default or not.") % _ignore_types) # Billing billing_period = models.CharField(_("billing period"), max_length=16, - help_text=_("Renewal period for recurring invoicing."), - choices=( - (NEVER, _("One time service")), - (MONTHLY, _("Monthly billing")), - (ANUAL, _("Anual billing")), - ), - default=ANUAL, blank=True) + help_text=_("Renewal period for recurring invoicing."), + choices=( + (NEVER, _("One time service")), + (MONTHLY, _("Monthly billing")), + (ANUAL, _("Anual billing")), + ), + default=ANUAL, blank=True) billing_point = models.CharField(_("billing point"), max_length=16, - help_text=_("Reference point for calculating the renewal date " - "on recurring invoices"), - choices=( - (ON_REGISTER, _("Registration date")), - (FIXED_DATE, _("Fixed billing date")), - ), - default=FIXED_DATE) + help_text=_("Reference point for calculating the renewal date " + "on recurring invoices"), + choices=( + (ON_REGISTER, _("Registration date")), + (FIXED_DATE, _("Fixed billing date")), + ), + default=FIXED_DATE) is_fee = models.BooleanField(_("fee"), default=False, - help_text=_("Designates whether this service should be billed as " - " membership fee or not")) + help_text=_("Designates whether this service should be billed as " + " membership fee or not")) order_description = models.CharField(_("Order description"), max_length=128, blank=True, - help_text=_( - "Python expression " - "used for generating the description for the bill lines of this services.
" - "Defaults to '%s: %s' % (handler.description, instance)" - )) + help_text=_( + "Python expression " + "used for generating the description for the bill lines of this services.
" + "Defaults to '%s: %s' % (handler.description, instance)" + )) ignore_period = models.CharField(_("ignore period"), max_length=16, blank=True, - help_text=_("Period in which orders will be ignored if cancelled. " - "Useful for designating trial periods"), - choices=( - (NEVER, _("Never")), - (ONE_DAY, _("One day")), - (TWO_DAYS, _("Two days")), - (TEN_DAYS, _("Ten days")), - (ONE_MONTH, _("One month")), - ), - default=settings.SERVICES_DEFAULT_IGNORE_PERIOD) + help_text=_("Period in which orders will be ignored if cancelled. " + "Useful for designating trial periods"), + choices=( + (NEVER, _("Never")), + (ONE_DAY, _("One day")), + (TWO_DAYS, _("Two days")), + (TEN_DAYS, _("Ten days")), + (ONE_MONTH, _("One month")), + ), + default=settings.SERVICES_DEFAULT_IGNORE_PERIOD) # Pricing metric = models.CharField(_("metric"), max_length=256, blank=True, - help_text=_( - "Python expression " - "used for obtinging the metric value for the pricing rate computation. " - "Number of orders is used when left blank. Related instance can be instantiated " - "with instance keyword or content_type.model_name.
" - " max((mailbox.resources.disk.allocated or 0) -1, 0)
" - " miscellaneous.amount
" - " max((account.resources.traffic.used or 0) -" - " getattr(account.miscellaneous.filter(is_active=True," - " service__name='traffic-prepay').last(), 'amount', 0), 0)")) + help_text=_( + "Python expression " + "used for obtinging the metric value for the pricing rate computation. " + "Number of orders is used when left blank. Related instance can be instantiated " + "with instance keyword or content_type.model_name.
" + " max((mailbox.resources.disk.allocated or 0) -1, 0)
" + " miscellaneous.amount
" + " max((account.resources.traffic.used or 0) -" + " getattr(account.miscellaneous.filter(is_active=True," + " service__name='traffic-prepay').last(), 'amount', 0), 0)")) nominal_price = models.DecimalField(_("nominal price"), max_digits=12, - decimal_places=2) + decimal_places=2) tax = models.PositiveIntegerField(_("tax"), choices=settings.SERVICES_SERVICE_TAXES, - default=settings.SERVICES_SERVICE_DEFAULT_TAX) + default=settings.SERVICES_SERVICE_DEFAULT_TAX) pricing_period = models.CharField(_("pricing period"), max_length=16, blank=True, - help_text=_("Time period that is used for computing the rate metric."), - choices=( - (NEVER, _("Current value")), - (BILLING_PERIOD, _("Same as billing period")), - (MONTHLY, _("Monthly data")), - (ANUAL, _("Anual data")), - ), - default=BILLING_PERIOD) + help_text=_("Time period that is used for computing the rate metric."), + choices=( + (NEVER, _("Current value")), + (BILLING_PERIOD, _("Same as billing period")), + (MONTHLY, _("Monthly data")), + (ANUAL, _("Anual data")), + ), + default=BILLING_PERIOD) rate_algorithm = models.CharField(_("rate algorithm"), max_length=16, - help_text=string_concat(_("Algorithm used to interprete the rating table."), *[ - string_concat('
  ', method.verbose_name, ': ', method.help_text) - for name, method in rate_class.get_methods().items() - ]), choices=rate_class.get_choices(), default=rate_class.get_choices()[0][0]) + help_text=string_concat(_("Algorithm used to interprete the rating table."), *[ + string_concat('
  ', method.verbose_name, ': ', method.help_text) + for name, method in rate_class.get_methods().items() + ]), choices=rate_class.get_choices(), default=rate_class.get_choices()[0][0]) on_cancel = models.CharField(_("on cancel"), max_length=16, - help_text=_("Defines the cancellation behaviour of this service."), - choices=( - (NOTHING, _("Nothing")), - (DISCOUNT, _("Discount")), - (COMPENSATE, _("Compensat")), - (REFUND, _("Refund")), - ), - default=DISCOUNT) + help_text=_("Defines the cancellation behaviour of this service."), + choices=( + (NOTHING, _("Nothing")), + (DISCOUNT, _("Discount")), + (COMPENSATE, _("Compensat")), + (REFUND, _("Refund")), + ), + default=DISCOUNT) payment_style = models.CharField(_("payment style"), max_length=16, - help_text=_("Designates whether this service should be paid after " - "consumtion (postpay/on demand) or prepaid."), - choices=( - (PREPAY, _("Prepay")), - (POSTPAY, _("Postpay (on demand)")), - ), - default=PREPAY) + help_text=_("Designates whether this service should be paid after " + "consumtion (postpay/on demand) or prepaid."), + choices=( + (PREPAY, _("Prepay")), + (POSTPAY, _("Postpay (on demand)")), + ), + default=PREPAY) def __str__(self): return self.description diff --git a/orchestra/apps/services/settings.py b/orchestra/contrib/services/settings.py similarity index 94% rename from orchestra/apps/services/settings.py rename to orchestra/contrib/services/settings.py index 66323aef..15867ce9 100644 --- a/orchestra/apps/services/settings.py +++ b/orchestra/contrib/services/settings.py @@ -24,7 +24,7 @@ SERVICES_ORDER_MODEL = getattr(settings, 'SERVICES_ORDER_MODEL', SERVICES_RATE_CLASS = getattr(settings, 'SERVICES_RATE_CLASS', - 'orchestra.apps.plans.models.Rate' + 'orchestra.contrib.plans.models.Rate' ) diff --git a/orchestra/apps/services/static/services/img/services.png b/orchestra/contrib/services/static/services/img/services.png similarity index 100% rename from orchestra/apps/services/static/services/img/services.png rename to orchestra/contrib/services/static/services/img/services.png diff --git a/orchestra/apps/services/static/services/img/services.svg b/orchestra/contrib/services/static/services/img/services.svg similarity index 100% rename from orchestra/apps/services/static/services/img/services.svg rename to orchestra/contrib/services/static/services/img/services.svg diff --git a/orchestra/apps/services/templates/admin/services/service/change_form.html b/orchestra/contrib/services/templates/admin/services/service/change_form.html similarity index 100% rename from orchestra/apps/services/templates/admin/services/service/change_form.html rename to orchestra/contrib/services/templates/admin/services/service/change_form.html diff --git a/orchestra/apps/services/templates/admin/services/service/help.html b/orchestra/contrib/services/templates/admin/services/service/help.html similarity index 100% rename from orchestra/apps/services/templates/admin/services/service/help.html rename to orchestra/contrib/services/templates/admin/services/service/help.html diff --git a/orchestra/apps/services/templates/admin/services/service/update_orders.html b/orchestra/contrib/services/templates/admin/services/service/update_orders.html similarity index 100% rename from orchestra/apps/services/templates/admin/services/service/update_orders.html rename to orchestra/contrib/services/templates/admin/services/service/update_orders.html diff --git a/orchestra/apps/services/tests/__init__.py b/orchestra/contrib/services/tests/__init__.py similarity index 100% rename from orchestra/apps/services/tests/__init__.py rename to orchestra/contrib/services/tests/__init__.py diff --git a/orchestra/apps/services/tests/functional_tests/__init__.py b/orchestra/contrib/services/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/services/tests/functional_tests/__init__.py rename to orchestra/contrib/services/tests/functional_tests/__init__.py diff --git a/orchestra/apps/services/tests/functional_tests/test_domain.py b/orchestra/contrib/services/tests/functional_tests/test_domain.py similarity index 97% rename from orchestra/apps/services/tests/functional_tests/test_domain.py rename to orchestra/contrib/services/tests/functional_tests/test_domain.py index 7811681d..eb050f0a 100644 --- a/orchestra/apps/services/tests/functional_tests/test_domain.py +++ b/orchestra/contrib/services/tests/functional_tests/test_domain.py @@ -1,7 +1,7 @@ from django.contrib.contenttypes.models import ContentType -from orchestra.apps.miscellaneous.models import MiscService, Miscellaneous -from orchestra.apps.plans.models import Plan +from orchestra.contrib.miscellaneous.models import MiscService, Miscellaneous +from orchestra.contrib.plans.models import Plan from orchestra.utils.tests import random_ascii from ...models import Service diff --git a/orchestra/apps/services/tests/functional_tests/test_ftp.py b/orchestra/contrib/services/tests/functional_tests/test_ftp.py similarity index 98% rename from orchestra/apps/services/tests/functional_tests/test_ftp.py rename to orchestra/contrib/services/tests/functional_tests/test_ftp.py index d1fa1346..93c07c15 100644 --- a/orchestra/apps/services/tests/functional_tests/test_ftp.py +++ b/orchestra/contrib/services/tests/functional_tests/test_ftp.py @@ -5,7 +5,7 @@ from dateutil.relativedelta import relativedelta from django.contrib.contenttypes.models import ContentType from django.utils import timezone -from orchestra.apps.systemusers.models import SystemUser +from orchestra.contrib.systemusers.models import SystemUser from orchestra.utils.tests import random_ascii from ... import settings diff --git a/orchestra/apps/services/tests/functional_tests/test_job.py b/orchestra/contrib/services/tests/functional_tests/test_job.py similarity index 93% rename from orchestra/apps/services/tests/functional_tests/test_job.py rename to orchestra/contrib/services/tests/functional_tests/test_job.py index be24433c..a208bea9 100644 --- a/orchestra/apps/services/tests/functional_tests/test_job.py +++ b/orchestra/contrib/services/tests/functional_tests/test_job.py @@ -1,7 +1,7 @@ from django.contrib.contenttypes.models import ContentType -from orchestra.apps.miscellaneous.models import MiscService, Miscellaneous -from orchestra.apps.plans.models import Plan +from orchestra.contrib.miscellaneous.models import MiscService, Miscellaneous +from orchestra.contrib.plans.models import Plan from orchestra.utils.tests import random_ascii from ...models import Service diff --git a/orchestra/apps/services/tests/functional_tests/test_mailbox.py b/orchestra/contrib/services/tests/functional_tests/test_mailbox.py similarity index 97% rename from orchestra/apps/services/tests/functional_tests/test_mailbox.py rename to orchestra/contrib/services/tests/functional_tests/test_mailbox.py index 761fe0cb..6d2c76c5 100644 --- a/orchestra/apps/services/tests/functional_tests/test_mailbox.py +++ b/orchestra/contrib/services/tests/functional_tests/test_mailbox.py @@ -3,9 +3,9 @@ from django.contrib.contenttypes.models import ContentType from django.utils import timezone from freezegun import freeze_time -from orchestra.apps.mailboxes.models import Mailbox -from orchestra.apps.plans.models import Plan -from orchestra.apps.resources.models import Resource, ResourceData +from orchestra.contrib.mailboxes.models import Mailbox +from orchestra.contrib.plans.models import Plan +from orchestra.contrib.resources.models import Resource, ResourceData from orchestra.utils.tests import random_ascii from ...models import Service diff --git a/orchestra/apps/services/tests/functional_tests/test_plan.py b/orchestra/contrib/services/tests/functional_tests/test_plan.py similarity index 96% rename from orchestra/apps/services/tests/functional_tests/test_plan.py rename to orchestra/contrib/services/tests/functional_tests/test_plan.py index a8d14599..7ffffdf1 100644 --- a/orchestra/apps/services/tests/functional_tests/test_plan.py +++ b/orchestra/contrib/services/tests/functional_tests/test_plan.py @@ -1,6 +1,6 @@ from django.contrib.contenttypes.models import ContentType -from orchestra.apps.plans.models import Plan, ContractedPlan +from orchestra.contrib.plans.models import Plan, ContractedPlan from ...models import Service diff --git a/orchestra/apps/services/tests/functional_tests/test_traffic.py b/orchestra/contrib/services/tests/functional_tests/test_traffic.py similarity index 96% rename from orchestra/apps/services/tests/functional_tests/test_traffic.py rename to orchestra/contrib/services/tests/functional_tests/test_traffic.py index b3885a5e..db357f66 100644 --- a/orchestra/apps/services/tests/functional_tests/test_traffic.py +++ b/orchestra/contrib/services/tests/functional_tests/test_traffic.py @@ -3,10 +3,10 @@ from django.contrib.contenttypes.models import ContentType from django.utils import timezone from freezegun import freeze_time -from orchestra.apps.accounts.models import Account -from orchestra.apps.miscellaneous.models import MiscService, Miscellaneous -from orchestra.apps.plans.models import Plan -from orchestra.apps.resources.models import Resource, ResourceData, MonitorData +from orchestra.contrib.accounts.models import Account +from orchestra.contrib.miscellaneous.models import MiscService, Miscellaneous +from orchestra.contrib.plans.models import Plan +from orchestra.contrib.resources.models import Resource, ResourceData, MonitorData from ...models import Service diff --git a/orchestra/apps/services/tests/test_handler.py b/orchestra/contrib/services/tests/test_handler.py similarity index 99% rename from orchestra/apps/services/tests/test_handler.py rename to orchestra/contrib/services/tests/test_handler.py index e3f2b987..01e42d95 100644 --- a/orchestra/apps/services/tests/test_handler.py +++ b/orchestra/contrib/services/tests/test_handler.py @@ -4,7 +4,7 @@ import decimal from django.contrib.contenttypes.models import ContentType from django.utils import timezone -from orchestra.apps.systemusers.models import SystemUser +from orchestra.contrib.systemusers.models import SystemUser from orchestra.utils.tests import BaseTestCase from .. import helpers @@ -26,8 +26,8 @@ class Order(object): class HandlerTests(BaseTestCase): DEPENDENCIES = ( - 'orchestra.apps.orders', - 'orchestra.apps.systemusers', + 'orchestra.contrib.orders', + 'orchestra.contrib.systemusers', ) def create_ftp_service(self): diff --git a/orchestra/apps/systemusers/__init__.py b/orchestra/contrib/systemusers/__init__.py similarity index 100% rename from orchestra/apps/systemusers/__init__.py rename to orchestra/contrib/systemusers/__init__.py diff --git a/orchestra/apps/systemusers/actions.py b/orchestra/contrib/systemusers/actions.py similarity index 96% rename from orchestra/apps/systemusers/actions.py rename to orchestra/contrib/systemusers/actions.py index 7569c9be..e656a0b7 100644 --- a/orchestra/apps/systemusers/actions.py +++ b/orchestra/contrib/systemusers/actions.py @@ -4,7 +4,7 @@ from django.core.exceptions import PermissionDenied from django.utils.translation import ungettext, ugettext_lazy as _ from orchestra.admin.decorators import action_with_confirmation -from orchestra.apps.orchestration.models import BackendOperation as Operation +from orchestra.contrib.orchestration.models import BackendOperation as Operation class GrantPermissionForm(forms.Form): diff --git a/orchestra/apps/systemusers/admin.py b/orchestra/contrib/systemusers/admin.py similarity index 95% rename from orchestra/apps/systemusers/admin.py rename to orchestra/contrib/systemusers/admin.py index bf236767..15b77858 100644 --- a/orchestra/apps/systemusers/admin.py +++ b/orchestra/contrib/systemusers/admin.py @@ -2,8 +2,8 @@ from django.contrib import admin from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin, ChangePasswordAdminMixin -from orchestra.apps.accounts.admin import SelectAccountAdminMixin -from orchestra.apps.accounts.filters import IsActiveListFilter +from orchestra.contrib.accounts.admin import SelectAccountAdminMixin +from orchestra.contrib.accounts.filters import IsActiveListFilter from .actions import grant_permission, delete_selected from .filters import IsMainListFilter diff --git a/orchestra/apps/systemusers/api.py b/orchestra/contrib/systemusers/api.py similarity index 92% rename from orchestra/apps/systemusers/api.py rename to orchestra/contrib/systemusers/api.py index 68c0fce6..2775edbb 100644 --- a/orchestra/apps/systemusers/api.py +++ b/orchestra/contrib/systemusers/api.py @@ -2,7 +2,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import viewsets, exceptions from orchestra.api import router, SetPasswordApiMixin -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from .models import SystemUser from .serializers import SystemUserSerializer diff --git a/orchestra/apps/systemusers/backends.py b/orchestra/contrib/systemusers/backends.py similarity index 99% rename from orchestra/apps/systemusers/backends.py rename to orchestra/contrib/systemusers/backends.py index c17c69e4..96c1ff6f 100644 --- a/orchestra/apps/systemusers/backends.py +++ b/orchestra/contrib/systemusers/backends.py @@ -3,8 +3,8 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.resources import ServiceMonitor from . import settings diff --git a/orchestra/apps/systemusers/filters.py b/orchestra/contrib/systemusers/filters.py similarity index 100% rename from orchestra/apps/systemusers/filters.py rename to orchestra/contrib/systemusers/filters.py diff --git a/orchestra/apps/systemusers/forms.py b/orchestra/contrib/systemusers/forms.py similarity index 100% rename from orchestra/apps/systemusers/forms.py rename to orchestra/contrib/systemusers/forms.py diff --git a/orchestra/apps/systemusers/migrations/0001_initial.py b/orchestra/contrib/systemusers/migrations/0001_initial.py similarity index 100% rename from orchestra/apps/systemusers/migrations/0001_initial.py rename to orchestra/contrib/systemusers/migrations/0001_initial.py diff --git a/orchestra/apps/systemusers/migrations/0002_systemuser_relative_to_main.py b/orchestra/contrib/systemusers/migrations/0002_systemuser_relative_to_main.py similarity index 100% rename from orchestra/apps/systemusers/migrations/0002_systemuser_relative_to_main.py rename to orchestra/contrib/systemusers/migrations/0002_systemuser_relative_to_main.py diff --git a/orchestra/apps/systemusers/migrations/0003_auto_20141114_1340.py b/orchestra/contrib/systemusers/migrations/0003_auto_20141114_1340.py similarity index 100% rename from orchestra/apps/systemusers/migrations/0003_auto_20141114_1340.py rename to orchestra/contrib/systemusers/migrations/0003_auto_20141114_1340.py diff --git a/orchestra/apps/systemusers/migrations/__init__.py b/orchestra/contrib/systemusers/migrations/__init__.py similarity index 100% rename from orchestra/apps/systemusers/migrations/__init__.py rename to orchestra/contrib/systemusers/migrations/__init__.py diff --git a/orchestra/apps/systemusers/models.py b/orchestra/contrib/systemusers/models.py similarity index 86% rename from orchestra/apps/systemusers/models.py rename to orchestra/contrib/systemusers/models.py index 86757c92..3fb40a39 100644 --- a/orchestra/apps/systemusers/models.py +++ b/orchestra/contrib/systemusers/models.py @@ -26,24 +26,24 @@ class SystemUser(models.Model): Username max_length determined by LINUX system user lentgh: 32 """ username = models.CharField(_("username"), max_length=32, unique=True, - help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), - validators=[validators.validate_username]) + help_text=_("Required. 64 characters or fewer. Letters, digits and ./-/_ only."), + validators=[validators.validate_username]) password = models.CharField(_("password"), max_length=128) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='systemusers') + related_name='systemusers') home = models.CharField(_("home"), max_length=256, blank=True, - help_text=_("Starting location when login with this no-shell user.")) + help_text=_("Starting location when login with this no-shell user.")) directory = models.CharField(_("directory"), max_length=256, blank=True, - help_text=_("Optional directory relative to user's home.")) + help_text=_("Optional directory relative to user's home.")) shell = models.CharField(_("shell"), max_length=32, choices=settings.SYSTEMUSERS_SHELLS, - default=settings.SYSTEMUSERS_DEFAULT_SHELL) + default=settings.SYSTEMUSERS_DEFAULT_SHELL) groups = models.ManyToManyField('self', blank=True, symmetrical=False, - help_text=_("A new group will be created for the user. " - "Which additional groups would you like them to be a member of?")) + help_text=_("A new group will be created for the user. " + "Which additional groups would you like them to be a member of?")) # is_main = models.BooleanField(_("is main"), default=False) is_active = models.BooleanField(_("active"), default=True, - help_text=_("Designates whether this account should be treated as active. " - "Unselect this instead of deleting accounts.")) + help_text=_("Designates whether this account should be treated as active. " + "Unselect this instead of deleting accounts.")) objects = SystemUserQuerySet.as_manager() diff --git a/orchestra/apps/systemusers/serializers.py b/orchestra/contrib/systemusers/serializers.py similarity index 97% rename from orchestra/apps/systemusers/serializers.py rename to orchestra/contrib/systemusers/serializers.py index 4270b193..72778ad6 100644 --- a/orchestra/apps/systemusers/serializers.py +++ b/orchestra/contrib/systemusers/serializers.py @@ -4,7 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from orchestra.core.validators import validate_password from .models import SystemUser diff --git a/orchestra/apps/systemusers/settings.py b/orchestra/contrib/systemusers/settings.py similarity index 100% rename from orchestra/apps/systemusers/settings.py rename to orchestra/contrib/systemusers/settings.py diff --git a/orchestra/apps/systemusers/tests/__init__.py b/orchestra/contrib/systemusers/tests/__init__.py similarity index 100% rename from orchestra/apps/systemusers/tests/__init__.py rename to orchestra/contrib/systemusers/tests/__init__.py diff --git a/orchestra/apps/systemusers/tests/functional_tests/__init__.py b/orchestra/contrib/systemusers/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/systemusers/tests/functional_tests/__init__.py rename to orchestra/contrib/systemusers/tests/functional_tests/__init__.py diff --git a/orchestra/apps/systemusers/tests/functional_tests/tests.py b/orchestra/contrib/systemusers/tests/functional_tests/tests.py similarity index 98% rename from orchestra/apps/systemusers/tests/functional_tests/tests.py rename to orchestra/contrib/systemusers/tests/functional_tests/tests.py index dd2997f0..4ea1d825 100644 --- a/orchestra/apps/systemusers/tests/functional_tests/tests.py +++ b/orchestra/contrib/systemusers/tests/functional_tests/tests.py @@ -11,9 +11,9 @@ from django.core.urlresolvers import reverse from selenium.webdriver.support.select import Select from orchestra.admin.utils import change_url -from orchestra.apps.accounts.models import Account -from orchestra.apps.orchestration.models import Server, Route -from orchestra.utils.system import run, sshrun +from orchestra.contrib.accounts.models import Account +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.utils.sys import run, sshrun from orchestra.utils.tests import (BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error) @@ -28,7 +28,7 @@ sshr = partial(sshrun, silent=True, display=False) class SystemUserMixin(object): MASTER_SERVER = os.environ.get('ORCHESTRA_MASTER_SERVER', 'localhost') DEPENDENCIES = ( - 'orchestra.apps.orchestration', + 'orchestra.contrib.orchestration', 'orcgestra.apps.systemusers', ) diff --git a/orchestra/apps/vps/__init__.py b/orchestra/contrib/vps/__init__.py similarity index 100% rename from orchestra/apps/vps/__init__.py rename to orchestra/contrib/vps/__init__.py diff --git a/orchestra/apps/vps/admin.py b/orchestra/contrib/vps/admin.py similarity index 95% rename from orchestra/apps/vps/admin.py rename to orchestra/contrib/vps/admin.py index dee36778..9b31d584 100644 --- a/orchestra/apps/vps/admin.py +++ b/orchestra/contrib/vps/admin.py @@ -4,7 +4,7 @@ from django.contrib.auth.admin import UserAdmin from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from .forms import VPSChangeForm, VPSCreationForm from .models import VPS diff --git a/orchestra/apps/vps/backends.py b/orchestra/contrib/vps/backends.py similarity index 95% rename from orchestra/apps/vps/backends.py rename to orchestra/contrib/vps/backends.py index dd70da2b..edbd303a 100644 --- a/orchestra/apps/vps/backends.py +++ b/orchestra/contrib/vps/backends.py @@ -1,4 +1,4 @@ -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.resources import ServiceMonitor class OpenVZTraffic(ServiceMonitor): diff --git a/orchestra/apps/vps/forms.py b/orchestra/contrib/vps/forms.py similarity index 100% rename from orchestra/apps/vps/forms.py rename to orchestra/contrib/vps/forms.py diff --git a/orchestra/apps/vps/models.py b/orchestra/contrib/vps/models.py similarity index 77% rename from orchestra/apps/vps/models.py rename to orchestra/contrib/vps/models.py index f0777c9c..d647871d 100644 --- a/orchestra/apps/vps/models.py +++ b/orchestra/contrib/vps/models.py @@ -10,15 +10,15 @@ from . import settings class VPS(models.Model): hostname = models.CharField(_("hostname"), max_length=256, unique=True, - validators=[validate_hostname]) + validators=[validate_hostname]) type = models.CharField(_("type"), max_length=64, choices=settings.VPS_TYPES, - default=settings.VPS_DEFAULT_TYPE) + default=settings.VPS_DEFAULT_TYPE) template = models.CharField(_("template"), max_length=64, - choices=settings.VPS_TEMPLATES, default=settings.VPS_DEFAULT_TEMPLATE) + choices=settings.VPS_TEMPLATES, default=settings.VPS_DEFAULT_TEMPLATE) password = models.CharField(_('password'), max_length=128, - help_text=_("root password of this virtual machine")) + help_text=_("root password of this virtual machine")) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='vpss') + related_name='vpss') class Meta: verbose_name = "VPS" diff --git a/orchestra/apps/vps/settings.py b/orchestra/contrib/vps/settings.py similarity index 100% rename from orchestra/apps/vps/settings.py rename to orchestra/contrib/vps/settings.py diff --git a/orchestra/apps/webapps/__init__.py b/orchestra/contrib/webapps/__init__.py similarity index 100% rename from orchestra/apps/webapps/__init__.py rename to orchestra/contrib/webapps/__init__.py diff --git a/orchestra/apps/webapps/admin.py b/orchestra/contrib/webapps/admin.py similarity index 98% rename from orchestra/apps/webapps/admin.py rename to orchestra/contrib/webapps/admin.py index 935e924b..db40af67 100644 --- a/orchestra/apps/webapps/admin.py +++ b/orchestra/contrib/webapps/admin.py @@ -6,7 +6,7 @@ from django.utils.translation import ugettext, ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import change_url -from orchestra.apps.accounts.admin import AccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin from orchestra.forms.widgets import DynamicHelpTextSelect from orchestra.plugins.admin import SelectPluginAdminMixin diff --git a/orchestra/apps/webapps/api.py b/orchestra/contrib/webapps/api.py similarity index 92% rename from orchestra/apps/webapps/api.py rename to orchestra/contrib/webapps/api.py index 97b2aa06..86231b1e 100644 --- a/orchestra/apps/webapps/api.py +++ b/orchestra/contrib/webapps/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from . import settings from .models import WebApp diff --git a/orchestra/apps/webapps/backends/__init__.py b/orchestra/contrib/webapps/backends/__init__.py similarity index 100% rename from orchestra/apps/webapps/backends/__init__.py rename to orchestra/contrib/webapps/backends/__init__.py diff --git a/orchestra/apps/webapps/backends/php.py b/orchestra/contrib/webapps/backends/php.py similarity index 99% rename from orchestra/apps/webapps/backends/php.py rename to orchestra/contrib/webapps/backends/php.py index bc509fd5..42b9a2a5 100644 --- a/orchestra/apps/webapps/backends/php.py +++ b/orchestra/contrib/webapps/backends/php.py @@ -4,7 +4,7 @@ import textwrap from django.template import Template, Context from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from . import WebAppServiceMixin from .. import settings diff --git a/orchestra/apps/webapps/backends/static.py b/orchestra/contrib/webapps/backends/static.py similarity index 89% rename from orchestra/apps/webapps/backends/static.py rename to orchestra/contrib/webapps/backends/static.py index 6bd1b731..b5179be3 100644 --- a/orchestra/apps/webapps/backends/static.py +++ b/orchestra/contrib/webapps/backends/static.py @@ -1,6 +1,6 @@ from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from . import WebAppServiceMixin diff --git a/orchestra/apps/webapps/backends/symboliclink.py b/orchestra/contrib/webapps/backends/symboliclink.py similarity index 93% rename from orchestra/apps/webapps/backends/symboliclink.py rename to orchestra/contrib/webapps/backends/symboliclink.py index f97f5c3a..b725ceef 100644 --- a/orchestra/apps/webapps/backends/symboliclink.py +++ b/orchestra/contrib/webapps/backends/symboliclink.py @@ -1,6 +1,6 @@ from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from . import WebAppServiceMixin diff --git a/orchestra/apps/webapps/backends/webalizer.py b/orchestra/contrib/webapps/backends/webalizer.py similarity index 90% rename from orchestra/apps/webapps/backends/webalizer.py rename to orchestra/contrib/webapps/backends/webalizer.py index 70e5b20d..68e49005 100644 --- a/orchestra/apps/webapps/backends/webalizer.py +++ b/orchestra/contrib/webapps/backends/webalizer.py @@ -1,6 +1,6 @@ from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from . import WebAppServiceMixin diff --git a/orchestra/apps/webapps/backends/wordpress.py b/orchestra/contrib/webapps/backends/wordpress.py similarity index 98% rename from orchestra/apps/webapps/backends/wordpress.py rename to orchestra/contrib/webapps/backends/wordpress.py index b84fad76..bad1948b 100644 --- a/orchestra/apps/webapps/backends/wordpress.py +++ b/orchestra/contrib/webapps/backends/wordpress.py @@ -2,7 +2,7 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/webapps/backends/wordpressmu.py b/orchestra/contrib/webapps/backends/wordpressmu.py similarity index 98% rename from orchestra/apps/webapps/backends/wordpressmu.py rename to orchestra/contrib/webapps/backends/wordpressmu.py index 1aa75203..ac304f4f 100644 --- a/orchestra/apps/webapps/backends/wordpressmu.py +++ b/orchestra/contrib/webapps/backends/wordpressmu.py @@ -3,7 +3,7 @@ import re import requests from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/webapps/fields.py b/orchestra/contrib/webapps/fields.py similarity index 100% rename from orchestra/apps/webapps/fields.py rename to orchestra/contrib/webapps/fields.py diff --git a/orchestra/apps/webapps/migrations/0001_initial.py b/orchestra/contrib/webapps/migrations/0001_initial.py similarity index 100% rename from orchestra/apps/webapps/migrations/0001_initial.py rename to orchestra/contrib/webapps/migrations/0001_initial.py diff --git a/orchestra/apps/webapps/migrations/0002_webapp_data.py b/orchestra/contrib/webapps/migrations/0002_webapp_data.py similarity index 100% rename from orchestra/apps/webapps/migrations/0002_webapp_data.py rename to orchestra/contrib/webapps/migrations/0002_webapp_data.py diff --git a/orchestra/apps/webapps/migrations/0003_auto_20150310_2103.py b/orchestra/contrib/webapps/migrations/0003_auto_20150310_2103.py similarity index 100% rename from orchestra/apps/webapps/migrations/0003_auto_20150310_2103.py rename to orchestra/contrib/webapps/migrations/0003_auto_20150310_2103.py diff --git a/orchestra/apps/webapps/migrations/__init__.py b/orchestra/contrib/webapps/migrations/__init__.py similarity index 100% rename from orchestra/apps/webapps/migrations/__init__.py rename to orchestra/contrib/webapps/migrations/__init__.py diff --git a/orchestra/apps/webapps/models.py b/orchestra/contrib/webapps/models.py similarity index 94% rename from orchestra/apps/webapps/models.py rename to orchestra/contrib/webapps/models.py index 3c471485..a72da587 100644 --- a/orchestra/apps/webapps/models.py +++ b/orchestra/contrib/webapps/models.py @@ -19,12 +19,11 @@ from .types import AppType class WebApp(models.Model): """ Represents a web application """ name = models.CharField(_("name"), max_length=128, validators=[validators.validate_name]) - type = models.CharField(_("type"), max_length=32, - choices=AppType.get_choices()) + type = models.CharField(_("type"), max_length=32, choices=AppType.get_choices()) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='webapps') + related_name='webapps') data = JSONField(_("data"), blank=True, default={}, - help_text=_("Extra information dependent of each service.")) + help_text=_("Extra information dependent of each service.")) # CMS webapps usually need a database and dbuser, with these virtual fields we tell the ORM to delete them databases = VirtualDatabaseRelation('databases.Database') @@ -87,7 +86,7 @@ class WebApp(models.Model): class WebAppOption(models.Model): webapp = models.ForeignKey(WebApp, verbose_name=_("Web application"), - related_name='options') + related_name='options') name = models.CharField(_("name"), max_length=128, choices=AppType.get_options_choices()) value = models.CharField(_("value"), max_length=256) diff --git a/orchestra/apps/webapps/options.py b/orchestra/contrib/webapps/options.py similarity index 100% rename from orchestra/apps/webapps/options.py rename to orchestra/contrib/webapps/options.py diff --git a/orchestra/apps/webapps/serializers.py b/orchestra/contrib/webapps/serializers.py similarity index 84% rename from orchestra/apps/webapps/serializers.py rename to orchestra/contrib/webapps/serializers.py index c8d293b8..60e2aef6 100644 --- a/orchestra/apps/webapps/serializers.py +++ b/orchestra/contrib/webapps/serializers.py @@ -1,6 +1,6 @@ from orchestra.api.fields import OptionField from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .models import WebApp diff --git a/orchestra/apps/webapps/settings.py b/orchestra/contrib/webapps/settings.py similarity index 58% rename from orchestra/apps/webapps/settings.py rename to orchestra/contrib/webapps/settings.py index 01695fac..97b7d792 100644 --- a/orchestra/apps/webapps/settings.py +++ b/orchestra/contrib/webapps/settings.py @@ -48,11 +48,11 @@ WEBAPPS_MERGE_PHP_WEBAPPS = getattr(settings, 'WEBAPPS_MERGE_PHP_WEBAPPS', WEBAPPS_TYPES = getattr(settings, 'WEBAPPS_TYPES', ( - 'orchestra.apps.webapps.types.php.PHPApp', - 'orchestra.apps.webapps.types.misc.StaticApp', - 'orchestra.apps.webapps.types.misc.WebalizerApp', - 'orchestra.apps.webapps.types.misc.SymbolicLinkApp', - 'orchestra.apps.webapps.types.wordpress.WordPressApp', + 'orchestra.contrib.webapps.types.php.PHPApp', + 'orchestra.contrib.webapps.types.misc.StaticApp', + 'orchestra.contrib.webapps.types.misc.WebalizerApp', + 'orchestra.contrib.webapps.types.misc.SymbolicLinkApp', + 'orchestra.contrib.webapps.types.wordpress.WordPressApp', )) @@ -130,41 +130,41 @@ WEBAPPS_PHP_DISABLED_FUNCTIONS = getattr(settings, 'WEBAPPS_PHP_DISABLED_FUNCTIO WEBAPPS_ENABLED_OPTIONS = getattr(settings, 'WEBAPPS_ENABLED_OPTIONS', ( - 'orchestra.apps.webapps.options.PublicRoot', - 'orchestra.apps.webapps.options.Timeout', - 'orchestra.apps.webapps.options.Processes', - 'orchestra.apps.webapps.options.PHPEnabledFunctions', - 'orchestra.apps.webapps.options.PHPAllowURLInclude', - 'orchestra.apps.webapps.options.PHPAllowURLFopen', - 'orchestra.apps.webapps.options.PHPAutoAppendFile', - 'orchestra.apps.webapps.options.PHPAutoPrependFile', - 'orchestra.apps.webapps.options.PHPDateTimeZone', - 'orchestra.apps.webapps.options.PHPDefaultSocketTimeout', - 'orchestra.apps.webapps.options.PHPDisplayErrors', - 'orchestra.apps.webapps.options.PHPExtension', - 'orchestra.apps.webapps.options.PHPMagicQuotesGPC', - 'orchestra.apps.webapps.options.PHPMagicQuotesRuntime', - 'orchestra.apps.webapps.options.PHPMaginQuotesSybase', - 'orchestra.apps.webapps.options.PHPMaxExecutonTime', - 'orchestra.apps.webapps.options.PHPMaxInputTime', - 'orchestra.apps.webapps.options.PHPMaxInputVars', - 'orchestra.apps.webapps.options.PHPMemoryLimit', - 'orchestra.apps.webapps.options.PHPMySQLConnectTimeout', - 'orchestra.apps.webapps.options.PHPOutputBuffering', - 'orchestra.apps.webapps.options.PHPRegisterGlobals', - 'orchestra.apps.webapps.options.PHPPostMaxSize', - 'orchestra.apps.webapps.options.PHPSendmailPath', - 'orchestra.apps.webapps.options.PHPSessionBugCompatWarn', - 'orchestra.apps.webapps.options.PHPSessionAutoStart', - 'orchestra.apps.webapps.options.PHPSafeMode', - 'orchestra.apps.webapps.options.PHPSuhosinPostMaxVars', - 'orchestra.apps.webapps.options.PHPSuhosinGetMaxVars', - 'orchestra.apps.webapps.options.PHPSuhosinRequestMaxVars', - 'orchestra.apps.webapps.options.PHPSuhosinSessionEncrypt', - 'orchestra.apps.webapps.options.PHPSuhosinSimulation', - 'orchestra.apps.webapps.options.PHPSuhosinExecutorIncludeWhitelist', - 'orchestra.apps.webapps.options.PHPUploadMaxFileSize', - 'orchestra.apps.webapps.options.PHPZendExtension', + 'orchestra.contrib.webapps.options.PublicRoot', + 'orchestra.contrib.webapps.options.Timeout', + 'orchestra.contrib.webapps.options.Processes', + 'orchestra.contrib.webapps.options.PHPEnabledFunctions', + 'orchestra.contrib.webapps.options.PHPAllowURLInclude', + 'orchestra.contrib.webapps.options.PHPAllowURLFopen', + 'orchestra.contrib.webapps.options.PHPAutoAppendFile', + 'orchestra.contrib.webapps.options.PHPAutoPrependFile', + 'orchestra.contrib.webapps.options.PHPDateTimeZone', + 'orchestra.contrib.webapps.options.PHPDefaultSocketTimeout', + 'orchestra.contrib.webapps.options.PHPDisplayErrors', + 'orchestra.contrib.webapps.options.PHPExtension', + 'orchestra.contrib.webapps.options.PHPMagicQuotesGPC', + 'orchestra.contrib.webapps.options.PHPMagicQuotesRuntime', + 'orchestra.contrib.webapps.options.PHPMaginQuotesSybase', + 'orchestra.contrib.webapps.options.PHPMaxExecutonTime', + 'orchestra.contrib.webapps.options.PHPMaxInputTime', + 'orchestra.contrib.webapps.options.PHPMaxInputVars', + 'orchestra.contrib.webapps.options.PHPMemoryLimit', + 'orchestra.contrib.webapps.options.PHPMySQLConnectTimeout', + 'orchestra.contrib.webapps.options.PHPOutputBuffering', + 'orchestra.contrib.webapps.options.PHPRegisterGlobals', + 'orchestra.contrib.webapps.options.PHPPostMaxSize', + 'orchestra.contrib.webapps.options.PHPSendmailPath', + 'orchestra.contrib.webapps.options.PHPSessionBugCompatWarn', + 'orchestra.contrib.webapps.options.PHPSessionAutoStart', + 'orchestra.contrib.webapps.options.PHPSafeMode', + 'orchestra.contrib.webapps.options.PHPSuhosinPostMaxVars', + 'orchestra.contrib.webapps.options.PHPSuhosinGetMaxVars', + 'orchestra.contrib.webapps.options.PHPSuhosinRequestMaxVars', + 'orchestra.contrib.webapps.options.PHPSuhosinSessionEncrypt', + 'orchestra.contrib.webapps.options.PHPSuhosinSimulation', + 'orchestra.contrib.webapps.options.PHPSuhosinExecutorIncludeWhitelist', + 'orchestra.contrib.webapps.options.PHPUploadMaxFileSize', + 'orchestra.contrib.webapps.options.PHPZendExtension', )) diff --git a/orchestra/apps/webapps/tests/__init__.py b/orchestra/contrib/webapps/tests/__init__.py similarity index 100% rename from orchestra/apps/webapps/tests/__init__.py rename to orchestra/contrib/webapps/tests/__init__.py diff --git a/orchestra/apps/webapps/tests/functional_tests/__init__.py b/orchestra/contrib/webapps/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/webapps/tests/functional_tests/__init__.py rename to orchestra/contrib/webapps/tests/functional_tests/__init__.py diff --git a/orchestra/apps/webapps/tests/functional_tests/tests.py b/orchestra/contrib/webapps/tests/functional_tests/tests.py similarity index 93% rename from orchestra/apps/webapps/tests/functional_tests/tests.py rename to orchestra/contrib/webapps/tests/functional_tests/tests.py index 8a1ba9fc..0574ae4c 100644 --- a/orchestra/apps/webapps/tests/functional_tests/tests.py +++ b/orchestra/contrib/webapps/tests/functional_tests/tests.py @@ -4,8 +4,8 @@ from io import StringIO from django.conf import settings as djsettings -from orchestra.apps.orchestration.models import Server, Route -from orchestra.apps.systemusers.backends import SystemUserBackend +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.contrib.systemusers.backends import SystemUserBackend from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, snapshot_on_error, save_response_on_error from ... import backends @@ -14,9 +14,9 @@ from ... import backends class WebAppMixin(object): MASTER_SERVER = os.environ.get('ORCHESTRA_MASTER_SERVER', 'localhost') DEPENDENCIES = ( - 'orchestra.apps.orchestration', - 'orchestra.apps.systemusers', - 'orchestra.apps.webapps', + 'orchestra.contrib.orchestration', + 'orchestra.contrib.systemusers', + 'orchestra.contrib.webapps', ) def setUp(self): diff --git a/orchestra/apps/webapps/types/__init__.py b/orchestra/contrib/webapps/types/__init__.py similarity index 100% rename from orchestra/apps/webapps/types/__init__.py rename to orchestra/contrib/webapps/types/__init__.py diff --git a/orchestra/apps/webapps/types/cms.py b/orchestra/contrib/webapps/types/cms.py similarity index 98% rename from orchestra/apps/webapps/types/cms.py rename to orchestra/contrib/webapps/types/cms.py index 2ababf3c..1a095da8 100644 --- a/orchestra/apps/webapps/types/cms.py +++ b/orchestra/contrib/webapps/types/cms.py @@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ from rest_framework import serializers -from orchestra.apps.databases.models import Database, DatabaseUser +from orchestra.contrib.databases.models import Database, DatabaseUser from orchestra.forms import widgets from orchestra.utils.python import random_ascii diff --git a/orchestra/apps/webapps/types/misc.py b/orchestra/contrib/webapps/types/misc.py similarity index 100% rename from orchestra/apps/webapps/types/misc.py rename to orchestra/contrib/webapps/types/misc.py diff --git a/orchestra/apps/webapps/types/php.py b/orchestra/contrib/webapps/types/php.py similarity index 100% rename from orchestra/apps/webapps/types/php.py rename to orchestra/contrib/webapps/types/php.py diff --git a/orchestra/apps/webapps/types/wordpress.py b/orchestra/contrib/webapps/types/wordpress.py similarity index 100% rename from orchestra/apps/webapps/types/wordpress.py rename to orchestra/contrib/webapps/types/wordpress.py diff --git a/orchestra/apps/websites/__init__.py b/orchestra/contrib/websites/__init__.py similarity index 100% rename from orchestra/apps/websites/__init__.py rename to orchestra/contrib/websites/__init__.py diff --git a/orchestra/apps/websites/admin.py b/orchestra/contrib/websites/admin.py similarity index 98% rename from orchestra/apps/websites/admin.py rename to orchestra/contrib/websites/admin.py index dbfc1730..0633d7fb 100644 --- a/orchestra/apps/websites/admin.py +++ b/orchestra/contrib/websites/admin.py @@ -8,7 +8,7 @@ from django.utils.translation import ugettext_lazy as _ from orchestra.admin import ExtendedModelAdmin from orchestra.admin.utils import admin_link, change_url -from orchestra.apps.accounts.admin import AccountAdminMixin, SelectAccountAdminMixin +from orchestra.contrib.accounts.admin import AccountAdminMixin, SelectAccountAdminMixin from orchestra.forms.widgets import DynamicHelpTextSelect from .directives import SiteDirective diff --git a/orchestra/apps/websites/api.py b/orchestra/contrib/websites/api.py similarity index 91% rename from orchestra/apps/websites/api.py rename to orchestra/contrib/websites/api.py index f419e38f..044836ae 100644 --- a/orchestra/apps/websites/api.py +++ b/orchestra/contrib/websites/api.py @@ -1,7 +1,7 @@ from rest_framework import viewsets from orchestra.api import router -from orchestra.apps.accounts.api import AccountApiMixin +from orchestra.contrib.accounts.api import AccountApiMixin from . import settings from .models import Website diff --git a/orchestra/apps/websites/apps.py b/orchestra/contrib/websites/apps.py similarity index 93% rename from orchestra/apps/websites/apps.py rename to orchestra/contrib/websites/apps.py index a803a7f4..33a54ef4 100644 --- a/orchestra/apps/websites/apps.py +++ b/orchestra/contrib/websites/apps.py @@ -6,7 +6,7 @@ from orchestra.utils import database_ready class WebsiteConfig(AppConfig): - name = 'orchestra.apps.websites' + name = 'orchestra.contrib.websites' def ready(self): if database_ready(): diff --git a/orchestra/apps/websites/backends/__init__.py b/orchestra/contrib/websites/backends/__init__.py similarity index 100% rename from orchestra/apps/websites/backends/__init__.py rename to orchestra/contrib/websites/backends/__init__.py diff --git a/orchestra/apps/websites/backends/apache.py b/orchestra/contrib/websites/backends/apache.py similarity index 99% rename from orchestra/apps/websites/backends/apache.py rename to orchestra/contrib/websites/backends/apache.py index 46e7b1b2..4186967e 100644 --- a/orchestra/apps/websites/backends/apache.py +++ b/orchestra/contrib/websites/backends/apache.py @@ -5,8 +5,8 @@ import textwrap from django.template import Template, Context from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController -from orchestra.apps.resources import ServiceMonitor +from orchestra.contrib.orchestration import ServiceController +from orchestra.contrib.resources import ServiceMonitor from .. import settings from ..utils import normurlpath diff --git a/orchestra/apps/websites/backends/webalizer.py b/orchestra/contrib/websites/backends/webalizer.py similarity index 98% rename from orchestra/apps/websites/backends/webalizer.py rename to orchestra/contrib/websites/backends/webalizer.py index f447930d..bfb196a5 100644 --- a/orchestra/apps/websites/backends/webalizer.py +++ b/orchestra/contrib/websites/backends/webalizer.py @@ -3,7 +3,7 @@ import textwrap from django.utils.translation import ugettext_lazy as _ -from orchestra.apps.orchestration import ServiceController +from orchestra.contrib.orchestration import ServiceController from .. import settings diff --git a/orchestra/apps/websites/directives.py b/orchestra/contrib/websites/directives.py similarity index 100% rename from orchestra/apps/websites/directives.py rename to orchestra/contrib/websites/directives.py diff --git a/orchestra/apps/websites/forms.py b/orchestra/contrib/websites/forms.py similarity index 100% rename from orchestra/apps/websites/forms.py rename to orchestra/contrib/websites/forms.py diff --git a/orchestra/apps/websites/models.py b/orchestra/contrib/websites/models.py similarity index 89% rename from orchestra/apps/websites/models.py rename to orchestra/contrib/websites/models.py index 06e6d35e..407bbbb2 100644 --- a/orchestra/apps/websites/models.py +++ b/orchestra/contrib/websites/models.py @@ -19,19 +19,19 @@ class Website(models.Model): HTTPS_ONLY = 'https-only' name = models.CharField(_("name"), max_length=128, - validators=[validators.validate_name]) + validators=[validators.validate_name]) account = models.ForeignKey('accounts.Account', verbose_name=_("Account"), - related_name='websites') + related_name='websites') protocol = models.CharField(_("protocol"), max_length=16, - choices=settings.WEBSITES_PROTOCOL_CHOICES, - default=settings.WEBSITES_DEFAULT_PROTOCOL, - help_text=_("Select the protocol(s) for this website
" - "HTTPS only performs a redirection from http to https.")) + choices=settings.WEBSITES_PROTOCOL_CHOICES, + default=settings.WEBSITES_DEFAULT_PROTOCOL, + help_text=_("Select the protocol(s) for this website
" + "HTTPS only performs a redirection from http to https.")) # port = models.PositiveIntegerField(_("port"), # choices=settings.WEBSITES_PORT_CHOICES, # default=settings.WEBSITES_DEFAULT_PORT) domains = models.ManyToManyField(settings.WEBSITES_DOMAIN_MODEL, - related_name='websites', verbose_name=_("domains")) + related_name='websites', verbose_name=_("domains")) contents = models.ManyToManyField('webapps.WebApp', through='websites.Content') is_active = models.BooleanField(_("active"), default=True) @@ -126,7 +126,7 @@ class Content(models.Model): webapp = models.ForeignKey('webapps.WebApp', verbose_name=_("web application")) website = models.ForeignKey('websites.Website', verbose_name=_("web site")) path = models.CharField(_("path"), max_length=256, blank=True, - validators=[validators.validate_url_path]) + validators=[validators.validate_url_path]) class Meta: unique_together = ('website', 'path') diff --git a/orchestra/apps/websites/serializers.py b/orchestra/contrib/websites/serializers.py similarity index 96% rename from orchestra/apps/websites/serializers.py rename to orchestra/contrib/websites/serializers.py index c98dbf68..6fdc42c9 100644 --- a/orchestra/apps/websites/serializers.py +++ b/orchestra/contrib/websites/serializers.py @@ -4,7 +4,7 @@ from rest_framework import serializers from orchestra.api.fields import OptionField from orchestra.api.serializers import HyperlinkedModelSerializer -from orchestra.apps.accounts.serializers import AccountSerializerMixin +from orchestra.contrib.accounts.serializers import AccountSerializerMixin from .models import Website, Content from .validators import validate_domain_protocol diff --git a/orchestra/apps/websites/settings.py b/orchestra/contrib/websites/settings.py similarity index 80% rename from orchestra/apps/websites/settings.py rename to orchestra/contrib/websites/settings.py index e9d3fe91..45b3646c 100644 --- a/orchestra/apps/websites/settings.py +++ b/orchestra/contrib/websites/settings.py @@ -37,17 +37,17 @@ WEBSITES_DOMAIN_MODEL = getattr(settings, 'WEBSITES_DOMAIN_MODEL', WEBSITES_ENABLED_DIRECTIVES = getattr(settings, 'WEBSITES_ENABLED_DIRECTIVES', ( - 'orchestra.apps.websites.directives.Redirect', - 'orchestra.apps.websites.directives.Proxy', - 'orchestra.apps.websites.directives.ErrorDocument', - 'orchestra.apps.websites.directives.SSLCA', - 'orchestra.apps.websites.directives.SSLCert', - 'orchestra.apps.websites.directives.SSLKey', - 'orchestra.apps.websites.directives.SecRuleRemove', - 'orchestra.apps.websites.directives.SecEngine', - 'orchestra.apps.websites.directives.WordPressSaaS', - 'orchestra.apps.websites.directives.DokuWikiSaaS', - 'orchestra.apps.websites.directives.DrupalSaaS', + 'orchestra.contrib.websites.directives.Redirect', + 'orchestra.contrib.websites.directives.Proxy', + 'orchestra.contrib.websites.directives.ErrorDocument', + 'orchestra.contrib.websites.directives.SSLCA', + 'orchestra.contrib.websites.directives.SSLCert', + 'orchestra.contrib.websites.directives.SSLKey', + 'orchestra.contrib.websites.directives.SecRuleRemove', + 'orchestra.contrib.websites.directives.SecEngine', + 'orchestra.contrib.websites.directives.WordPressSaaS', + 'orchestra.contrib.websites.directives.DokuWikiSaaS', + 'orchestra.contrib.websites.directives.DrupalSaaS', )) diff --git a/orchestra/apps/websites/tests/__init__.py b/orchestra/contrib/websites/tests/__init__.py similarity index 100% rename from orchestra/apps/websites/tests/__init__.py rename to orchestra/contrib/websites/tests/__init__.py diff --git a/orchestra/apps/websites/tests/functional_tests/__init__.py b/orchestra/contrib/websites/tests/functional_tests/__init__.py similarity index 100% rename from orchestra/apps/websites/tests/functional_tests/__init__.py rename to orchestra/contrib/websites/tests/functional_tests/__init__.py diff --git a/orchestra/apps/websites/tests/functional_tests/tests.py b/orchestra/contrib/websites/tests/functional_tests/tests.py similarity index 90% rename from orchestra/apps/websites/tests/functional_tests/tests.py rename to orchestra/contrib/websites/tests/functional_tests/tests.py index a31de4e4..9fd69da6 100644 --- a/orchestra/apps/websites/tests/functional_tests/tests.py +++ b/orchestra/contrib/websites/tests/functional_tests/tests.py @@ -3,10 +3,10 @@ import socket import requests -from orchestra.apps.domains.models import Domain, Record -from orchestra.apps.domains.backends import Bind9MasterDomainBackend -from orchestra.apps.orchestration.models import Server, Route -from orchestra.apps.webapps.tests.functional_tests.tests import StaticWebAppMixin, RESTWebAppMixin, WebAppMixin, PHPFcidWebAppMixin, PHPFPMWebAppMixin +from orchestra.contrib.domains.models import Domain, Record +from orchestra.contrib.domains.backends import Bind9MasterDomainBackend +from orchestra.contrib.orchestration.models import Server, Route +from orchestra.contrib.webapps.tests.functional_tests.tests import StaticWebAppMixin, RESTWebAppMixin, WebAppMixin, PHPFcidWebAppMixin, PHPFPMWebAppMixin from orchestra.utils.tests import BaseLiveServerTestCase, random_ascii, save_response_on_error from ... import backends @@ -16,11 +16,11 @@ class WebsiteMixin(WebAppMixin): MASTER_SERVER = os.environ.get('ORCHESTRA_MASTER_SERVER', 'localhost') MASTER_SERVER_ADDR = socket.gethostbyname(MASTER_SERVER) DEPENDENCIES = ( - 'orchestra.apps.orchestration', - 'orchestra.apps.domains', - 'orchestra.apps.websites', - 'orchestra.apps.webapps', - 'orchestra.apps.systemusers', + 'orchestra.contrib.orchestration', + 'orchestra.contrib.domains', + 'orchestra.contrib.websites', + 'orchestra.contrib.webapps', + 'orchestra.contrib.systemusers', ) def add_route(self): diff --git a/orchestra/apps/websites/utils.py b/orchestra/contrib/websites/utils.py similarity index 100% rename from orchestra/apps/websites/utils.py rename to orchestra/contrib/websites/utils.py diff --git a/orchestra/apps/websites/validators.py b/orchestra/contrib/websites/validators.py similarity index 100% rename from orchestra/apps/websites/validators.py rename to orchestra/contrib/websites/validators.py diff --git a/orchestra/management/commands/postupgradeorchestra.py b/orchestra/management/commands/postupgradeorchestra.py index e5105d9c..1bade75c 100644 --- a/orchestra/management/commands/postupgradeorchestra.py +++ b/orchestra/management/commands/postupgradeorchestra.py @@ -5,7 +5,7 @@ from optparse import make_option from django.core.management.base import BaseCommand from orchestra.utils.paths import get_site_dir -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root def deprecate_periodic_tasks(names): diff --git a/orchestra/management/commands/setupcelery.py b/orchestra/management/commands/setupcelery.py index 33a284d5..db9f6d27 100644 --- a/orchestra/management/commands/setupcelery.py +++ b/orchestra/management/commands/setupcelery.py @@ -5,7 +5,7 @@ from os import path from django.core.management.base import BaseCommand from orchestra.utils.paths import get_site_dir, get_orchestra_dir -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root class Command(BaseCommand): diff --git a/orchestra/management/commands/setupnginx.py b/orchestra/management/commands/setupnginx.py index 3264c6c8..879c3cad 100644 --- a/orchestra/management/commands/setupnginx.py +++ b/orchestra/management/commands/setupnginx.py @@ -3,10 +3,9 @@ from os.path import expanduser from django.conf import settings from django.core.management.base import BaseCommand -from django.utils.six.moves import input from orchestra.utils.paths import get_project_dir, get_site_dir, get_project_name -from orchestra.utils.system import run, check_root, get_default_celeryd_username +from orchestra.utils.sys import run, check_root, get_default_celeryd_username class Command(BaseCommand): diff --git a/orchestra/management/commands/setuppostfix.py b/orchestra/management/commands/setuppostfix.py index bf159bba..7dd116b9 100644 --- a/orchestra/management/commands/setuppostfix.py +++ b/orchestra/management/commands/setuppostfix.py @@ -4,7 +4,7 @@ from optparse import make_option from django.core.management.base import BaseCommand -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root class Command(BaseCommand): def __init__(self, *args, **kwargs): diff --git a/orchestra/management/commands/setuppostgres.py b/orchestra/management/commands/setuppostgres.py index 35d0ab89..38524777 100644 --- a/orchestra/management/commands/setuppostgres.py +++ b/orchestra/management/commands/setuppostgres.py @@ -4,7 +4,7 @@ from optparse import make_option from django.core.management.base import BaseCommand from orchestra.utils.paths import get_project_dir -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root class Command(BaseCommand): diff --git a/orchestra/management/commands/startservices.py b/orchestra/management/commands/startservices.py index f06fb26f..5bb6f811 100644 --- a/orchestra/management/commands/startservices.py +++ b/orchestra/management/commands/startservices.py @@ -3,7 +3,7 @@ from optparse import make_option from django.core.management.base import BaseCommand from orchestra.settings import START_SERVICES -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root def run_tuple(services, action, options, optional=False): diff --git a/orchestra/management/commands/staticcheck.py b/orchestra/management/commands/staticcheck.py index 5f75c37b..208e3c5b 100644 --- a/orchestra/management/commands/staticcheck.py +++ b/orchestra/management/commands/staticcheck.py @@ -1,7 +1,7 @@ from django.core.management.base import BaseCommand from orchestra.utils.paths import get_orchestra_dir, get_site_dir -from orchestra.utils.system import run +from orchestra.utils.sys import run class Command(BaseCommand): diff --git a/orchestra/management/commands/upgradeorchestra.py b/orchestra/management/commands/upgradeorchestra.py index eafcfa49..ecd8ec23 100644 --- a/orchestra/management/commands/upgradeorchestra.py +++ b/orchestra/management/commands/upgradeorchestra.py @@ -9,7 +9,7 @@ from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from orchestra import get_version -from orchestra.utils.system import run, check_root +from orchestra.utils.sys import run, check_root r = functools.partial(run, silent=False) diff --git a/orchestra/utils/html.py b/orchestra/utils/html.py index 84079237..356397c0 100644 --- a/orchestra/utils/html.py +++ b/orchestra/utils/html.py @@ -1,4 +1,4 @@ -from orchestra.utils.system import run +from orchestra.utils.sys import run def html_to_pdf(html): diff --git a/orchestra/utils/system.py b/orchestra/utils/sys.py similarity index 100% rename from orchestra/utils/system.py rename to orchestra/utils/sys.py diff --git a/orchestra/utils/tests.py b/orchestra/utils/tests.py index 0811e47b..75a73d46 100644 --- a/orchestra/utils/tests.py +++ b/orchestra/utils/tests.py @@ -11,7 +11,7 @@ from orm.api import Api from selenium.webdriver.firefox.webdriver import WebDriver from xvfbwrapper import Xvfb -from orchestra.apps.accounts.models import Account +from orchestra.contrib.accounts.models import Account from .python import random_ascii @@ -24,7 +24,7 @@ class AppDependencyMixin(object): current_app = cls.__module__.split('.tests.')[0] INSTALLED_APPS = ( 'orchestra', - 'orchestra.apps.accounts', + 'orchestra.contrib.accounts', current_app ) INSTALLED_APPS += cls.DEPENDENCIES