From dee8aa71a4a4b624f2bc6470606781666064039b Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Sat, 6 Feb 2016 20:48:17 +0100 Subject: [PATCH] Replace internal gvacommon copy with external requirement --- gvafile/gvacommon/.gitignore | 3 --- gvafile/gvacommon/__init__.py | 0 gvafile/gvacommon/celeryrouters.py | 15 ----------- gvafile/gvacommon/viewmixins.py | 42 ------------------------------ requirements/base.txt | 1 + 5 files changed, 1 insertion(+), 60 deletions(-) delete mode 100644 gvafile/gvacommon/.gitignore delete mode 100644 gvafile/gvacommon/__init__.py delete mode 100644 gvafile/gvacommon/celeryrouters.py delete mode 100644 gvafile/gvacommon/viewmixins.py diff --git a/gvafile/gvacommon/.gitignore b/gvafile/gvacommon/.gitignore deleted file mode 100644 index 5f1ace6..0000000 --- a/gvafile/gvacommon/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.*.swp -*.pyc -.ropeproject/ diff --git a/gvafile/gvacommon/__init__.py b/gvafile/gvacommon/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gvafile/gvacommon/celeryrouters.py b/gvafile/gvacommon/celeryrouters.py deleted file mode 100644 index 44c4b4f..0000000 --- a/gvafile/gvacommon/celeryrouters.py +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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: - return { - 'exchange': route, - 'exchange_type': 'direct', - 'queue': route, - } - return None diff --git a/gvafile/gvacommon/viewmixins.py b/gvafile/gvacommon/viewmixins.py deleted file mode 100644 index fc7f106..0000000 --- a/gvafile/gvacommon/viewmixins.py +++ /dev/null @@ -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") diff --git a/requirements/base.txt b/requirements/base.txt index d83710b..7cef374 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -8,3 +8,4 @@ kombu==3.0.24 pytz==2014.10 wsgiref==0.1.2 PyYAML==3.11 +-e git+https://git.gnuviech-server.de/gvacommon.git@0.3.0#egg=gvacommon