Perhaps the attached is a bit better?
Index: lib/sqlalchemy/schema.py =================================================================== --- lib/sqlalchemy/schema.py (revision 1679) +++ lib/sqlalchemy/schema.py (working copy) @@ -710,12 +710,12 @@ self.__engines[engine_or_url] = engine_or_url self.context._engine = engine_or_url def is_bound(self): - return self.context._engine is not None + return hasattr(self.context, '_engine') and self.context._engine is not None def dispose(self): """disposes all Engines to which this DynamicMetaData has been connected.""" for e in self.__engines.values(): e.dispose() - engine=property(lambda s:s.context._engine) + engine=property(lambda s:hasattr(s.context, '_engine') and s.context._engine or None) class SchemaVisitor(sql.ClauseVisitor): """defines the visiting for SchemaItem objects""" Index: lib/sqlalchemy/ext/activemapper.py =================================================================== --- lib/sqlalchemy/ext/activemapper.py (revision 1679) +++ lib/sqlalchemy/ext/activemapper.py (working copy) @@ -19,12 +19,14 @@ # # thread local SessionContext # -class Objectstore(SessionContext): - def __getattr__(self, key): - return getattr(self.current, key) - def get_session(self): - return self.current +class Objectstore(object): + def __init__(self, *args, **kwargs): + self._context = SessionContext(*args, **kwargs) + + def __getattr__(self, name): + return getattr(self._context.current, name) + objectstore = Objectstore(create_session) @@ -222,10 +224,10 @@ # check for inheritence if hasattr(bases[0], "mapping"): cls._base_mapper= bases[0].mapper - assign_mapper(objectstore, cls, cls.table, + assign_mapper(objectstore._context, cls, cls.table, inherits=cls._base_mapper) else: - assign_mapper(objectstore, cls, cls.table) + assign_mapper(objectstore._context, cls, cls.table) cls.relations = relations ActiveMapperMeta.classes[clsname] = cls
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users