diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-13 16:36:31 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2006-07-13 16:36:31 +0000 |
commit | 70469bf26092095590aa441f41f5bcde11968ffc (patch) | |
tree | d9602091007435bd4101e2fc13a2dd5704c2732f | |
parent | 2cb2b624f97a88df857777104cc0db6d733306ef (diff) | |
download | sqlalchemy-70469bf26092095590aa441f41f5bcde11968ffc.tar.gz |
added count/count_by to assignmapper, plus a test in activemapper to try it out
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | lib/sqlalchemy/ext/assignmapper.py | 2 | ||||
-rw-r--r-- | test/ext/activemapper.py | 2 |
3 files changed, 5 insertions, 1 deletions
@@ -9,6 +9,8 @@ activated when activemapper is imported - fixes to Session expunge/update/etc. - select_table mappers *still* werent always compiling - fixed up Boolean datatype +- added count()/count_by() to list of methods proxied by assignmapper; +this also adds them to activemapper 0.2.5 - fixed endless loop bug in select_by(), if the traversal hit diff --git a/lib/sqlalchemy/ext/assignmapper.py b/lib/sqlalchemy/ext/assignmapper.py index 29cc70b3e..240a46e3b 100644 --- a/lib/sqlalchemy/ext/assignmapper.py +++ b/lib/sqlalchemy/ext/assignmapper.py @@ -31,7 +31,7 @@ def assign_mapper(ctx, class_, *args, **kwargs): extension = ctx.mapper_extension m = mapper(class_, extension=extension, *args, **kwargs) class_.mapper = m - for name in ['get', 'select', 'select_by', 'selectone', 'get_by', 'join_to', 'join_via']: + for name in ['get', 'select', 'select_by', 'selectone', 'get_by', 'join_to', 'join_via', 'count', 'count_by']: monkeypatch_query_method(ctx, class_, name) for name in ['flush', 'delete', 'expire', 'refresh', 'expunge', 'merge', 'save', 'update', 'save_or_update']: monkeypatch_objectstore_method(ctx, class_, name) diff --git a/test/ext/activemapper.py b/test/ext/activemapper.py index 85466e29b..1ff8b0d7b 100644 --- a/test/ext/activemapper.py +++ b/test/ext/activemapper.py @@ -218,6 +218,8 @@ class testcase(testbase.PersistTest): ) self.assertEquals(len(results), 1) + self.assertEquals(Person.count(), 2) + class testselfreferential(testbase.PersistTest): def setUpAll(self): global TreeNode |