[Zope] Changing Python's Date/Time Input Format
    Wilson, Derek 
    dwilson at abrazohealth.com
       
    Fri Nov 21 12:34:52 EST 2003
    
    
  
I'd also check out the calendar product from Venkata Karthikeyan. I use
it on my website with no problems. It's a pretty nice interface too,
though it only works with IE5+.
Thanks,
Derek Wilson
-----Original Message-----
From: Julian Clark [mailto:Julian.Clarke at b-online.com.au] 
Sent: Thursday, November 20, 2003 8:42 PM
To: zope
Subject: [Zope] Changing Python's Date/Time Input Format
Hi All.
I've got a minor issue with a form which takes a date and returns the
string date. I'm wanting the input format to be able to accept any of
dd-mm-yy, dd mon year, dd/mm/yyyy. Currently, it works for dd mon year,
but it handles other input as mm/dd/yy. (which is kind-of un-natural for
those using this form)
how should I modify this python script...
today=DateTime(input)
return today.strftime("%d %B %Y")
... to alert Zope that the incoming string will be always in the order
of dd mm yyyy?
This is the traceback when the first tuple is not a valid month.
<!--
Traceback (innermost last):
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 187, in
publish
  File D:\Zope\2-3-3\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
    (Object: Traversable)
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 171, in
publish
  File D:\Zope\2-3-3\lib\python\ZPublisher\mapply.py, line 160, in
mapply
    (Object: template)
  File D:\Zope\2-3-3\lib\python\ZPublisher\Publish.py, line 112, in
call_object
    (Object: template)
  File D:\Zope\2-3-3\lib\python\OFS\DTMLMethod.py, line 189, in __call__
    (Object: template)
  File D:\Zope\2-3-3\lib\python\DocumentTemplate\DT_String.py, line 540,
in __call__
    (Object: template)
  File D:\Zope\2-3-3\lib\python\DocumentTemplate\DT_Util.py, line 339,
in eval
    (Object: stringdate(purc_date))
    (Info: stringdate)
  File <string>, line 0, in ?
  File D:\Zope\Products\PythonMethod\PythonMethod.py, line 168, in
__call__
    (Object: stringdate)
    (Info: (('21/12/2003',), {}, None))
  File <string>, line 2, in stringdate
  File D:\Zope\2-3-3\lib\python\DateTime\DateTime.py, line 708, in
__init__
  File D:\Zope\2-3-3\lib\python\DateTime\DateTime.py, line 1050, in
_parse Invalid Date Components: 21/12/2003
-->
Cheers,
Julian Clark
_______________________________________________
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