Author: ianb
Date: 2008-09-16 12:53:55 -0600 (Tue, 16 Sep 2008)
New Revision: 3589
Modified:
FormEncode/trunk/docs/htmlfill.txt
FormEncode/trunk/docs/news.txt
FormEncode/trunk/formencode/htmlfill.py
Log:
Add a new format=ignore for htmlfill error formatting
Modified: FormEncode/trunk/docs/htmlfill.txt
===================================================================
--- FormEncode/trunk/docs/htmlfill.txt 2008-09-16 15:49:05 UTC (rev 3588)
+++ FormEncode/trunk/docs/htmlfill.txt 2008-09-16 18:53:55 UTC (rev 3589)
@@ -66,6 +66,26 @@
In addition to explicit error tags, any leftover errors will be placed
immediately above the associated input field.
+The default formatters available to you:
+
+``default``:
+ HTML-quotes the error and wraps it in ``<span class="error-message">``
+
+``none``:
+ Puts the error message in with no quoting of any kind. This
+ allows you to put HTML in the error message, but might also expose
+ you to cross-site scripting vulnerabilities.
+
+``escape``:
+ HTML-quotes the error, but doesn't wrap it in anything.
+
+``escapenl``:
+ HTML-quotes the error, and translates newlines to ``<br>``
+
+``ignore``:
+ Swallows the error, emitting nothing. You can use this when you
+ never want an error for a field to display.
+
Valid form templates
--------------------
Modified: FormEncode/trunk/docs/news.txt
===================================================================
--- FormEncode/trunk/docs/news.txt 2008-09-16 15:49:05 UTC (rev 3588)
+++ FormEncode/trunk/docs/news.txt 2008-09-16 18:53:55 UTC (rev 3589)
@@ -34,6 +34,10 @@
list instance, so if you modified it then it would effect future
``if_missing`` values (reported by Felix Schwarz).
+* Added formatter to :mod:`formencode.htmlfill`, so you can use
+ ``<form:error name="field_name" formatter="ignore" />`` -- this will
+ cause the error to be swallowed, not shown to the user.
+
1.0.1
-----
Modified: FormEncode/trunk/formencode/htmlfill.py
===================================================================
--- FormEncode/trunk/formencode/htmlfill.py 2008-09-16 15:49:05 UTC (rev
3588)
+++ FormEncode/trunk/formencode/htmlfill.py 2008-09-16 18:53:55 UTC (rev
3589)
@@ -128,6 +128,12 @@
error = error.replace('\n', '<br>\n')
return error
+def ignore_formatter(error):
+ """
+ Formatter that emits nothing, regardless of the error.
+ """
+ return ''
+
class FillingParser(RewritingParser):
r"""
Fills HTML with default values, as in a form.
@@ -495,4 +501,6 @@
default_formatter_dict = {'default': default_formatter,
'none': none_formatter,
'escape': escape_formatter,
- 'escapenl': escapenl_formatter}
+ 'escapenl': escapenl_formatter,
+ 'ingore': ignore_formatter,
+ }
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs