Reformat code with PyCharm

This commit is contained in:
Jan Dittberner 2016-09-25 13:02:36 +02:00
parent d8764dd8bc
commit 321edba5f7
7 changed files with 10 additions and 13 deletions

View file

@ -15,4 +15,4 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
__version__ = '0.3.0' __version__ = '0.3.1'

View file

@ -19,7 +19,6 @@ from __future__ import unicode_literals
class GvaRouter(object): class GvaRouter(object):
def route_for_task(self, task, args=None, kwargs=None): def route_for_task(self, task, args=None, kwargs=None):
for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']: for route in ['ldap', 'file', 'mysql', 'pgsql', 'web']:
if route in task: if route in task:

View file

@ -16,10 +16,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
from os import environ
# Normally you should not import ANYTHING from Django directly
# into your settings, but ImproperlyConfigured is an exception.
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from os import environ
def get_env_variable(var_name): def get_env_variable(var_name):

View file

@ -20,13 +20,13 @@ Tests for gvacommon celery router code.
""" """
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import unittest import unittest
from gvacommon.celeryrouters import GvaRouter from gvacommon.celeryrouters import GvaRouter
class GvaRouteTest(unittest.TestCase): class GvaRouteTest(unittest.TestCase):
def test_route_for_task_ldap(self): def test_route_for_task_ldap(self):
router = GvaRouter() router = GvaRouter()
route = router.route_for_task('ldap') route = router.route_for_task('ldap')

View file

@ -16,16 +16,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
import os from __future__ import absolute_import, unicode_literals
from unittest import TestCase from unittest import TestCase
import os
from django.core.exceptions import ImproperlyConfigured from django.core.exceptions import ImproperlyConfigured
from gvacommon.settings_utils import get_env_variable from gvacommon.settings_utils import get_env_variable
class GetEnvVariableTest(TestCase): class GetEnvVariableTest(TestCase):
def test_get_existing_env_variable(self): def test_get_existing_env_variable(self):
os.environ['testvariable'] = 'myvalue' os.environ['testvariable'] = 'myvalue'
self.assertEqual(get_env_variable('testvariable'), 'myvalue') self.assertEqual(get_env_variable('testvariable'), 'myvalue')
@ -37,4 +38,3 @@ class GetEnvVariableTest(TestCase):
get_env_variable('missingvariable') get_env_variable('missingvariable')
self.assertEqual( self.assertEqual(
str(e.exception), 'Set the missingvariable environment variable') str(e.exception), 'Set the missingvariable environment variable')

View file

@ -20,6 +20,7 @@ Tests for gvacommon code.
""" """
from __future__ import absolute_import, unicode_literals from __future__ import absolute_import, unicode_literals
import unittest import unittest
try: try:
@ -73,7 +74,6 @@ class StaffOrSelfLoginRequiredMixinTest(unittest.TestCase):
from gvacommon.viewmixins import StaffOrSelfLoginRequiredMixin from gvacommon.viewmixins import StaffOrSelfLoginRequiredMixin
class SubjectView(StaffOrSelfLoginRequiredMixin, View): class SubjectView(StaffOrSelfLoginRequiredMixin, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
return "success" return "success"

View file

@ -21,9 +21,9 @@ This module defines mixins for gnuviechadmin views.
""" """
from __future__ import unicode_literals from __future__ import unicode_literals
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.contrib.auth.mixins import LoginRequiredMixin
class StaffOrSelfLoginRequiredMixin(LoginRequiredMixin): class StaffOrSelfLoginRequiredMixin(LoginRequiredMixin):