[dbapi] retire repo.[gs]et_shared_data which were used by the dbapi

Related to #3933480

authorJulien Cristau <julien.cristau@logilab.fr>
changeset28db21e0c8e5
branchdefault
phasepublic
hiddenno
parent revision#57c5ec22922d [dbapi] retire repository transaction methods which were used by the dbapi
child revision#878687804004 [shared data] remove get/set_shared_data api, #ef54ea75a642 [server] drop repo.internal_session and InternalSession
files modified by this revision
server/repository.py
server/test/unittest_repository.py
# HG changeset patch
# User Julien Cristau <julien.cristau@logilab.fr>
# Date 1429717527 -7200
# Wed Apr 22 17:45:27 2015 +0200
# Node ID 28db21e0c8e5e36f9710b80e88d12986287007a2
# Parent 57c5ec22922d2880e5265e8bdb1360468da3c2b7
[dbapi] retire repo.[gs]et_shared_data which were used by the dbapi

Related to #3933480

diff --git a/server/repository.py b/server/repository.py
@@ -668,34 +668,10 @@
1          """raise `BadConnectionId` if the connection is no more valid, else
2          return its latest activity timestamp.
3          """
4          return self._get_session(sessionid, setcnxset=False).timestamp
5 
6 -    @deprecated('[3.19] use session or transaction data')
7 -    def get_shared_data(self, sessionid, key, default=None, pop=False, txdata=False):
8 -        """return value associated to key in the session's data dictionary or
9 -        session's transaction's data if `txdata` is true.
10 -
11 -        If pop is True, value will be removed from the dictionary.
12 -
13 -        If key isn't defined in the dictionary, value specified by the
14 -        `default` argument will be returned.
15 -        """
16 -        session = self._get_session(sessionid, setcnxset=False)
17 -        return session.get_shared_data(key, default, pop, txdata)
18 -
19 -    @deprecated('[3.19] use session or transaction data')
20 -    def set_shared_data(self, sessionid, key, value, txdata=False):
21 -        """set value associated to `key` in shared data
22 -
23 -        if `txdata` is true, the value will be added to the repository session's
24 -        transaction's data which are cleared on commit/rollback of the current
25 -        transaction.
26 -        """
27 -        session = self._get_session(sessionid, setcnxset=False)
28 -        session.set_shared_data(key, value, txdata)
29 -
30      def close(self, sessionid, txid=None, checkshuttingdown=True):
31          """close the session with the given id"""
32          session = self._get_session(sessionid, txid=txid,
33                                      checkshuttingdown=checkshuttingdown)
34          # operation uncommited before close are rolled back before hook is called
diff --git a/server/test/unittest_repository.py b/server/test/unittest_repository.py
@@ -146,30 +146,10 @@
35          repo = self.repo
36          cnxid = repo.connect(self.admlogin, password=self.admpassword)
37          self.assert_(cnxid)
38          repo.close(cnxid)
39 
40 -    def test_shared_data(self):
41 -        repo = self.repo
42 -        cnxid = repo.connect(self.admlogin, password=self.admpassword)
43 -        repo.set_shared_data(cnxid, 'data', 4)
44 -        cnxid2 = repo.connect(self.admlogin, password=self.admpassword)
45 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), 4)
46 -        self.assertEqual(repo.get_shared_data(cnxid2, 'data'), None)
47 -        repo.set_shared_data(cnxid2, 'data', 5)
48 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), 4)
49 -        self.assertEqual(repo.get_shared_data(cnxid2, 'data'), 5)
50 -        repo.get_shared_data(cnxid2, 'data', pop=True)
51 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), 4)
52 -        self.assertEqual(repo.get_shared_data(cnxid2, 'data'), None)
53 -        repo.close(cnxid)
54 -        repo.close(cnxid2)
55 -        self.assertRaises(BadConnectionId, repo.get_shared_data, cnxid, 'data')
56 -        self.assertRaises(BadConnectionId, repo.get_shared_data, cnxid2, 'data')
57 -        self.assertRaises(BadConnectionId, repo.set_shared_data, cnxid, 'data', 1)
58 -        self.assertRaises(BadConnectionId, repo.set_shared_data, cnxid2, 'data', 1)
59 -
60      def test_check_session(self):
61          repo = self.repo
62          cnxid = repo.connect(self.admlogin, password=self.admpassword)
63          self.assertIsInstance(repo.check_session(cnxid), float)
64          repo.close(cnxid)
@@ -234,23 +214,10 @@
65                                                                'use-cwuri-as-url': False}
66                                                    })
67          # .properties() return a result set
68          self.assertEqual(self.repo.properties().rql, 'Any K,V WHERE P is CWProperty,P pkey K, P value V, NOT P for_user U')
69 
70 -    def test_shared_data_api(self):
71 -        repo = self.repo
72 -        cnxid = repo.connect(self.admlogin, password=self.admpassword)
73 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), None)
74 -        repo.set_shared_data(cnxid, 'data', 4)
75 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), 4)
76 -        repo.get_shared_data(cnxid, 'data', pop=True)
77 -        repo.get_shared_data(cnxid, 'whatever', pop=True)
78 -        self.assertEqual(repo.get_shared_data(cnxid, 'data'), None)
79 -        repo.close(cnxid)
80 -        self.assertRaises(BadConnectionId, repo.set_shared_data, cnxid, 'data', 0)
81 -        self.assertRaises(BadConnectionId, repo.get_shared_data, cnxid, 'data')
82 -
83      def test_schema_is_relation(self):
84          with self.admin_access.repo_cnx() as cnx:
85              no_is_rset = cnx.execute('Any X WHERE NOT X is ET')
86              self.assertFalse(no_is_rset, no_is_rset.description)
87