| Server IP : 85.214.239.14 / Your IP : 216.73.216.212 Web Server : Apache/2.4.65 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 8.2.29 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /srv/modoboa/env/lib/python3.5/site-packages/modoboa/admin/forms/ |
Upload File : |
"""Forms related to forwards management."""
from django import forms
from django.core import validators
from django.utils.translation import ugettext_lazy
class ForwardForm(forms.Form):
"""Forward definition form."""
dest = forms.CharField(
label=ugettext_lazy("Recipient(s)"),
widget=forms.Textarea(attrs={"class": "form-control"}),
required=False,
help_text=ugettext_lazy(
"Indicate one or more recipients separated by a ','")
)
keepcopies = forms.BooleanField(
label=ugettext_lazy("Keep local copies"),
required=False,
help_text=ugettext_lazy(
"Forward messages and store copies into your local mailbox")
)
def clean_dest(self):
"""Check recipients validity."""
rawdata = self.cleaned_data.get("dest", "").strip()
recipients = []
if not rawdata:
return recipients
for rcpt in rawdata.split(","):
validators.validate_email(rcpt)
recipients += [rcpt]
return recipients