def _valueResponse(self, resID, value, callback): if resID < 0: LOG_ERROR( "[class %s] There is error while getting data from cache: %s[%d]" % (self.__class__.__name__, code2str(resID), resID) ) return callback(value) callback(value)
def _response(self, resID, value, callback=None): self.__synced = resID >= 0 if resID < 0: LOG_ERROR('There is error while getting data from cache', self.__class__.__name__, code2str(resID), resID) if callback is not None: callback(self._getDefaultDataValue()) elif callback is not None: callback(self._preprocessValidData(value)) return
def _response(self, code, callback, ctx = None, errStr = ''): """ Common server response handler. Call corresponded method for error or success cases. @param code: server response code @param callback: callback to be called """ if code < 0: LOG_ERROR("Server responses an error [%s] while process %s '%s'" % (code2str(code), self.item.itemTypeName, str(self.item))) return callback(self._errorHandler(code, ctx=ctx, errStr=errStr)) return callback(self._successHandler(code, ctx=ctx))
def __processValueResponse(self, callback, code, value): self.__setLastResponseTime() self.__request = None if code < 0: LOG_ERROR('Error while server request (code=%s): %s' % (code, code2str(code))) if code == AccountCommands.RES_HIDDEN_DOSSIER: self.__cache['hidden'] = True elif code == AccountCommands.RES_CENTER_DISCONNECTED: self.__cache['available'] = False callback('') else: callback(value) self.__processQueue()
def _response(self, resID, value, callback): """ Common server response method. Must be called ANYWAY after server operation will complete. @param resID: request result id @param value: requested value @param callback: function to be called after operation will complete """ if resID < 0: LOG_ERROR( '[class %s] There is error while getting data from cache: %s[%d]' % (self.__class__.__name__, code2str(resID), resID)) return callback(dict()) callback(value)
def _response(self, resID, value, callback): """ Common server response method. Must be called ANYWAY after server operation will complete. @param resID: request result id @param value: requested value @param callback: function to be called after operation will complete """ if resID < 0: LOG_ERROR( "[class %s] There is error while getting data from cache: %s[%d]" % (self.__class__.__name__, code2str(resID), resID) ) return callback(dict()) callback(value)
def _response(self, resID, value, callback = None): self.__synced = resID >= 0 if resID < 0: LOG_ERROR('There is error while getting data from cache', self.__class__.__name__, code2str(resID), resID) if callback is not None: callback(self._getDefaultDataValue()) elif callback is not None: callback(self._preprocessValidData(value)) return
def _response(self, code, callback, ctx = None, errStr = ''): if code < 0: LOG_ERROR("Server responses an error [%s] while process %s '%s'" % (code2str(code), self.booster.boosterGuiType, str(self.booster))) return callback(self._errorHandler(code, ctx=ctx, errStr=errStr)) return callback(self._successHandler(code, ctx=ctx))
def _response(self, resID, value, callback=None): _logger.debug('Response %r is received for requester %s', resID, self.__class__.__name__) self.__synced = resID >= 0 if resID < 0: _logger.error('There is error while getting data from cache: %r, %r, %r', self.__class__.__name__, code2str(resID), resID) if callback is not None: callback(self._getDefaultDataValue()) elif callback is not None: callback(self._preprocessValidData(value)) return
def _valueResponse(self, resID, value, callback): if resID < 0: LOG_ERROR('[class %s] There is error while getting data from cache: %s[%d]' % (self.__class__.__name__, code2str(resID), resID)) return callback(value) callback(value)
def _response(self, code, callback, ctx=None, errStr=''): if code < 0: _logger.error("Server responses an error [%s] while process %s '%s'", code2str(code), self.item.itemTypeName, str(self.item)) return callback(self._errorHandler(code, ctx=ctx, errStr=errStr)) return callback(self._successHandler(code, ctx=ctx))
def _callback(resultID): if not isCodeValid(resultID): _logger.error( 'Error occurred while trying to reset c11n items novelty, reason by resultId = %d: %s', resultID, code2str(resultID))