417 @nocoverage |
417 @nocoverage |
418 def cursor(self, req=None): |
418 def cursor(self, req=None): |
419 return self.cnx.cursor(req or self.request()) |
419 return self.cnx.cursor(req or self.request()) |
420 |
420 |
421 @nocoverage |
421 @nocoverage |
422 def execute(self, rql, args=None, eidkey=None, req=None): |
422 def execute(self, rql, args=None, req=None): |
423 """executes <rql>, builds a resultset, and returns a couple (rset, req) |
423 """executes <rql>, builds a resultset, and returns a couple (rset, req) |
424 where req is a FakeRequest |
424 where req is a FakeRequest |
425 """ |
425 """ |
426 if eidkey is not None: |
|
427 warn('[3.8] eidkey is deprecated, you can safely remove this argument', |
|
428 DeprecationWarning, stacklevel=2) |
|
429 req = req or self.request(rql=rql) |
426 req = req or self.request(rql=rql) |
430 return req.execute(unicode(rql), args) |
427 return req.execute(unicode(rql), args) |
431 |
428 |
432 @nocoverage |
429 @nocoverage |
433 def commit(self): |
430 def commit(self): |
445 finally: |
442 finally: |
446 self.session.set_cnxset() # ensure cnxset still set after commit |
443 self.session.set_cnxset() # ensure cnxset still set after commit |
447 |
444 |
448 # server side db api ####################################################### |
445 # server side db api ####################################################### |
449 |
446 |
450 def sexecute(self, rql, args=None, eid_key=None): |
447 def sexecute(self, rql, args=None): |
451 if eid_key is not None: |
|
452 warn('[3.8] eid_key is deprecated, you can safely remove this argument', |
|
453 DeprecationWarning, stacklevel=2) |
|
454 self.session.set_cnxset() |
448 self.session.set_cnxset() |
455 return self.session.execute(rql, args) |
449 return self.session.execute(rql, args) |
456 |
450 |
457 # other utilities ######################################################### |
451 # other utilities ######################################################### |
458 |
452 |
983 sent_to.update(msg.recipients) |
977 sent_to.update(msg.recipients) |
984 self.assertSetEqual(set(recipients), sent_to) |
978 self.assertSetEqual(set(recipients), sent_to) |
985 if nb_msgs is not None: |
979 if nb_msgs is not None: |
986 self.assertEqual(len(MAILBOX), nb_msgs) |
980 self.assertEqual(len(MAILBOX), nb_msgs) |
987 return messages |
981 return messages |
988 |
|
989 # deprecated ############################################################### |
|
990 |
|
991 @deprecated('[3.8] use self.execute(...).get_entity(0, 0)') |
|
992 def entity(self, rql, args=None, eidkey=None, req=None): |
|
993 if eidkey is not None: |
|
994 warn('[3.8] eidkey is deprecated, you can safely remove this argument', |
|
995 DeprecationWarning, stacklevel=2) |
|
996 return self.execute(rql, args, req=req).get_entity(0, 0) |
|
997 |
982 |
998 |
983 |
999 # auto-populating test classes and utilities ################################### |
984 # auto-populating test classes and utilities ################################### |
1000 |
985 |
1001 from cubicweb.devtools.fill import insert_entity_queries, make_relations_queries |
986 from cubicweb.devtools.fill import insert_entity_queries, make_relations_queries |