Re: [SQLObject] DateTimeCol with microsecond resolution.

2011-02-01 Thread Petr Jakeš
> > I will give this a try, meanwhile I have created my own column type: > > -- > class ISO8601Validator(validators.Validator): > def from_python(self, value, state): > if value is not None: > value = value.strftime('%Y-%m-%d %H:%M:%S.%f') > return value > > def to_python(

Re: [SQLObject] DateTimeCol with microsecond resolution.

2011-02-01 Thread Oleg Broytman
On Tue, Feb 01, 2011 at 01:54:03PM -0500, Ben Timby wrote: > Will registering a converter work both > ways? i.e. the value is transformed to string for storage and back > again for retrieval? No, converters work one way - from python data type to SQL string. Oleg. -- Oleg Broytman

Re: [SQLObject] DateTimeCol with microsecond resolution.

2011-02-01 Thread Ben Timby
On Tue, Feb 1, 2011 at 1:24 PM, Oleg Broytman wrote: > On Tue, Feb 01, 2011 at 09:13:35PM +0300, Oleg Broytman wrote: >> def DateTimeConverter(value, db): >>     return "'%s'" % value.isoformat > >   Oops, sorry, a bug: > >    return "'%s'" % value.isoformat() > >> >> registerConverter(datetime.da

Re: [SQLObject] DateTimeCol with microsecond resolution.

2011-02-01 Thread Oleg Broytman
On Tue, Feb 01, 2011 at 09:13:35PM +0300, Oleg Broytman wrote: > def DateTimeConverter(value, db): > return "'%s'" % value.isoformat Oops, sorry, a bug: return "'%s'" % value.isoformat() > > registerConverter(datetime.datetime, DateTimeConverter) Oleg. -- Oleg Broytman

Re: [SQLObject] DateTimeCol with microsecond resolution.

2011-02-01 Thread Oleg Broytman
On Tue, Feb 01, 2011 at 12:26:34PM -0500, Ben Timby wrote: > I really need to store date/time values with millisecond resolution. > What would be the easiest way to achieve this? I found the following > patch: > > http://permalink.gmane.org/gmane.comp.python.sqlobject/5106 > > But I am loath to a