Commits

Mike Bayer committed 976ca95

added count/count_by to assignmapper, plus a test in activemapper to try it out

Comments (0)

Files changed (3)

 - 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

lib/sqlalchemy/ext/assignmapper.py

         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)

test/ext/activemapper.py

         )
         self.assertEquals(len(results), 1)
 
+        self.assertEquals(Person.count(), 2)
+        
 class testselfreferential(testbase.PersistTest):
     def setUpAll(self):
         global TreeNode