Author: ianb
Date: 2008-03-26 11:17:48 -0600 (Wed, 26 Mar 2008)
New Revision: 3360
Modified:
FormEncode/trunk/docs/Validator.txt
FormEncode/trunk/formencode/validators.py
Log:
fix some doctests in small ways
Modified: FormEncode/trunk/docs/Validator.txt
===================================================================
--- FormEncode/trunk/docs/Validator.txt 2008-03-26 03:23:15 UTC (rev 3359)
+++ FormEncode/trunk/docs/Validator.txt 2008-03-26 17:17:48 UTC (rev 3360)
@@ -222,10 +222,11 @@
so, for example, if you have an email_confirm and a password_confirm
fields and use FieldsMatch on both of them as follows:
- >>> chained_validators [ validators.FieldsMatch('password',
- ... 'password_confirm'),
- ... validators.FieldsMatch('email',
- ... 'email_confirm') ]
+ >>> chained_validators = [
+ ... validators.FieldsMatch('password',
+ ... 'password_confirm'),
+ ... validators.FieldsMatch('email',
+ ... 'email_confirm')]
This will leave the error_dict with both password_confirm and
email_confirm error keys, which is likely the desired behavior
@@ -248,7 +249,11 @@
... return {'state': 'You must enter a state'}
>>> ValidateState = SimpleFormValidator(validate_state)
>>> ValidateState.to_python({'country': 'US'}, None)
+ Traceback (most recent call last):
+ ...
+ Invalid: state: You must enter a state
+
The ``validate_state`` function (or any validation function) returns
any errors in the form (or it may raise Invalid directly). It can
also modify the ``value_dict`` dictionary directly. When it returns
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2008-03-26 03:23:15 UTC (rev
3359)
+++ FormEncode/trunk/formencode/validators.py 2008-03-26 17:17:48 UTC (rev
3360)
@@ -1241,6 +1241,7 @@
'[EMAIL PROTECTED]'
>>> e.to_python('[EMAIL PROTECTED]')
'[EMAIL PROTECTED]'
+ >>> # NOTE: If you do not have PyDNS installed this example won't work:
>>> e.to_python('[EMAIL PROTECTED]')
Traceback (most recent call last):
...
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
FormEncode-CVS mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/formencode-cvs