Kevin Dangoor wrote:
> I should have made my messages clearer that I was actively working on 
> this code still. I, too, have moved the visit class out of 
> turbogears.visit.savisit. I've done a bunch of other things, as well. 
> I'm just in the process of working through the bugs before I commit. 
> I'm going to try to commit before I go to sleep...

A few remaining issues in r1603: There's no engine for the VisitManager 
thread. It should be noted that we're using the default ActiveMapper 
metadata (which is a DynamicMetaData and thus uses thread-local 
engines). Without patching SQLAlchemy, the stack trace looks like so:

2006-06-30 05:37:41,715 turbogears.identity.savisit INFO updating visit 
(d76dd851bb5cc3ecd188faf50c8637196fe6cc6e) to expire at 2006-06-30 
05:57:33.582428
Exception in thread VisitManager:
Traceback (most recent call last):
File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/home/ccd/VC/svn/turbogears-1.0/turbogears/visit/api.py", line 
256, in run
self.update_queued_visits(queue)
File "/home/ccd/VC/svn/turbogears-1.0/turbogears/visit/savisit.py", line 
53, in update_queued_visits
values={'expiry': expiry}).execute()
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 514, in 
execute
return self.execute_using(self.engine, *multiparams, **params)
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 461, in 
<lambda>
engine = property(lambda s: s._find_engine(), doc="attempts to locate a 
Engine within this ClauseElement structure, or returns None if none found.")
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 1585, in 
_find_engine
return self.table.engine
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/schema.py", line 41, in 
<lambda>
engine = property(lambda s:s._get_engine())
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/schema.py", line 40, in 
_get_engine
return self._derived_metadata().engine
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/schema.py", line 718, 
in <lambda>
engine=property(lambda s:s.context._engine)
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/util.py", line 189, in 
__getattr__
raise AttributeError(key)
AttributeError: _engine

...this is due to a bug (DynamicMetaData.engine should return None if 
there is no engine rather than crashing); with that patched, it looks 
like so:

2006-06-30 06:15:24,625 turbogears.identity.savisit INFO updating visit 
(3605ad7bf9426eea0876b3f7942da413c97ddf36) to expire at 2006-06-30 
06:35:00.169648
Exception in thread VisitManager:
Traceback (most recent call last):
File "/usr/lib/python2.4/threading.py", line 442, in __bootstrap
self.run()
File "/home/ccd/VC/svn/turbogears-1.0/turbogears/visit/api.py", line 
256, in run
self.update_queued_visits(queue)
File "/home/ccd/VC/svn/turbogears-1.0/turbogears/visit/savisit.py", line 
54, in update_queued_visits
values={'expiry': expiry}).execute()
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 514, in 
execute
return self.execute_using(self.engine, *multiparams, **params)
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 468, in 
execute_using
return self.compile(engine=engine, 
parameters=compile_params).execute(*multiparams, **params)
File "/home/ccd/VC/svn/sqlalchemy/lib/sqlalchemy/sql.py", line 374, in 
execute
raise exceptions.InvalidRequestError("This Compiled object is not bound 
to any engine.")
InvalidRequestError: This Compiled object is not bound to any engine

I'm not familiar enough with correct use of DynamicMetaData (which 
maintains thread-local engine corrections) to know how to resolve this 
properly; in my project, I've historically overwritten 
activemapper.metadata with a BoundMetaData instance at the top of my 
model.py, but this arguably isn't The Right Thing when using 
non-threadsafe engines.

Also, when running the quickstart, tables associated with Visit and 
friends used to be created automatically, but no longer are. My solution 
has been to create *everything* automatically by adding a 
metadata.create_all() call to the end of the generated model.py; any 
issues with that?

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