def delete_email_domain(self, id): domain = EmailDomain.get(id) if domain is not None: domain.delete() meta.Session.commit() else: h.flash('Email domain with id %s does not exist' % id) redirect(url(controller='admin', action='email_domains'))
def delete_domain(self, location): if 'domain_id' in request.POST: try: id = int(request.POST['domain_id']) except ValueError: abort(404) domain = EmailDomain.get(id) if domain is not None and domain.location == location: domain.delete() meta.Session.commit() h.flash("Email domain %(domain_name)s deleted." % { 'domain_name': domain.domain_name}) redirect(location.url(action='edit_registration'))