cubicweb #4646675 SQL cache messing with tz-ed datetime [open]

When using tz-ed datetime objects in RQL parameters, and reusing the same RQL query with different values, the SQL query parameters are always the same.

An example in a cw shell:

>>> import datetime, pytz
>>> from cubicweb.server import DBG_RQL, DBG_SQL, set_debug
>>> set_debug(DBG_RQL|DBG_SQL)
>>> d1 = datetime.datetime(2014, 01, 02, tzinfo=pytz.utc)
>>> d2 = datetime.datetime(2014, 02, 02, tzinfo=pytz.utc)
>>> rql("Any X WHERE X is CWUser, X creation_date %(D)s", {"D": d1})
********************************************************************************
querier input 'Any X WHERE X is CWUser, X creation_date %(D)s' {'D': datetime.datetime(2014, 1, 2, 0, 0, tzinfo=<UTC>)}
  rql for system source: u'Any X WHERE X is CWUser, X creation_date %(D)s'
exec SELECT _X.cw_eid
FROM cw_CWUser AS _X
WHERE _X.cw_creation_date=%(D)s {'D': datetime.datetime(2014, 1, 2, 0, 0)} <connection object at 0x7f1f3a61ab40; dsn: 'host=192.168.122.2  dbname=unlish-instance  user=cdevienne', closed: 0>
  --> [] time:  0.00382304191589
<empty resultset for 'Any X WHERE X is CWUser, X creation_date %(D)s'>
>>> rql("Any X WHERE X is CWUser, X creation_date %(D)s", {"D": d2})
********************************************************************************
querier input 'Any X WHERE X is CWUser, X creation_date %(D)s' {'D': datetime.datetime(2014, 2, 2, 0, 0, tzinfo=<UTC>)}
  rql for system source: u'Any X WHERE X is CWUser, X creation_date %(D)s'
exec SELECT _X.cw_eid
FROM cw_CWUser AS _X
WHERE _X.cw_creation_date=%(D)s {'D': datetime.datetime(2014, 1, 2, 0, 0)} <connection object at 0x7f1f3a61ab40; dsn:     'host=192.168.122.2  dbname=unlish-instance  user=cdevienne', closed: 0>
  --> [] time:  0.0030620098114
<empty resultset for 'Any X WHERE X is CWUser, X creation_date %(D)s'>
>>>
priorityimportant
typebug
done in<not specified>
closed by<not specified>