I had to change a few things in savisit.py to avoid errors early in
startup -- and then hit another issue which is a bit beyond my
understanding.

First, the patch:

Index: turbogears/visit/savisit.py
===================================================================
--- turbogears/visit/savisit.py (revision 1551)
+++ turbogears/visit/savisit.py (working copy)
@@ -2,6 +2,7 @@
 from datetime import *
 from turbogears.visit.api import BaseVisitManager, Visit
 from sqlalchemy import *
+from sqlalchemy.exceptions import SQLError
 from sqlalchemy.ext.activemapper import *

 import logging
@@ -54,20 +55,14 @@
             raise


-tbl__tgvisit = Table('tg_visit', __engine__,
-    Column('visit_key', String(40) , primary_key=True),
-    Column('created', DateTime  , nullable = False ),
-    Column('expiry', DateTime ),
-)
+class TG_Visit(ActiveMapper):
+    class mapping:
+        __table__ = "tg_visit"
+        visit_key = column(String(40), primary_key=True)
+        created = column(DateTime, nullable=False)
+        expiry = column(DateTime)

-
-class TG_Visit(object):
-    table = tbl__tgvisit
-
     def lookup_visit( cls, visit_key ):
         return TG_Visit.get( visit_key );
     lookup_visit= classmethod(lookup_visit)

-assign_mapper( TG_Visit , tbl__tgvisit )
-
-
===================================================================

Next, the remaining issue:

===================================================================
2006-06-14 07:09:04,187 turbogears.visit INFO Visit Tracking starting
2006-06-14 07:09:04,209 turbogears.visit INFO Visit filter initialised
Unhandled exception in thread started by <bound method Server._start of
<cherrypy._cpserver.Server object at 0x4046758c>>
Traceback (most recent call last):
  File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpserver.py",
line 78, in _start
    Engine._start(self)
  File
"/usr/lib/python2.4/site-packages/CherryPy-2.2.1-py2.4.egg/cherrypy/_cpengine.py",
line 108, in _start
    func()
  File "/home/ccd/VC/svn/turbogears/turbogears/startup.py", line 219,
in startTurboGears
    ext.start_extension()
  File "/home/ccd/VC/svn/turbogears/turbogears/visit/api.py", line 68,
in start_extension
    create_extension_model()
  File "/home/ccd/VC/svn/turbogears/turbogears/visit/api.py", line 87,
in create_extension_model
    _manager.create_model()
  File "/home/ccd/VC/svn/turbogears/turbogears/visit/savisit.py", line
20, in create_model
    TG_Visit.table.create()
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.2-py2.4.egg/sqlalchemy/schema.py",
line 230, in create
    self.engine.create(self)
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.2-py2.4.egg/sqlalchemy/schema.py",
line 41, in <lambda>
    engine = property(lambda s:s._get_engine())
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.2-py2.4.egg/sqlalchemy/schema.py",
line 40, in _get_engine
    return self._derived_metadata().engine
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.2-py2.4.egg/sqlalchemy/schema.py",
line 712, in <lambda>
    engine=property(lambda s:s.context._engine)
  File
"/usr/lib/python2.4/site-packages/SQLAlchemy-0.2.2-py2.4.egg/sqlalchemy/util.py",
line 177, in __getattr__
    raise AttributeError(key)
AttributeError: _engine
===================================================================

Is someone else working on this (ie. with an accessible branch of TG
which has some of these issues already worked out)? I don't mind poking
around or doing simple fixes, but I don't understand (yet) how TG is
supposed to specify the engine to use to SQLAlchemy, and without
understanding the intended process I'm hesitant to try to just hack
something into place.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to