jose <[EMAIL PROTECTED]> writes:

> Adam Jones wrote:
>
>>What have you tried so far to get it working? AFAIK it should work in
>>exactly the same way as any other widget, since all of the work that
>>CDP does is on the display side. Please post whatever relevant code you
>>have so we can figure this out.
>>
>>-Adam
>>
>>  
>>
> I'm trying this:
>
> widgets.CalendarDatePicker(
>             name = "mydate",
>             label = 'date label:',
>             default = None,
>             validator = DateValidator(today_or_after=True),
>             not_empty = True,
>             ),
>
> I expect it doesn't allow me to input a date before today but it does.

Can you try this and see if you get the same output as I did?

>>> from formencode.validators import DateValidator
>>> from datetime import datetime
>>> dv = DateValidator(today_or_after=True)
>>> dv.to_python(datetime.now())
datetime.datetime(2006, 10, 19, 21, 6, 15, 764979)
>>> datetime.fromordinal(100000)
datetime.datetime(274, 10, 16, 0, 0)
>>> date = datetime.fromordinal(100000)
>>> dv.to_python(date)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File 
"/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/formencode/formencode/api.py",
 line 319, in to_python
    vp(value, state)
  File 
"/home/godoy/desenvolvimento/python/TurboGears/1.0/thirdparty/formencode/formencode/validators.py",
 line 844, in validate_python
    value, state)
formencode.api.Invalid: The date must be sometime in the future
>>> 

-- 
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to