Mailman: split the django_fedora module
Some imports need to read the config file, which creates a import loop.
This commit is contained in:
parent
a7a67a72ef
commit
f40ce9d969
4 changed files with 24 additions and 23 deletions
|
@ -13,19 +13,3 @@ def exclude_useless_errors(record):
|
||||||
if isinstance(exc_value, excluded_class):
|
if isinstance(exc_value, excluded_class):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
# Disable local signup
|
|
||||||
|
|
||||||
from allauth.account.adapter import DefaultAccountAdapter
|
|
||||||
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
|
||||||
|
|
||||||
class NoLocalSignUpAdapter(DefaultAccountAdapter):
|
|
||||||
|
|
||||||
def is_open_for_signup(self, request):
|
|
||||||
return False
|
|
||||||
|
|
||||||
class SignUpEnabledSocialAdapter(DefaultSocialAccountAdapter):
|
|
||||||
|
|
||||||
def is_open_for_signup(self, request, sociallogin):
|
|
||||||
return True
|
|
||||||
|
|
14
roles/mailman/files/django_fedora_nosignup.py
Normal file
14
roles/mailman/files/django_fedora_nosignup.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
# Disable local signup
|
||||||
|
|
||||||
|
from allauth.account.adapter import DefaultAccountAdapter
|
||||||
|
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
|
||||||
|
|
||||||
|
class NoLocalSignUpAdapter(DefaultAccountAdapter):
|
||||||
|
|
||||||
|
def is_open_for_signup(self, request):
|
||||||
|
return False
|
||||||
|
|
||||||
|
class SignUpEnabledSocialAdapter(DefaultSocialAccountAdapter):
|
||||||
|
|
||||||
|
def is_open_for_signup(self, request, sociallogin):
|
||||||
|
return True
|
|
@ -267,10 +267,13 @@
|
||||||
- config
|
- config
|
||||||
- mailman
|
- mailman
|
||||||
|
|
||||||
- name: install the django_fedora module
|
- name: install the fedora-specific modules
|
||||||
copy: src=django_fedora.py
|
copy: src={{ item }}.py
|
||||||
dest="{{ mailman_webui_confdir }}/django_fedora.py"
|
dest="{{ mailman_webui_confdir }}/{{ item }}.py"
|
||||||
owner=root group=root mode=0644
|
owner=root group=root mode=0644
|
||||||
|
with_items:
|
||||||
|
- django_fedora
|
||||||
|
- django_fedora_nosignup
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
- mailman
|
- mailman
|
||||||
|
|
|
@ -6,6 +6,8 @@ Django settings for HyperKitty + Postorius
|
||||||
import os
|
import os
|
||||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
import django_fedora
|
||||||
|
|
||||||
# SECURITY WARNING: keep the secret key used in production secret!
|
# SECURITY WARNING: keep the secret key used in production secret!
|
||||||
SECRET_KEY = '{{ mailman_hyperkitty_cookie_key }}'
|
SECRET_KEY = '{{ mailman_hyperkitty_cookie_key }}'
|
||||||
|
|
||||||
|
@ -240,8 +242,8 @@ ACCOUNT_EMAIL_VERIFICATION = "mandatory"
|
||||||
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
|
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
|
||||||
ACCOUNT_UNIQUE_EMAIL = True
|
ACCOUNT_UNIQUE_EMAIL = True
|
||||||
# Disable local signup
|
# Disable local signup
|
||||||
ACCOUNT_ADAPTER = "django_fedora.NoLocalSignUpAdapter"
|
ACCOUNT_ADAPTER = "django_fedora_nosignup.NoLocalSignUpAdapter"
|
||||||
SOCIALACCOUNT_ADAPTER = "django_fedora.SignUpEnabledSocialAdapter"
|
SOCIALACCOUNT_ADAPTER = "django_fedora_nosignup.SignUpEnabledSocialAdapter"
|
||||||
|
|
||||||
SOCIALACCOUNT_PROVIDERS = {
|
SOCIALACCOUNT_PROVIDERS = {
|
||||||
'openid': {
|
'openid': {
|
||||||
|
@ -337,8 +339,6 @@ REST_FRAMEWORK = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
import django_fedora
|
|
||||||
|
|
||||||
# A sample logging configuration. The only tangible logging
|
# A sample logging configuration. The only tangible logging
|
||||||
# performed by this configuration is to send an email to
|
# performed by this configuration is to send an email to
|
||||||
# the site admins on every HTTP 500 error when DEBUG=False.
|
# the site admins on every HTTP 500 error when DEBUG=False.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue