[Zope-DB] Problem with TALES DateTime conversion

M.-A. Lemburg mal@lemburg.com
Sat, 15 Mar 2003 17:44:39 +0100

Charlie Clark wrote:
> On 2003-03-15 at 15:00:02 [+0100], charlie@begeistert.org wrote:
>>> > 
>>> > It just gives me 'instance' both for DateTime objects which I can 
>>> > convert using strftime and Date objects which I can't :-/
>>>Sorry, I should have known that.
>>>Try "str(aDateObject.__class__)", again inside your External Method.
>>Strange I just get DateTime.DateTime.DateTime for both types. I switched 
>>to using mxDateTime which is an option in Psycopg and while this produces 
>>an error for the above call (__class__ isn't allowed), it does allow me 
>>to do the formatting I want. Still, I'm curious to know what/where the 
>>error is.
> Weird, using mxDateTime on the server (linux) seems to cause a security 
> look-up. I get a login box and the error "strftime not allowed to be used 
> in this context". I have to use mxDateTime on Windows but it seems the DA 
> forgets this regularly as I get the IOError from DateTime.py and then have 
> to close and reopen the DA :-( at which point the error goes away.

The mxDateTime 2.1 version should be usable in those contexts as
well (I've added the necessary attributes to DateTime objects).

The mxODBC Zope DA already uses this version.

Marc-Andre Lemburg

Professional Python Software directly from the Source  (#1, Mar 15 2003)
 >>> Python/Zope Products & Consulting ...         http://www.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
Python UK 2003, Oxford:                                     17 days left
EuroPython 2003, Charleroi, Belgium:                       101 days left