Beispiel #1
0
class email_list_validator(FancyValidator):
    def __init__(self, *args, **kwargs):
        FancyValidator.__init__(self, *args, **kwargs)
        self.email = Email()

    def _to_python(self, value, state=None):
        """Validate a comma separated list of email addresses."""
        emails = [x.strip() for x in value.split(',')]
        good_emails = []
        messages = []

        for addr in emails:
            try:
                good_emails.append(self.email.to_python(addr, state))
            except Invalid, e:
                messages.append(str(e))

        if messages:
            raise Invalid("; ".join(messages), value, state)
        else:
            return ", ".join(good_emails)
Beispiel #2
0
class email_list_validator(FancyValidator):
    def __init__(self, *args, **kwargs):
        FancyValidator.__init__(self, *args, **kwargs)
        self.email = Email()

    def _to_python(self, value, state=None):
        """Validate a comma separated list of email addresses."""
        emails = [x.strip() for x in value.split(',')]
        good_emails = []
        messages = []

        for addr in emails:
            try:
                good_emails.append(self.email.to_python(addr, state))
            except Invalid, e:
                messages.append(str(e))

        if messages:
            raise Invalid("; ".join(messages), value, state)
        else:
            return ", ".join(good_emails)
Beispiel #3
0
 def __init__(self, *args, **kwargs):
     FancyValidator.__init__(self, *args, **kwargs)
     self.email = Email()
Beispiel #4
0
 def __init__(self, *args, **kwargs):
     FancyValidator.__init__(self, *args, **kwargs)
     self.email = Email()
Beispiel #5
0
            value = line_break_xhtml(value)

        # Enable the rich text editor, if dictated by the settings:
        if tiny_mce_condition():
            if 'css_classes' in kwargs:
                kwargs['css_classes'].append('tinymcearea')
            else:
                kwargs['css_classes'] = ['tinymcearea']

        return TextArea.display(self, value, **kwargs)


email_validator = Email(
    messages={
        'badUsername':
        N_('The portion of the email address before the @ is invalid'),
        'badDomain':
        N_('The portion of this email address after the @ is invalid')
    })


class email_list_validator(FancyValidator):
    def __init__(self, *args, **kwargs):
        FancyValidator.__init__(self, *args, **kwargs)
        self.email = Email()

    def _to_python(self, value, state=None):
        """Validate a comma separated list of email addresses."""
        emails = [x.strip() for x in value.split(',')]
        good_emails = []
        messages = []