[Zope] How do I test a date to be valid?

Dragos Chirila d.chirila at bucarest.finsiel.ro
Mon Sep 22 11:32:05 EDT 2003


Why don't you use try .. except ?

python:
try:
    x = DateTime(...)
except:
    x = None

In DTML you have dtml-try .. dtml-except

Dragos



----- Original Message ----- 
From: "Jeff Nielsen" <Jeff at UgoFast.com>
To: "Andreas Jung" <andreas at andreas-jung.com>; <zope at zope.org>
Sent: Monday, September 22, 2003 6:22 PM
Subject: RE: [Zope] How do I test a date to be valid?


I was working on that. How do I catch the exception before it becomes an
error? I saw something in the various docs about DateTime.DateTimeError,
but I can't figure out how to implement it.

Jeff Nielsen
http://www.UgoFast.com


-----Original Message-----
From: Andreas Jung [mailto:andreas at andreas-jung.com] 
Sent: Sunday, September 21, 2003 11:00 PM
To: Jeff Nielsen; zope at zope.org
Subject: Re: [Zope] How do I test a date to be valid?


pass it to DateTime(). It should raise an exception for wrong dates.

-aj



--On Sonntag, 21. September 2003 22:54 Uhr -0700 Jeff Nielsen 
<Jeff at UgoFast.com> wrote:

> When a user inputs a date from a form, how can I test it to be valid? 
> I'd want 01/15/2003 to test as valid, but 02/31/2003 to test as false.
>
> Jeff Nielsen
> http://www.UgoFast.com
>





_______________________________________________
Zope maillist  -  Zope at zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )





More information about the Zope mailing list