On 9/11/06, Olli Wang <[EMAIL PROTECTED]> wrote: > > hi, folks. I just follow the doc "The Joy of SQLAlchemy" at > http://docs.turbogears.org/1.0/SQLAlchemy. Everything is ok if I > "tg-admin sql create" by default sqlite uri. But after I change the uri > to postgresql and create it(no error occurs), every page of the site > return a traceback: > > 500 Internal error > > The server encountered an unexpected condition which prevented it from > fulfilling the request. > > Traceback (most recent call last): > File > "c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py", > line 103, in _run > applyFilters('before_main') > File > "c:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy\filters\__init__.py", > line 151, in applyFilters > method() > File > "c:\python24\lib\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 > "c:\python24\lib\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 > > Is the postgresql not compatible with SA and TG? thanks
What version of SQLAlchemy are you using? If it's the SVN version, what revision? http://www.sqlalchemy.org/trac/ticket/275 is exactly this issue, and a sort-of fix was committed in SQLAlchemy revision 1824. I say a "sort-of" fix because this isn't exactly a bug; see the ticket for the gory details. The solution that was committed was to add a "timezone=True" (or "timezone=False") keyword parameter that you can pass when you create your DateTime fields, to tell PostgreSQL whether or not to return timezone information with the DateTime. It might be that the default TurboGears SQL creation functions for SQLAlchemy need to be updated to use the timezone=True (or timezone=False) keyword. Hopefully between this summarized explanation and the notes on that ticket, you'll be able to understand what's going on. Otherwise, I'll try to explain better when I have a little more time. -- Robin Munn [EMAIL PROTECTED] GPG key 0xD6497014 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" 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 -~----------~----~----~----~------~----~------~--~---

