Commit 28f21119 authored by Aurelien Campeas's avatar Aurelien Campeas
Browse files

[session] fix super call in Connection.__init__

The vile hacks in test fixtures are fixed.
parent 2fe2077cc92d
...@@ -254,8 +254,7 @@ class Connection(RequestSessionBase): ...@@ -254,8 +254,7 @@ class Connection(RequestSessionBase):
is_repo_in_memory = True # bw compat is_repo_in_memory = True # bw compat
def __init__(self, session): def __init__(self, session):
# using super(Connection, self) confuse some test hack super(Connection, self).__init__(session.repo.vreg)
RequestSessionBase.__init__(self, session.vreg)
#: connection unique id #: connection unique id
self._open = None self._open = None
self.connectionid = '%s-%s' % (session.sessionid, uuid4().hex) self.connectionid = '%s-%s' % (session.sessionid, uuid4().hex)
......
...@@ -21,8 +21,7 @@ from six import text_type ...@@ -21,8 +21,7 @@ from six import text_type
from cubicweb import ValidationError from cubicweb import ValidationError
from cubicweb.devtools.testlib import CubicWebTC from cubicweb.devtools.testlib import CubicWebTC
import cubicweb.server.session from cubicweb.server.session import Connection
from cubicweb.server.session import Connection as OldConnection
from cubicweb.server.sources.native import UndoTransactionException, _UndoException from cubicweb.server.sources.native import UndoTransactionException, _UndoException
...@@ -42,15 +41,13 @@ class UndoableTransactionTC(CubicWebTC): ...@@ -42,15 +41,13 @@ class UndoableTransactionTC(CubicWebTC):
return cnx.entity_from_eid(self.totoeid) return cnx.entity_from_eid(self.totoeid)
def setUp(self): def setUp(self):
class Connection(OldConnection): # Force undo feature to be turned on
"""Force undo feature to be turned on in all case""" Connection.undo_actions = property(lambda self: True, lambda self, v:None)
undo_actions = property(lambda tx: True, lambda x, y:None)
cubicweb.server.session.Connection = Connection
super(UndoableTransactionTC, self).setUp() super(UndoableTransactionTC, self).setUp()
def tearDown(self): def tearDown(self):
cubicweb.server.session.Connection = OldConnection
super(UndoableTransactionTC, self).tearDown() super(UndoableTransactionTC, self).tearDown()
del Connection.undo_actions
def check_transaction_deleted(self, cnx, txuuid): def check_transaction_deleted(self, cnx, txuuid):
# also check transaction actions have been properly deleted # also check transaction actions have been properly deleted
......
...@@ -33,7 +33,7 @@ from cubicweb.utils import json_dumps ...@@ -33,7 +33,7 @@ from cubicweb.utils import json_dumps
from cubicweb.uilib import rql_for_eid from cubicweb.uilib import rql_for_eid
from cubicweb.web import Redirect, RemoteCallFailed from cubicweb.web import Redirect, RemoteCallFailed
import cubicweb.server.session import cubicweb.server.session
from cubicweb.server.session import Connection as OldConnection from cubicweb.server.session import Connection
from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes from cubicweb.web.views.autoform import get_pending_inserts, get_pending_deletes
from cubicweb.web.views.basecontrollers import JSonController, xhtmlize, jsonize from cubicweb.web.views.basecontrollers import JSonController, xhtmlize, jsonize
from cubicweb.web.views.ajaxcontroller import ajaxfunc, AjaxFunction from cubicweb.web.views.ajaxcontroller import ajaxfunc, AjaxFunction
...@@ -1013,15 +1013,13 @@ class JSonControllerTC(AjaxControllerTC): ...@@ -1013,15 +1013,13 @@ class JSonControllerTC(AjaxControllerTC):
class UndoControllerTC(CubicWebTC): class UndoControllerTC(CubicWebTC):
def setUp(self): def setUp(self):
class Connection(OldConnection): # Force undo feature to be turned on
"""Force undo feature to be turned on in all case""" Connection.undo_actions = property(lambda self: True, lambda self, v:None)
undo_actions = property(lambda tx: True, lambda x, y:None)
cubicweb.server.session.Connection = Connection
super(UndoControllerTC, self).setUp() super(UndoControllerTC, self).setUp()
def tearDown(self): def tearDown(self):
super(UndoControllerTC, self).tearDown() super(UndoControllerTC, self).tearDown()
cubicweb.server.session.Connection = OldConnection del Connection.undo_actions
def setup_database(self): def setup_database(self):
with self.admin_access.repo_cnx() as cnx: with self.admin_access.repo_cnx() as cnx:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment