On Oct 22, 2010, at 6:39 PM, Eoghan Murray wrote:

> Hi,
> 
> I've the following code that works fine in 0.5.8
> 
>    from sqlalchemy.types import Interval as SAInterval
> 
>    class Interval(SAInterval):
>        def process_bind_param(self, value, engine):
>            """coerce to a timedelta"""
>            if value is not None:
>                value = timedelta(days=value.days,
> seconds=value.seconds)
>            return super(Interval, self).process_bind_param(value,
> engine)
> 
> In 0.6.4, I can do the following:
> 
>    class Interval(types.TypeDecorator):
>        impl = SAInterval
> 
>        def process_bind_param(self, value, engine):
>            """coerce to a timedelta"""
>            if value is not None:
>                value = timedelta(days=value.days,
> seconds=value.seconds)
>            return value
> 
> Is this an oversight in the 06Migration, or was I just doing it wrong
> previously?

mmmm, i think the contract of TypeDecorator is that you don't need to deal with 
super().   But the funny thing about Interval is its already a TypeDecorator, 
but the idea should be the same (in 0.5 too...)

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to