server/session.py
changeset 9721 2f08bd4c813b
parent 9707 4a23058e4d9f
child 9764 e81facdef9b5
equal deleted inserted replaced
9720:a7210c912507 9721:2f08bd4c813b
    21 import sys
    21 import sys
    22 import threading
    22 import threading
    23 from time import time
    23 from time import time
    24 from uuid import uuid4
    24 from uuid import uuid4
    25 from warnings import warn
    25 from warnings import warn
    26 import json
       
    27 import functools
    26 import functools
    28 from contextlib import contextmanager
    27 from contextlib import contextmanager
    29 
    28 
    30 from logilab.common.deprecation import deprecated
    29 from logilab.common.deprecation import deprecated
    31 from logilab.common.textutils import unormalize
    30 from logilab.common.textutils import unormalize
  1152     # resource accessors ######################################################
  1151     # resource accessors ######################################################
  1153 
  1152 
  1154     @_with_cnx_set
  1153     @_with_cnx_set
  1155     @_open_only
  1154     @_open_only
  1156     def call_service(self, regid, **kwargs):
  1155     def call_service(self, regid, **kwargs):
  1157         json.dumps(kwargs) # This line ensure that people use serialisable
  1156         self.debug('calling service %s', regid)
  1158                            # argument for call service. this is very important
       
  1159                            # to enforce that from start to make sure RPC
       
  1160                            # version is available.
       
  1161         self.info('calling service %s', regid)
       
  1162         service = self.vreg['services'].select(regid, self, **kwargs)
  1157         service = self.vreg['services'].select(regid, self, **kwargs)
  1163         result = service.call(**kwargs)
  1158         return service.call(**kwargs)
  1164         json.dumps(result) # This line ensure that service have serialisable
       
  1165                            # output. this is very important to enforce that
       
  1166                            # from start to make sure RPC version is
       
  1167                            # available.
       
  1168         return result
       
  1169 
  1159 
  1170     @_with_cnx_set
  1160     @_with_cnx_set
  1171     @_open_only
  1161     @_open_only
  1172     def system_sql(self, sql, args=None, rollback_on_failure=True):
  1162     def system_sql(self, sql, args=None, rollback_on_failure=True):
  1173         """return a sql cursor on the system database"""
  1163         """return a sql cursor on the system database"""