[service] split session retrieval and service execution stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 02 Apr 2013 15:11:41 +0200
branchstable
changeset 8839 49eb84b80b96
parent 8838 27393e484974
child 8848 08bb2dd18fd2
child 8862 8011ca5d2841
[service] split session retrieval and service execution Internal session are not tracker by the repository and can not be retrieved using _getsession. Moreover their session id is not unique… Closes #2735700
server/repository.py
server/session.py
--- a/server/repository.py	Tue Apr 02 15:11:21 2013 +0200
+++ b/server/repository.py	Tue Apr 02 15:11:41 2013 +0200
@@ -883,6 +883,9 @@
         and :class:`cubicweb.server.Service`
         """
         session = self._get_session(sessionid)
+        return self._call_service_with_session(session, regid, async, **kwargs)
+
+    def _call_service_with_session(self, session, regid, async, **kwargs):
         if async:
             self.info('calling service %s asynchronously', regid)
             def task():
--- a/server/session.py	Tue Apr 02 15:11:21 2013 +0200
+++ b/server/session.py	Tue Apr 02 15:11:41 2013 +0200
@@ -808,7 +808,8 @@
     # server-side service call #################################################
 
     def call_service(self, regid, async=False, **kwargs):
-        return self.repo.call_service(self.id, regid, async, **kwargs)
+        return self.repo._call_service_with_session(self, regid, async,
+                                                    **kwargs)
 
 
     # request interface #######################################################