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
"""Django manage.py"""
import os
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/
# 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!
DEBUG = True

View file

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

View file

View file

@ -2,10 +2,6 @@
from logging import getLogger
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()
LOGGER = getLogger(__name__)

View file

@ -145,10 +145,10 @@ def related_models(context, model_path):
user = request.user
model = path_to_class(model_path)
if not issubclass(model, UserAcquirable):
# model_path is not actually a module
# so we can't assume that it's usable
return []
# if not issubclass(model, UserAcquirable):
# # model_path is not actually a module
# # so we can't assume that it's usable
# return []
return model.objects.filter(users__in=[user])
@ -161,4 +161,5 @@ def unslug(_input):
@register.filter(name='css_class')
def css_class(field, css):
return field.as_widget(attrs={"class": css})
"""Add css class to form field"""
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):
"Create a shell auth.User and redirect."
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
user = self.request.user
was_authenticated = True