|
From: <sub...@co...> - 2008-05-14 15:43:44
|
Author: ianb
Date: 2008-05-14 09:43:45 -0600 (Wed, 14 May 2008)
New Revision: 3424
Modified:
FormEncode/trunk/formencode/validators.py
Log:
added an example of DateConverter with month_style
Modified: FormEncode/trunk/formencode/validators.py
===================================================================
--- FormEncode/trunk/formencode/validators.py 2008-05-14 15:37:37 UTC (rev 3423)
+++ FormEncode/trunk/formencode/validators.py 2008-05-14 15:43:45 UTC (rev 3424)
@@ -1808,6 +1808,15 @@
Traceback (most recent call last):
...
Invalid: Please enter a month from 1 to 12
+
+ If you change ``month_style`` you can get European-style dates::
+
+ >>> d = DateConverter(month_style='dd/mm/yyyy')
+ >>> date = d.to_python('12/3/09')
+ >>> date
+ datetime.date(2009, 3, 12)
+ >>> d.from_python(date)
+ '12/03/2009'
"""
## @@: accepts only US-style dates
|