Restructure gvaweb to correct package paths
This commit is contained in:
parent
63e065b8c0
commit
0eb766051c
10 changed files with 3 additions and 54 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -43,3 +43,4 @@ _build/
|
|||
*.sqlite3
|
||||
.idea/
|
||||
.vagrant/
|
||||
.env
|
||||
|
|
|
@ -30,7 +30,6 @@ into the gvaweb directory and run the celery worker with:
|
|||
|
||||
.. code-block:: sh
|
||||
|
||||
$ cd gvaweb
|
||||
$ pipenv run celery -A gvaweb worker -Q web -l info
|
||||
|
||||
.. _Celery: http://www.celeryproject.org/
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
class GvaRouter(object):
|
||||
|
||||
def route_for_task(self, task, args=None, kwargs=None):
|
||||
for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']:
|
||||
if route in task:
|
|
@ -4,12 +4,10 @@ This module defines the Celery_ app for gvaweb.
|
|||
.. _Celery: http://www.celeryproject.org/
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from celery import Celery
|
||||
|
||||
#: The Celery application
|
||||
app = Celery('gvaweb')
|
||||
|
||||
app.config_from_object('gvaweb.settings')
|
||||
app.autodiscover_tasks(['webtasks'], force=True)
|
||||
app.autodiscover_tasks(['gvaweb.webtasks'], force=True)
|
|
@ -1,42 +0,0 @@
|
|||
"""
|
||||
This module defines mixins for gnuviechadmin views.
|
||||
|
||||
"""
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.http import HttpResponseForbidden
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
from braces.views import LoginRequiredMixin
|
||||
|
||||
|
||||
class StaffOrSelfLoginRequiredMixin(LoginRequiredMixin):
|
||||
"""
|
||||
Mixin that makes sure that a user is logged in and matches the current
|
||||
customer or is a staff user.
|
||||
|
||||
"""
|
||||
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
if (
|
||||
request.user.is_staff or
|
||||
request.user == self.get_customer_object()
|
||||
):
|
||||
return super(StaffOrSelfLoginRequiredMixin, self).dispatch(
|
||||
request, *args, **kwargs
|
||||
)
|
||||
return HttpResponseForbidden(
|
||||
_('You are not allowed to view this page.')
|
||||
)
|
||||
|
||||
def get_customer_object(self):
|
||||
"""
|
||||
Views based on this mixin have to implement this method to return
|
||||
the customer that must be an object of the same class as the
|
||||
django.contrib.auth user type.
|
||||
|
||||
:return: customer
|
||||
:rtype: settings.AUTH_USER_MODEL
|
||||
|
||||
"""
|
||||
raise NotImplemented("subclass has to implement get_customer_object")
|
|
@ -42,6 +42,5 @@ BROKER_URL = get_env_setting('GVAWEB_BROKER_URL')
|
|||
########## GVAWEB CONFIGURATION
|
||||
GVAWEB_NGINX_SITES_AVAILABLE = get_env_setting('GVAWEB_NGINX_SITES_AVAILABLE')
|
||||
GVAWEB_NGINX_SITES_ENABLED = get_env_setting('GVAWEB_NGINX_SITES_ENABLED')
|
||||
GVAWEB_PHPFPM_POOL = get_env_setting('GVAWEB_PHPFPM_POOL')
|
||||
GVAWEB_WWWUSER_MOUNT = get_env_setting('GVAWEB_WWWUSER_MOUNT')
|
||||
########## END GVAWEB CONFIGURATION
|
|
@ -2,8 +2,6 @@
|
|||
This module defines Celery_ tasks to manage website configurations.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
from tempfile import mkstemp
|
||||
|
@ -24,7 +22,7 @@ LN_CMD = '/bin/ln'
|
|||
SERVICE_CMD = '/bin/systemctl'
|
||||
INSTALL_CMD = '/usr/bin/install'
|
||||
|
||||
JINJAENV = Environment(loader=PackageLoader('webtasks', 'templates'))
|
||||
JINJAENV = Environment(loader=PackageLoader('gvaweb.webtasks', 'templates'))
|
||||
|
||||
|
||||
def _jinja_parentdomain(domain):
|
||||
|
|
Loading…
Reference in a new issue