comparison Sources/RestCallbacks.cpp @ 171:c8de83fe7faa

removed deprecation warnings
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Jun 2024 15:52:51 +0200
parents 6fada29b6759
children 3757a7b9e6f1
comparison
equal deleted inserted replaced
170:b49eeb36cd0d 171:c8de83fe7faa
183 (*it)->GetCallback(), args2.GetPyObject(), kw.GetPyObject())); 183 (*it)->GetCallback(), args2.GetPyObject(), kw.GetPyObject()));
184 184
185 std::string traceback; 185 std::string traceback;
186 if (lock.HasErrorOccurred(traceback)) 186 if (lock.HasErrorOccurred(traceback))
187 { 187 {
188 OrthancPlugins::LogError("Error in the REST callback, traceback:\n" + traceback); 188 ORTHANC_PLUGINS_LOG_ERROR("Error in the REST callback, traceback:\n" + traceback);
189 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin); 189 ORTHANC_PLUGINS_THROW_EXCEPTION(Plugin);
190 } 190 }
191 191
192 return; 192 return;
193 } 193 }
194 } 194 }
195 195
196 // Should never happen 196 // Should never happen
197 OrthancPlugins::LogError("Unable to find the Python handler for URI: " + std::string(uri)); 197 ORTHANC_PLUGINS_LOG_ERROR("Unable to find the Python handler for URI: " + std::string(uri));
198 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError); 198 ORTHANC_PLUGINS_THROW_EXCEPTION(InternalError);
199 } 199 }
200 200
201 201
202 202
214 { 214 {
215 PyErr_SetString(PyExc_ValueError, "Expected a string (URI) and a callback function"); 215 PyErr_SetString(PyExc_ValueError, "Expected a string (URI) and a callback function");
216 return NULL; 216 return NULL;
217 } 217 }
218 218
219 OrthancPlugins::LogInfo("Registering a Python REST callback on URI: " + std::string(uri)); 219 ORTHANC_PLUGINS_LOG_INFO("Registering a Python REST callback on URI: " + std::string(uri));
220 OrthancPlugins::RegisterRestCallback<RestCallbackHandler>(uri, true /* thread safe */); 220 OrthancPlugins::RegisterRestCallback<RestCallbackHandler>(uri, true /* thread safe */);
221 221
222 restCallbacks_.push_back(new RestCallback(uri, callback)); 222 restCallbacks_.push_back(new RestCallback(uri, callback));
223 223
224 Py_INCREF(Py_None); 224 Py_INCREF(Py_None);