Coverage for src/postorius/views/domain.py : 86%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*- # Copyright (C) 1998-2019 by the Free Software Foundation, Inc. # # This file is part of Postorius. # # Postorius is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) # any later version. # # Postorius is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # more details. # # You should have received a copy of the GNU General Public License along with # Postorius. If not, see <http://www.gnu.org/licenses/>.
def domain_index(request): site=site, mail_domain=domain.mail_host) 'domains': existing_domains, })
def domain_new(request): description=form.cleaned_data['description'], alias_domain=form.cleaned_data['alias_domain'], owner=request.user.email) else: site=form.cleaned_data['site'], mail_domain=form.cleaned_data['mail_host']) else:
def domain_edit(request, domain): except MailDomain.DoesNotExist: web_host = MailDomain.objects.create( site=form.cleaned_data['site'], mail_domain=domain) else: except HTTPError as e: messages.error(request, e) else: else: messages.error(request, _('Please check the errors below')) else: form_initial = { 'description': domain_obj.description, 'alias_domain': domain_obj.alias_domain, 'site': MailDomain.objects.get(mail_domain=domain).site, } form = DomainEditForm(initial=form_initial)
return render(request, 'postorius/domain/edit.html', { 'domain': domain, 'form': form})
def domain_delete(request, domain): """Deletes a domain but asks for confirmation first. """ _('The domain %s has been deleted.' % domain)) except HTTPError as e: messages.error(request, _('The domain could not be deleted: %s' % e.msg)) return redirect("domain_index") {'domain': domain_obj, 'lists': domain_lists_page}) |