Fix prospector errors and move secret_key to yaml config

This commit is contained in:
Jens Langhammer 2018-11-27 10:56:40 +01:00
parent 7c7b3469e9
commit cde35515c7
7 changed files with 10 additions and 11 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
"""Django manage.py"""
import os import os
import sys import sys

View File

@ -27,7 +27,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__fil
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s' SECRET_KEY = CONFIG.get('secret_key')
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True

View File

@ -29,6 +29,7 @@ secure_proxy_header:
redis: localhost redis: localhost
# Error reporting, sends stacktrace to sentry.services.beryju.org # Error reporting, sends stacktrace to sentry.services.beryju.org
error_report_enabled: true error_report_enabled: true
secret_key: 9$@r!d^1^jrn#fk#1#@ks#9&i$^s#1)_13%$rwjrhd=e8jfi_s
passbook: passbook:
sign_up: sign_up:

View File

View File

@ -2,10 +2,6 @@
from logging import getLogger from logging import getLogger
from django import template from django import template
from django.apps import AppConfig
from django.core.cache import cache
from django.urls import reverse
from django.urls.exceptions import NoReverseMatch
register = template.Library() register = template.Library()
LOGGER = getLogger(__name__) LOGGER = getLogger(__name__)

View File

@ -145,10 +145,10 @@ def related_models(context, model_path):
user = request.user user = request.user
model = path_to_class(model_path) model = path_to_class(model_path)
if not issubclass(model, UserAcquirable): # if not issubclass(model, UserAcquirable):
# model_path is not actually a module # # model_path is not actually a module
# so we can't assume that it's usable # # so we can't assume that it's usable
return [] # return []
return model.objects.filter(users__in=[user]) return model.objects.filter(users__in=[user])
@ -161,4 +161,5 @@ def unslug(_input):
@register.filter(name='css_class') @register.filter(name='css_class')
def css_class(field, css): def css_class(field, css):
"""Add css class to form field"""
return field.as_widget(attrs={"class": css}) return field.as_widget(attrs={"class": css})

View File

@ -195,7 +195,7 @@ class OAuthCallback(OAuthClientMixin, View):
def handle_new_user(self, source, access, info): def handle_new_user(self, source, access, info):
"Create a shell auth.User and redirect." "Create a shell auth.User and redirect."
was_authenticated = False was_authenticated = False
if self.request.user.is_authenticated: # pylint: disable=no-else-return if self.request.user.is_authenticated:
# there's already a user logged in, just link them up # there's already a user logged in, just link them up
user = self.request.user user = self.request.user
was_authenticated = True was_authenticated = True