diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-17 02:03:00 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-10-17 02:03:00 +0000 |
commit | 180d3741997c1471b9199334d6076e45cd581d62 (patch) | |
tree | de7b56896d440e375a10df1440f6cccec11047cc /lib/sqlalchemy/ext | |
parent | bc698d778d9bc8ddf2ee676fde24326f819da7dc (diff) | |
download | sqlalchemy-180d3741997c1471b9199334d6076e45cd581d62.tar.gz |
reorganizing classnames a bit, flagging "private" classes in the sql package,
getting the generated docs to look a little nicer.
fixes to extensions, sqlsoup etc. to be compatible with recent API tweaks
Diffstat (limited to 'lib/sqlalchemy/ext')
-rw-r--r-- | lib/sqlalchemy/ext/assignmapper.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/proxy.py | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/sqlsoup.py | 10 |
3 files changed, 11 insertions, 7 deletions
diff --git a/lib/sqlalchemy/ext/assignmapper.py b/lib/sqlalchemy/ext/assignmapper.py index 5b77052e2..e672d835e 100644 --- a/lib/sqlalchemy/ext/assignmapper.py +++ b/lib/sqlalchemy/ext/assignmapper.py @@ -1,9 +1,9 @@ -from sqlalchemy import mapper, util +from sqlalchemy import mapper, util, Query import types def monkeypatch_query_method(ctx, class_, name): def do(self, *args, **kwargs): - query = class_.mapper.query(session=ctx.current) + query = Query(class_, session=ctx.current) return getattr(query, name)(*args, **kwargs) setattr(class_, name, classmethod(do)) diff --git a/lib/sqlalchemy/ext/proxy.py b/lib/sqlalchemy/ext/proxy.py index 60972a6d5..c7e707f8d 100644 --- a/lib/sqlalchemy/ext/proxy.py +++ b/lib/sqlalchemy/ext/proxy.py @@ -4,11 +4,11 @@ except ImportError: from sqlalchemy.util import ThreadLocal as local from sqlalchemy import sql -from sqlalchemy.engine import create_engine +from sqlalchemy.engine import create_engine, Engine __all__ = ['BaseProxyEngine', 'AutoConnectEngine', 'ProxyEngine'] -class BaseProxyEngine(sql.Engine): +class BaseProxyEngine(sql.Executor): """Basis for all proxy engines.""" def get_engine(self): diff --git a/lib/sqlalchemy/ext/sqlsoup.py b/lib/sqlalchemy/ext/sqlsoup.py index be772555d..a16649573 100644 --- a/lib/sqlalchemy/ext/sqlsoup.py +++ b/lib/sqlalchemy/ext/sqlsoup.py @@ -252,10 +252,10 @@ class TableClassType(type): def update(cls, whereclause=None, values=None, **kwargs): cls._table.update(whereclause, values).execute(**kwargs) def __getattr__(cls, attr): - if attr == '_mapper': + if attr == '_query': # called during mapper init raise AttributeError() - return getattr(cls._mapper, attr) + return getattr(cls._query, attr) def _is_outer_join(selectable): @@ -273,7 +273,10 @@ def _selectable_name(selectable): elif isinstance(selectable, schema.Table): return selectable.name.capitalize() else: - return selectable.__class__.__name__ + x = selectable.__class__.__name__ + if x[0] == '_': + x = x[1:] + return x def class_for_table(selectable): if not hasattr(selectable, '_selectable') \ @@ -307,6 +310,7 @@ def class_for_table(selectable): selectable, extension=objectstore.mapper_extension, allow_null_pks=_is_outer_join(selectable)) + klass._query = Query(klass._mapper) return klass class SqlSoup: |