コード例 #1
0
ファイル: clancache.py プロジェクト: webiumsk/WOT-0.9.12-CT
 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)
コード例 #2
0
ファイル: requestersabstract.py プロジェクト: Difrex/wotsdk
 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
コード例 #3
0
ファイル: __init__.py プロジェクト: webiumsk/WOT0.9.10
 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))
コード例 #4
0
ファイル: __init__.py プロジェクト: mahmoudimus/WOT-0.9.20.0
 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))
コード例 #5
0
ファイル: dossierrequester.py プロジェクト: kblw/wot_client
 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()
コード例 #6
0
 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()
コード例 #7
0
 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)
コード例 #8
0
 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)
コード例 #9
0
ファイル: abstract.py プロジェクト: webiumsk/WOT0.10.0
 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
コード例 #10
0
ファイル: processorsgoodies.py プロジェクト: Difrex/wotsdk
 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))
コード例 #11
0
 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
コード例 #12
0
ファイル: ClanCache.py プロジェクト: mahmoudimus/WOT-0.9.20.0
 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)
コード例 #13
0
 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))
コード例 #14
0
 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))