#347 Return datetime objects in iso string format
Merged by mikem. Opened by mikem.
mikem/koji psycopg2-timestamps  into  master

Download 347.patch

Historically, kojihub has never returned any datetime objects. We originally used PyGreSQL, which returned date fields as iso strings. With the switch to psycopg2, we started getting datetime objects from our queries. Our initial workaround for that involved a little bit of low level mangling in psycopg2.extensions that could sometimes cause mysterious errors. This alternate solution is more straightforward.

see also: PR #292

This looks good to me. :thumbsup:

Note that this does mean the values will still be datetime objects within the hub code. AFAICT, the hub code never actually does anything with those query fields; it just passes them through.

+1 Seems like a much cleaner option.

Solves my problems! +1

btw, search through code lead me to parse_timestamp, formatTime, formatTimeLong in koji/__init_.py. These function seems to be used nowhere. Is it some relict, or are they expected to be used outside of project?

btw, search through code lead me to parse_timestamp, formatTime, formatTimeLong in koji/__init_.py. These function seems to be used nowhere. Is it some relict, or are they expected to be used outside of project?

parse_timestamp predates the initial release of Koji. It was used to parse text timestamps returned in some hub data before we started adding the corresponding *_ts fields. It hasn't been used since before Koji was made public.

formatTimeLong is still used in the cli and web ui

formatTime is still used in the web ui, and in koji.util.

Commit 851dcd3c fixes this pull-request

Pull-Request has been merged by mikem@redhat.com

Metadata