Author: mark
Date: 2008-08-12 04:19:28 -0600 (Tue, 12 Aug 2008)
New Revision: 3540

Modified:
   FormEncode/trunk/formencode/addressing.py
Log:
doctests in addressing for trivial classes

Modified: FormEncode/trunk/formencode/addressing.py
===================================================================
--- FormEncode/trunk/formencode/addressing.py   2008-07-31 21:32:17 UTC (rev 
3539)
+++ FormEncode/trunk/formencode/addressing.py   2008-08-12 10:19:28 UTC (rev 
3540)
@@ -3,7 +3,7 @@
 from api import FancyValidator, _
 from validators import Regex, Invalid, PostalCode
 
-# @todo     utilize pycountry
+# @todo     utilize pycountry or http://opencountrycodes.appspot.com/python/
 from dbmanager.util.i18n import get_country, get_countries
 
 class GermanPostalCode(Regex):
@@ -187,7 +187,27 @@
         return match.group(1).upper()
 
 class CountryValidator(FancyValidator):
+    """
+    Will convert a country's name into its ISO-3166 abbreviation for unified
+    storage in databases etc. and return a localized country name in the
+    reverse step.
 
+    @See http://www.iso.org/iso/country_codes/iso_3166_code_lists.htm
+
+    ::
+
+        >>> CountryValidator.to_python('Germany')
+        'DE'
+        >>> CountryValidator.to_python('Finland')
+        'FR'
+        >>> CountryValidator.to_python('UNITED STATES')
+        'US'
+        >>> CountryValidator.to_python('Krakovia')
+        Traceback (most recent call last):
+            ...
+        Invalid: That country is not listed in ISO-3166
+    """
+
     key_ok = True
 
     messages = {


-------------------------------------------------------------------------
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

Reply via email to