Minor
This commit is contained in:
1 parent
77989698e1
commit
80b1a24ee4
2 files changed
+12
-2
No files matched your search
+11
-1
@@ -3,6 +3,8 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.forms import AuthenticationForm
|
||||
from django.contrib.auth.models import User
|
||||
from django.shortcuts import render, redirect
|
||||
import logging
|
||||
from requests import exceptions
|
||||
from rest_framework import viewsets, views
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework.response import Response
|
||||
@@ -14,6 +16,9 @@ from mailadmin.serializers import UserSerializer, OrgUnitSerializer, AliasSerial
|
||||
from mailadmin.permissions import SourcePrefixOwner
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def index(request):
|
||||
if request.method == "POST":
|
||||
form = AuthenticationForm(data=request.POST)
|
||||
@@ -68,7 +73,12 @@ class AliasesView(views.APIView):
|
||||
if len(my_prefixes) == 0:
|
||||
return Response({'result': 'No results'}) # Need at least one
|
||||
|
||||
res = self._api.list_aliases_regex(regexp)
|
||||
try:
|
||||
res = self._api.list_aliases_regex(regexp)
|
||||
except exceptions.RequestException as e:
|
||||
logger.warning('mxapi errored {}'.format(e.strerror))
|
||||
return Response({'error': e.strerror}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
|
||||
return Response(res)
|
||||
|
||||
def post(self, request):
|
||||
|
||||
@@ -88,7 +88,7 @@ STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
|
||||
|
||||
LOGIN_REDIRECT_URL = '/lists/'
|
||||
|
||||
DPD_API_URL= 'https://mxapi.neuf.no/api'
|
||||
DPD_API_URL = 'http://localhost'
|
||||
DPD_API_USERNAME = ""
|
||||
DPD_API_PASSWORD = ""
|
||||
|
||||
|
||||
Reference in new issue
Block a user