Skip to content

Commit

Permalink
Flake8 compliance + Black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Badatos committed Jan 9, 2025
1 parent c80323a commit 06301b5
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 9 deletions.
6 changes: 4 additions & 2 deletions pod/authentication/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,13 @@ def ready(self) -> None:
post_migrate.connect(set_default_site, sender=self)

from django.conf import settings

USE_CAS = getattr(settings, "USE_CAS", False)
if USE_CAS:
from pod.authentication.backends import pod_affiliation_handler

# Append the custom handler to the CAS_AFFILIATION_HANDLERS
if hasattr(settings, 'CAS_AFFILIATION_HANDLERS'):
if hasattr(settings, "CAS_AFFILIATION_HANDLERS"):
settings.CAS_AFFILIATION_HANDLERS.append(pod_affiliation_handler)
else:
settings.CAS_AFFILIATION_HANDLERS = [pod_affiliation_handler]
settings.CAS_AFFILIATION_HANDLERS = [pod_affiliation_handler]
1 change: 1 addition & 0 deletions pod/authentication/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
PWD = "pod1234pod" # nosec
# ggignore-end


class OwnerTestCase(TestCase):
"""Owner Test Case."""

Expand Down
1 change: 1 addition & 0 deletions pod/authentication/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PWD = "pod1234pod" # nosec
# ggignore-end


class authenticationViewsTestCase(TestCase):
fixtures = [
"initial_data.json",
Expand Down
1 change: 0 additions & 1 deletion pod/authentication/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Authentication views."""

from django.http import HttpResponse
from django.shortcuts import render
from django.shortcuts import redirect
from django.urls import reverse
Expand Down
1 change: 1 addition & 0 deletions pod/live/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
PWD = "pod1234pod" # nosec
# ggignore-end


class LiveViewsTestCase(TestCase):
"""Test case for Pod Live views."""

Expand Down
1 change: 1 addition & 0 deletions pod/main/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
PWD = "pod1234pod" # nosec
# ggignore-end


class MainViewsTestCase(TestCase):
"""Main views test cases."""

Expand Down
1 change: 1 addition & 0 deletions pod/recorder/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
PWD = "pod1234pod" # nosec
# ggignore-end


class RecorderViewsTestCase(TestCase):
"""Test case for Pod recorder views."""

Expand Down
4 changes: 1 addition & 3 deletions pod/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,9 +441,7 @@ def update_settings(local_settings):
"pod.authentication.populatedCASbackend.populateUser",
# function call to add some information to user login by CAS
)
local_settings["MIDDLEWARE"].append(
"django_cas_ng.middleware.CASMiddleware"
)
local_settings["MIDDLEWARE"].append("django_cas_ng.middleware.CASMiddleware")

if local_settings.get("USE_SHIB", False):
local_settings["AUTHENTICATION_BACKENDS"] += (
Expand Down
4 changes: 2 additions & 2 deletions pod/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@
# CAS
if USE_CAS:
urlpatterns += [
path('accounts/login', cas_views.LoginView.as_view(), name='cas_ng_login'),
path('accounts/logout', cas_views.LogoutView.as_view(), name='cas_ng_logout'),
path("accounts/login", cas_views.LoginView.as_view(), name="cas_ng_login"),
path("accounts/logout", cas_views.LogoutView.as_view(), name="cas_ng_logout"),
]

# OIDC
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[flake8]
exclude = .git,pod/*/migrations/*.py,*_settings.py,node_modules/*/*.py,pod/static/*.py,pod/custom/tenants/*/*.py,./venv/*
exclude = .git,pod/*/migrations/*.py,*_settings.py,*/node_modules/*/*.py,pod/static/*.py,pod/custom/tenants/*/*.py,./venv/*,.venv/*
max-complexity = 7
max-line-length = 90
# See https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
Expand Down

0 comments on commit 06301b5

Please sign in to comment.