# HG changeset patch # User Sylvain Thénault # Date 1272462130 -7200 # Node ID 5ca1f8fe8a42407c1042db4a8b49419941d82ede # Parent 0d4853a6e5ee986c0584478102b1f37115af698a [dbapi] more test and documentation of dbapi diff -r 0d4853a6e5ee -r 5ca1f8fe8a42 dbapi.py --- a/dbapi.py Wed Apr 28 12:24:20 2010 +0200 +++ b/dbapi.py Wed Apr 28 15:42:10 2010 +0200 @@ -677,10 +677,11 @@ self._repo.rollback(self.sessionid) def cursor(self, req=None): - """Return a new Cursor Object using the connection. If the database - does not provide a direct cursor concept, the module will have to - emulate cursors using other means to the extent needed by this - specification. + """Return a new Cursor Object using the connection. + + On pyro connection, you should get cursor after calling if + load_appobjects method if desired (which you should call if you intend + to use ORM abilities). """ if self._closed is not None: raise ProgrammingError('Can\'t get cursor on closed connection') diff -r 0d4853a6e5ee -r 5ca1f8fe8a42 server/test/unittest_repository.py --- a/server/test/unittest_repository.py Wed Apr 28 12:24:20 2010 +0200 +++ b/server/test/unittest_repository.py Wed Apr 28 15:42:10 2010 +0200 @@ -295,11 +295,19 @@ cnx = connect(self.repo.config.appid, u'admin', password='gingkow', initlog=False) # don't reset logging configuration try: + cnx.load_appobjects(subpath=('entities',)) # check we can get the schema schema = cnx.get_schema() + self.failUnless(cnx.vreg) + self.failUnless('etypes'in cnx.vreg) self.assertEquals(schema.__hashmode__, None) cu = cnx.cursor() rset = cu.execute('Any U,G WHERE U in_group G') + user = iter(rset.entities()).next() + self.failUnless(user._cw) + self.failUnless(user._cw.vreg) + from cubicweb.entities import authobjs + self.assertIsInstance(user._cw.user, authobjs.CWUser) cnx.close() done.append(True) finally: