#1167: Problem with savisit and PostgreSQL?
------------------------+---------------------------------------------------
Reporter: mikl | Owner: anonymous
Type: defect | Status: new
Priority: high | Milestone: 1.0b2
Component: SQLAlchemy | Version: 1.0b1
Severity: normal | Resolution:
Keywords: |
------------------------+---------------------------------------------------
Changes (by jorge.vargas):
* priority: normal => high
* milestone: => 1.0b2
* component: unassigned => SQLAlchemy
Old description:
> Hi guys,
>
> I've been experimenting a bit with TG 1.0b1 and PostgreSQL, and I've
> found a problem with the standard Identity code (with SQLAlchemy).
>
> SQLAlchemy causes all DateTime columns to be created in Postgres as a
> "timestamptz" column - which, as the name implies, also contains the
> timezone. So when SQLAlchemy return the data, we get a time-tuple, WITH
> the timezone.
>
> This causes problems, since the datetime.now() used in much of the SA
> based identity code is timezone-naive. Thus, when I run the code, I get
> this traceback:
>
> raceback (most recent call last):
> File "/usr/lib/python2.4/site-
> packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 103, in
> _run
> applyFilters('before_main')
> File "/usr/lib/python2.4/site-
> packages/CherryPy-2.2.1-py2.4.egg/cherrypy/filters/__init__.py", line
> 151, in applyFilters
> method()
> File "/usr/lib/python2.4/site-packages/TurboGears-1.0b1-
> py2.4.egg/turbogears/visit/api.py", line 140, in before_main
> visit= _manager.visit_for_key( visit_key )
> File "/usr/lib/python2.4/site-packages/TurboGears-1.0b1-
> py2.4.egg/turbogears/visit/savisit.py", line 42, in visit_for_key
> if not visit or visit.expiry < now:
> TypeError: can't compare offset-naive and offset-aware datetimes
New description:
Hi guys,
I've been experimenting a bit with TG 1.0b1 and PostgreSQL, and I've found
a problem with the standard Identity code (with SQLAlchemy).
SQLAlchemy causes all DateTime columns to be created in Postgres as a
"timestamptz" column - which, as the name implies, also contains the
timezone. So when SQLAlchemy return the data, we get a time-tuple, WITH
the timezone.
This causes problems, since the datetime.now() used in much of the SA
based identity code is timezone-naive. Thus, when I run the code, I get
this traceback:
{{{
raceback (most recent call last):
File "/usr/lib/python2.4/site-
packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cphttptools.py", line 103, in
_run
applyFilters('before_main')
File "/usr/lib/python2.4/site-
packages/CherryPy-2.2.1-py2.4.egg/cherrypy/filters/__init__.py", line 151,
in applyFilters
method()
File "/usr/lib/python2.4/site-packages/TurboGears-1.0b1-
py2.4.egg/turbogears/visit/api.py", line 140, in before_main
visit= _manager.visit_for_key( visit_key )
File "/usr/lib/python2.4/site-packages/TurboGears-1.0b1-
py2.4.egg/turbogears/visit/savisit.py", line 42, in visit_for_key
if not visit or visit.expiry < now:
TypeError: can't compare offset-naive and offset-aware datetimes
}}}
--
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1167>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---