jfinkels/flask-restless — pull request #279 by glyphobet (2014-01-14 15:05:32+00:00)
Title: convert integers in JSON responses to intervals in SQL

This adds handling of SQL interval types in the same way Flask-Restless handles SQL date & datetime types. A request containing an integer value for a column which is of the interval type is treated as an integer number of seconds and converted to a `datetime.timedelta` type. String values for interval types are left un-modified (PostgreSQL at least will correctly parse intervals strings like `"2 days"` as well as `"1:23:45"`.

Flask's default JSON encoder doesn't support `timedelta` types, so the test is a bit more complicated. Automatical handling of interval types in Flask-Restless could be added here as well. IMHO, interval types are widely enough used that it would be helpful if they just worked flawlessly.