Moved apps to contrib

This commit is contained in:
Marc Aymerich 2015-04-05 10:46:24 +00:00
parent 1ff4e05819
commit 10d2f7f247
307 changed files with 553 additions and 568 deletions

14
TODO.md
View File

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

View File

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

View File

@ -1,4 +0,0 @@
from .backends import ServiceMonitor
default_app_config = 'orchestra.apps.resources.apps.ResourcesConfig'

View File

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

View File

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

View File

@ -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
@ -17,8 +17,9 @@ 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')])
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)
short_name = models.CharField(_("short name"), max_length=64, blank=True)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -49,8 +49,10 @@ class Contact(models.Model):
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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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',
)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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
@ -183,8 +183,7 @@ 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')

View File

Before

Width:  |  Height:  |  Size: 204 B

After

Width:  |  Height:  |  Size: 204 B

View File

Before

Width:  |  Height:  |  Size: 260 B

After

Width:  |  Height:  |  Size: 260 B

View File

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

View File

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

View File

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

View File

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

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