On Wed 13 May 2009 03:39:01 PM EDT, Oleg Broytmann wrote:
> On Wed, May 13, 2009 at 07:11:22PM +0000, Matthew Wilson wrote:
>> Hi -- I wrote some code to add a TimedeltaCol type.  I only tested it in
>> postgresql.
>
>    Thank you!
>
>> +def TimedeltaConverter(value, db):
>> +    
>> +    return """INTERVAL '%d days %d seconds'""" % \
>> +        (value.days, value.seconds)
>> +
>> +registerConverter(datetime.timedelta, TimedeltaConverter)
>
>    The syntax is only valid in Postgres, so it has to be protected:
>
> def TimedeltaConverter(value, db):
>     if db == 'postgres':
>         return """INTERVAL '%d days %d seconds'""" % \
>             (value.days, value.seconds)
>     else:
>         raise ValueError('TimedeltaCol is only implemented for Postgres')
>
>> +class TimedeltaValidator(validators.Validator):
>> +    def to_python(self, value, state):
>> +        return value
>> +
>> +    def from_python(self, value, state):
>> +        return value
>
>    Why empty validator?
>
>    IWBN to have a test also.

I completely agree; can you point me to where in the code I should write
the test?  Also, are there any tests I can use as a guide?

Later this week, I'll try to send in an updated patch with the code you
added and a test.

Matt


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to