def __MakeCallDone(self): self.__state = RPC.FINISHING self.cpu_usage_mcycles = self.__result_dict['cpu_usage_mcycles'] if self.__result_dict['error'] == APPLICATION_ERROR: self.__exception = apiproxy_errors.ApplicationError( self.__result_dict['application_error'], self.__result_dict['error_detail']) elif self.__result_dict['error'] == CAPABILITY_DISABLED: if self.__result_dict['error_detail']: self.__exception = apiproxy_errors.CapabilityDisabledError( self.__result_dict['error_detail']) else: self.__exception = apiproxy_errors.CapabilityDisabledError( "The API call %s.%s() is temporarily unavailable." % (self.package, self.call)) elif self.__result_dict['error'] == FEATURE_DISABLED: self.__exception = apiproxy_errors.FeatureNotEnabledError( self.__result_dict['error_detail']) elif self.__result_dict['error'] in _ExceptionsMap: exception_entry = _ExceptionsMap[self.__result_dict['error']] self.__exception = exception_entry[0](exception_entry[1] % (self.package, self.call)) else: try: self.response.ParseFromString( self.__result_dict['result_string']) except Exception, e: self.__exception = e
def _MakeCallDone(self): self._state = RPC.FINISHING self.cpu_usage_mcycles = self._result_dict['cpu_usage_mcycles'] if self._result_dict['error'] == APPLICATION_ERROR: appl_err = self._result_dict['application_error'] if appl_err == MEMCACHE_UNAVAILABLE and self.package == 'memcache': self._exception = apiproxy_errors.CapabilityDisabledError( 'The memcache service is temporarily unavailable. %s' % self._result_dict['error_detail']) else: self._exception = apiproxy_errors.ApplicationError( appl_err, self._result_dict['error_detail']) elif self._result_dict['error'] == CAPABILITY_DISABLED: if self._result_dict['error_detail']: self._exception = apiproxy_errors.CapabilityDisabledError( self._result_dict['error_detail']) else: self._exception = apiproxy_errors.CapabilityDisabledError( "The API call %s.%s() is temporarily unavailable." % (self.package, self.call)) elif self._result_dict['error'] == FEATURE_DISABLED: self._exception = apiproxy_errors.FeatureNotEnabledError( self._result_dict['error_detail']) elif self._result_dict['error'] == OVER_QUOTA: if self._result_dict['error_detail']: self._exception = apiproxy_errors.OverQuotaError(( 'The API call %s.%s() required more quota than is available. %s' % (self.package, self.call, self._result_dict['error_detail']))) else: exception_entry = _ExceptionsMap[self._result_dict['error']] self._exception = exception_entry[0](exception_entry[1] % (self.package, self.call)) elif self._result_dict['error'] in _ExceptionsMap: exception_entry = _ExceptionsMap[self._result_dict['error']] self._exception = exception_entry[0](exception_entry[1] % (self.package, self.call)) else: try: self.response.ParseFromString( self._result_dict['result_string']) except Exception, e: self._exception = e
def _Dynamic_DeleteIndex(self, index, void): raise apiproxy_errors.CapabilityDisabledError( 'The remote datastore does not support index manipulation.')
def _Dynamic_CreateIndex(self, index, id_response): raise apiproxy_errors.CapabilityDisabledError( 'The remote datastore does not support index manipulation.')
def _Dynamic_Usage(self, unused_request, unused_response, unused_request_id): raise apiproxy_errors.CapabilityDisabledError( 'Usage not allowed in tests.')
def _Dynamic_Usage(self, request, response): """Dummy method for compatibility.""" raise apiproxy_errors.CapabilityDisabledError('Usage not allowed in tests.')
def _Unavailable(self): raise apiproxy_errors.CapabilityDisabledError('some error')
def MakeSyncCall(self, service, call, request, response): if ((service, '*') in self.disabled_capabilities or (service, call) in self.disabled_methods): raise apiproxy_errors.CapabilityDisabledError() self.wrapped_stub.MakeSyncCall(service, call, request, response)