Exemplo n.º 1
0
def escapenl_formatter(error):
    """
    Formatter that escapes HTML, and translates newlines to ``<br>``
    """
    error = html_quote(error)
    error = error.replace('\n', '<br>\n')
    return error
Exemplo n.º 2
0
def escapenl_formatter(error):
    """
    Formatter that escapes HTML, and translates newlines to ``<br>``
    """
    error = html_quote(error)
    error = error.replace('\n', '<br>\n')
    return error
Exemplo n.º 3
0
 def error_formatter(error):
     """
     Custom htmlfill error formatter that doesn't add a <br/> (since this causes formatting
     problems on our forms).
     :param error: the error to format
     """
     if error is None:
         return ""
     return '<span class="error-message">%s</span>\n' % html_quote(error)
Exemplo n.º 4
0
 def handle_textarea(self, attrs):
     name = self.get_attr(attrs, "name")
     if self.prefix_error:
         self.write_marker(name)
     if self.error_class and self.errors.get(name):
         self.add_class(attrs, self.error_class)
     self.write_tag("textarea", attrs)
     value = self.defaults.get(name, "")
     self.write_text(html_quote(value))
     self.write_text("</textarea>")
     self.in_textarea = True
     self.last_textarea_name = name
     self.add_key(name)
Exemplo n.º 5
0
 def handle_textarea(self, attrs):
     name = self.get_attr(attrs, 'name')
     if self.prefix_error:
         self.write_marker(name)
     if (self.error_class
         and self.errors.get(name)):
         self.add_class(attrs, self.error_class)
     self.write_tag('textarea', attrs)
     value = self.defaults.get(name, '')
     self.write_text(html_quote(value))
     self.write_text('</textarea>')
     self.in_textarea = True
     self.last_textarea_name = name
     self.add_key(name)
Exemplo n.º 6
0
 def handle_textarea(self, attrs):
     name = self.get_attr(attrs, 'name')
     if self.prefix_error:
         self.write_marker(name)
     if (self.error_class
         and self.errors.get(name)):
         self.add_class(attrs, self.error_class)
     self.write_tag('textarea', attrs)
     value = self.defaults.get(name, '')
     self.write_text(html_quote(value))
     self.write_text('</textarea>')
     self.in_textarea = True
     self.last_textarea_name = name
     self.add_key(name)
Exemplo n.º 7
0
def escape_formatter(error):
    """
    Formatter that escapes HTML, no more.
    """
    return html_quote(error)
Exemplo n.º 8
0
def default_formatter(error):
    """
    Formatter that escapes the error, wraps the error in a span with
    class ``error-message``, and adds a ``<br>``
    """
    return '<span class="error-message">%s</span><br />\n' % html_quote(error)
Exemplo n.º 9
0
def escape_formatter(error):
    """
    Formatter that escapes HTML, no more.
    """
    return html_quote(error)
Exemplo n.º 10
0
def default_formatter(error):
    """
    Formatter that escapes the error, wraps the error in a span with
    class ``error-message``, and adds a ``<br>``
    """
    return '<span class="error-message">%s</span><br />\n' % html_quote(error)
Exemplo n.º 11
0
def htmlfill_error_formatter(error):
    """
    An error formatter to make the errors consistent with the js validate errors.
    """
    from formencode.rewritingparser import html_quote
    return '<div class="error-container"><label class="error">%s</label></div>' % (html_quote(error))