summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/activemapper.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-07-01 15:30:33 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-07-01 15:30:33 +0000
commit6133dbee0914b9e2a80af1c323430493054ef45a (patch)
treec033c64e6f85bc83d3f901560edfb191e892672d /lib/sqlalchemy/ext/activemapper.py
parent6446bb1360d23bcf4500d7afe63cf84cd1957665 (diff)
downloadsqlalchemy-6133dbee0914b9e2a80af1c323430493054ef45a.tar.gz
some adjustments to activemapper's objectstore to be composed against SessionContext
DynamicMetaData checks first for _engine before returning
Diffstat (limited to 'lib/sqlalchemy/ext/activemapper.py')
-rw-r--r--lib/sqlalchemy/ext/activemapper.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/sqlalchemy/ext/activemapper.py b/lib/sqlalchemy/ext/activemapper.py
index 541bf7812..9fa183031 100644
--- a/lib/sqlalchemy/ext/activemapper.py
+++ b/lib/sqlalchemy/ext/activemapper.py
@@ -19,11 +19,13 @@ metadata = DynamicMetaData("activemapper")
#
# 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 @@ class ActiveMapperMeta(type):
# 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