Hi -- I wrote some code to add a TimedeltaCol type. I only tested it in postgresql.
I'll improve this code if you tell me what I should do. I find the SQLOjbect internals confusing. Matt Index: converters.py =================================================================== --- converters.py (revision 3881) +++ converters.py (working copy) @@ -187,6 +187,14 @@ registerConverter(Decimal, DecimalConverter) +def TimedeltaConverter(value, db): + + return """INTERVAL '%d days %d seconds'""" % \ + (value.days, value.seconds) + +registerConverter(datetime.timedelta, TimedeltaConverter) + + def sqlrepr(obj, db=None): try: reprFunc = obj.__sqlrepr__ Index: col.py =================================================================== --- col.py (revision 3881) +++ col.py (working copy) @@ -1517,6 +1517,32 @@ baseClass = SOPickleCol +class TimedeltaValidator(validators.Validator): + + def to_python(self, value, state): + return value + + def from_python(self, value, state): + return value + + +class SOTimedeltaCol(SOCol): + + def _postgresType(self): + return 'INTERVAL' + + def createValidators(self): + return [TimedeltaValidator(name=self.name)] + \ + super(SOTimedeltaCol, self).createValidators() + + + +class TimedeltaCol(Col): + baseClass = SOTimedeltaCol + + + + def pushKey(kw, name, value): if not kw.has_key(name): kw[name] = value ------------------------------------------------------------------------------ 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