[shared data] remove get/set_shared_data api

It was redundant with session_data and transaction_data and costly to maintain.

Closes #3938370.

authorAurelien Campeas <aurelien.campeas@logilab.fr>
changeset878687804004
branchdefault
phasedraft
hiddenyes
parent revision#28db21e0c8e5 [dbapi] retire repo.[gs]et_shared_data which were used by the dbapi
child revision#dde4683cc9b9 [repoapi,session] remove all session-as-cnx backward compat
files modified by this revision
doc/3.21.rst
repoapi.py
server/session.py
web/request.py
# HG changeset patch
# User Aurelien Campeas <aurelien.campeas@logilab.fr>
# Date 1401813425 -7200
# Tue Jun 03 18:37:05 2014 +0200
# Node ID 8786878040047fd548c8921f2da809715217c29e
# Parent 28db21e0c8e5e36f9710b80e88d12986287007a2
[shared data] remove get/set_shared_data api

It was redundant with session_data and transaction_data
and costly to maintain.

Closes #3938370.

diff --git a/doc/3.21.rst b/doc/3.21.rst
@@ -27,10 +27,13 @@
1  ---------------------
2 
3  * the user_callback api has been removed; people should use plain
4    ajax functions instead
5 
6 +* the get/set_shared_data api has been removed; people should use
7 +  transaction_data or session_data instead
8 +
9  * the `Pyro` and `Zmq-pickle` remote repository access methods have
10    been entirely removed (emerging alternatives such as rqlcontroller
11    and cwclientlib should be used instead).  Note that as a side effect,
12    "repository-only" instances (i.e. without a http component) are no
13    longer possible.  If you have any such instances, you will need to
diff --git a/repoapi.py b/repoapi.py
@@ -215,13 +215,10 @@
14 
15      system_sql = _srv_cnx_func('system_sql')
16 
17      # session data methods #####################################################
18 
19 -    get_shared_data = _srv_cnx_func('get_shared_data')
20 -    set_shared_data = _srv_cnx_func('set_shared_data')
21 -
22      @property
23      def transaction_data(self):
24          return self._cnx.transaction_data
25 
26      # meta-data accessors ######################################################
diff --git a/server/session.py b/server/session.py
@@ -545,32 +545,10 @@
27 
28      @property
29      def rql_rewriter(self):
30          return self._rewriter
31 
32 -    @_open_only
33 -    @deprecated('[3.19] use session or transaction data', stacklevel=3)
34 -    def get_shared_data(self, key, default=None, pop=False, txdata=False):
35 -        """return value associated to `key` in session data"""
36 -        if txdata:
37 -            data = self.transaction_data
38 -        else:
39 -            data = self._session_data
40 -        if pop:
41 -            return data.pop(key, default)
42 -        else:
43 -            return data.get(key, default)
44 -
45 -    @_open_only
46 -    @deprecated('[3.19] use session or transaction data', stacklevel=3)
47 -    def set_shared_data(self, key, value, txdata=False):
48 -        """set value associated to `key` in session data"""
49 -        if txdata:
50 -            self.transaction_data[key] = value
51 -        else:
52 -            self._session_data[key] = value
53 -
54      def clear(self):
55          """reset internal data"""
56          self.transaction_data = {}
57          #: ordered list of operations to be processed on commit/rollback
58          self.pending_operations = []
@@ -1264,12 +1242,10 @@
59        containing some shared data that should be cleared at the end of the
60        connection. Hooks and operations may put arbitrary data in there, and
61        this may also be used as a communication channel between the client and
62        the repository.
63 
64 -    .. automethod:: cubicweb.server.session.Session.get_shared_data
65 -    .. automethod:: cubicweb.server.session.Session.set_shared_data
66      .. automethod:: cubicweb.server.session.Session.added_in_transaction
67      .. automethod:: cubicweb.server.session.Session.deleted_in_transaction
68 
69      Connection state information:
70 
@@ -1557,32 +1533,10 @@
71      def local_perm_cache(self, value):
72          #base class assign an empty dict:-(
73          assert value == {}
74          pass
75 
76 -    # shared data handling ###################################################
77 -
78 -    @deprecated('[3.19] use session or transaction data')
79 -    def get_shared_data(self, key, default=None, pop=False, txdata=False):
80 -        """return value associated to `key` in session data"""
81 -        if txdata:
82 -            return self._cnx.get_shared_data(key, default, pop, txdata=True)
83 -        else:
84 -            data = self.data
85 -        if pop:
86 -            return data.pop(key, default)
87 -        else:
88 -            return data.get(key, default)
89 -
90 -    @deprecated('[3.19] use session or transaction data')
91 -    def set_shared_data(self, key, value, txdata=False):
92 -        """set value associated to `key` in session data"""
93 -        if txdata:
94 -            return self._cnx.set_shared_data(key, value, txdata=True)
95 -        else:
96 -            self.data[key] = value
97 -
98      # server-side service call #################################################
99 
100      call_service = cnx_meth('call_service')
101 
102      # request interface #######################################################
diff --git a/web/request.py b/web/request.py
@@ -1024,12 +1024,10 @@
103              self._ = self.__ = unicode
104              self.pgettext = lambda x, y: unicode(y)
105 
106      entity_metas = _cnx_func('entity_metas')
107      source_defs = _cnx_func('source_defs')
108 -    get_shared_data = _cnx_func('get_shared_data')
109 -    set_shared_data = _cnx_func('set_shared_data')
110      describe = _cnx_func('describe') # deprecated XXX
111 
112      # security #################################################################
113 
114      security_enabled = _cnx_func('security_enabled')