[user] Drop ugly hack on CWUser entity class
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 10 Mar 2017 17:58:25 +0100
changeset 12041 69f69ce8241a
parent 12040 e9682629df57
child 12042 5e64a98572de
[user] Drop ugly hack on CWUser entity class which should be not necessary anymore, beside two remaining usage in our own test suite.
cubicweb/entities/authobjs.py
cubicweb/server/test/unittest_querier.py
--- a/cubicweb/entities/authobjs.py	Fri Mar 10 17:57:13 2017 +0100
+++ b/cubicweb/entities/authobjs.py	Fri Mar 10 17:58:25 2017 +0100
@@ -173,14 +173,3 @@
         return self.login
 
     dc_long_title = name
-
-    def __call__(self, *args, **kwargs):
-        """ugly hack for compatibility betweeb dbapi and repo api
-
-        In the dbapi, Connection and Session have a ``user`` method to
-        generated a user for a request In the repo api, Connection and Session
-        have a user attribute inherited from SessionRequestBase prototype. This
-        ugly hack allows to not break user of the user method.
-
-        XXX Deprecate me ASAP"""
-        return self
--- a/cubicweb/server/test/unittest_querier.py	Fri Mar 10 17:57:13 2017 +0100
+++ b/cubicweb/server/test/unittest_querier.py	Fri Mar 10 17:58:25 2017 +0100
@@ -1146,7 +1146,7 @@
 
         self.assertRaises(QueryError,
                           self.qexecute,
-                          "INSERT CWUser X: X login 'toto', X eid %s" % cnx.user(self.session).eid)
+                          "INSERT CWUser X: X login 'toto', X eid %s" % cnx.user.eid)
 
     def test_insertion_description_with_where(self):
         rset = self.qexecute('INSERT CWUser E, EmailAddress EM: E login "X", E upassword "X", '
@@ -1338,7 +1338,7 @@
                           "WHERE X is Personne")
         self.assertRaises(QueryError,
                           self.qexecute,
-                          "SET X login 'tutu', X eid %s" % cnx.user(self.session).eid)
+                          "SET X login 'tutu', X eid %s" % cnx.user.eid)
 
 
     # HAVING on write queries test #############################################