Re: DateRange with mx.Date - Mailing list psycopg

From Tilman Koschnick
Subject Re: DateRange with mx.Date
Date
Msg-id 1435863428.6358.16.camel@mother.subnetz.org
Whole thread Raw
In response to Re: DateRange with mx.Date  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
List psycopg
Hi Daniele,

thanks a lot for your explanation.

On Thu, 2015-06-25 at 15:02 +0100, Daniele Varrazzo wrote:
> On Thu, Jun 25, 2015 at 12:08 PM, Tilman Koschnick <til@subnetz.org> wrote:
> > is there a way to adapt extras.DateRange to use extensions.MXDATE as a
> > typecaster and accept/return mx.Date values directly?

> The Range casters use whatever typecaster is registered for its base
> type so, if you register the mx.Date typecaster the range one should
> just work. Testing it seems working:

> with the noticeable exception that there is no type mx.Date it seems,
> only DateTime (sorry but I can't remember much about mx objects: I
> haven't used them for a long time):

> So it seems it should mostly work out of the box. I don't know if the
> Date/DateTime confusion can be solved but it shouldn't be hard to copy
> the adapter (from the _range.py module) and kick it until it complies
> to adapt mx.DateTime objects as they were dates.

Apparently casting from plain dates as well as dateranges to mx.DateTime
works fine, as does casting mx.DateTime back to plain dates. I'll dig a
bit deeper in the _range.py module, as you suggest.

Regards, Til



psycopg by date:

Previous
From: "Shulgin, Oleksandr"
Date:
Subject: Re: Streaming replication for psycopg2
Next
From: "Vamsi Krishna Reddy -T (vamsredd - TATA CONSULTANCY SERVICES LIMITED at Cisco)"
Date:
Subject: How to lock a table for update and make other connections to wait on it