Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_GlobalFunctions.impl.h @ 75:cbfc72a53970
refactoring calls to PythonLock::RaiseException()
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 09 Aug 2021 16:59:59 +0200 |
parents | 23f3099bed47 |
children | e7ff5efb100d |
comparison
equal
deleted
inserted
replaced
73:da73be4b361b | 75:cbfc72a53970 |
---|---|
25 int arg1 = 0; | 25 int arg1 = 0; |
26 int arg2 = 0; | 26 int arg2 = 0; |
27 | 27 |
28 if (!PyArg_ParseTuple(args, "iii", &arg0, &arg1, &arg2)) | 28 if (!PyArg_ParseTuple(args, "iii", &arg0, &arg1, &arg2)) |
29 { | 29 { |
30 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
31 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 30 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
32 return NULL; | 31 return NULL; |
33 } | 32 } |
34 long value = OrthancPluginCheckVersionAdvanced(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); | 33 long value = OrthancPluginCheckVersionAdvanced(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); |
35 | 34 |
52 | 51 |
53 const char* arg0 = NULL; | 52 const char* arg0 = NULL; |
54 | 53 |
55 if (!PyArg_ParseTuple(args, "s", &arg0)) | 54 if (!PyArg_ParseTuple(args, "s", &arg0)) |
56 { | 55 { |
57 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
58 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 56 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
59 return NULL; | 57 return NULL; |
60 } | 58 } |
61 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), arg0); | 59 OrthancPluginLogError(OrthancPlugins::GetGlobalContext(), arg0); |
62 | 60 |
71 | 69 |
72 const char* arg0 = NULL; | 70 const char* arg0 = NULL; |
73 | 71 |
74 if (!PyArg_ParseTuple(args, "s", &arg0)) | 72 if (!PyArg_ParseTuple(args, "s", &arg0)) |
75 { | 73 { |
76 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
77 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 74 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
78 return NULL; | 75 return NULL; |
79 } | 76 } |
80 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), arg0); | 77 OrthancPluginLogWarning(OrthancPlugins::GetGlobalContext(), arg0); |
81 | 78 |
90 | 87 |
91 const char* arg0 = NULL; | 88 const char* arg0 = NULL; |
92 | 89 |
93 if (!PyArg_ParseTuple(args, "s", &arg0)) | 90 if (!PyArg_ParseTuple(args, "s", &arg0)) |
94 { | 91 { |
95 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
96 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 92 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
97 return NULL; | 93 return NULL; |
98 } | 94 } |
99 OrthancPluginLogInfo(OrthancPlugins::GetGlobalContext(), arg0); | 95 OrthancPluginLogInfo(OrthancPlugins::GetGlobalContext(), arg0); |
100 | 96 |
109 | 105 |
110 const char* arg0 = NULL; | 106 const char* arg0 = NULL; |
111 | 107 |
112 if (!PyArg_ParseTuple(args, "s", &arg0)) | 108 if (!PyArg_ParseTuple(args, "s", &arg0)) |
113 { | 109 { |
114 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
115 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 110 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
116 return NULL; | 111 return NULL; |
117 } | 112 } |
118 OrthancPlugins::MemoryBuffer buffer; | 113 OrthancPlugins::MemoryBuffer buffer; |
119 OrthancPluginErrorCode code = OrthancPluginGetDicomForInstance(OrthancPlugins::GetGlobalContext(), *buffer, arg0); | 114 OrthancPluginErrorCode code = OrthancPluginGetDicomForInstance(OrthancPlugins::GetGlobalContext(), *buffer, arg0); |
122 { | 117 { |
123 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 118 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
124 } | 119 } |
125 else | 120 else |
126 { | 121 { |
127 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 122 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
128 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
129 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
130 return NULL; | 123 return NULL; |
131 } | 124 } |
132 } | 125 } |
133 | 126 |
134 static PyObject* sdk_OrthancPluginRestApiGet(PyObject* module, PyObject* args) | 127 static PyObject* sdk_OrthancPluginRestApiGet(PyObject* module, PyObject* args) |
137 | 130 |
138 const char* arg0 = NULL; | 131 const char* arg0 = NULL; |
139 | 132 |
140 if (!PyArg_ParseTuple(args, "s", &arg0)) | 133 if (!PyArg_ParseTuple(args, "s", &arg0)) |
141 { | 134 { |
142 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
143 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 135 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
144 return NULL; | 136 return NULL; |
145 } | 137 } |
146 OrthancPlugins::MemoryBuffer buffer; | 138 OrthancPlugins::MemoryBuffer buffer; |
147 OrthancPluginErrorCode code = OrthancPluginRestApiGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0); | 139 OrthancPluginErrorCode code = OrthancPluginRestApiGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0); |
150 { | 142 { |
151 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 143 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
152 } | 144 } |
153 else | 145 else |
154 { | 146 { |
155 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 147 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
156 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
157 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
158 return NULL; | 148 return NULL; |
159 } | 149 } |
160 } | 150 } |
161 | 151 |
162 static PyObject* sdk_OrthancPluginRestApiGetAfterPlugins(PyObject* module, PyObject* args) | 152 static PyObject* sdk_OrthancPluginRestApiGetAfterPlugins(PyObject* module, PyObject* args) |
165 | 155 |
166 const char* arg0 = NULL; | 156 const char* arg0 = NULL; |
167 | 157 |
168 if (!PyArg_ParseTuple(args, "s", &arg0)) | 158 if (!PyArg_ParseTuple(args, "s", &arg0)) |
169 { | 159 { |
170 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
171 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 160 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
172 return NULL; | 161 return NULL; |
173 } | 162 } |
174 OrthancPlugins::MemoryBuffer buffer; | 163 OrthancPlugins::MemoryBuffer buffer; |
175 OrthancPluginErrorCode code = OrthancPluginRestApiGetAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0); | 164 OrthancPluginErrorCode code = OrthancPluginRestApiGetAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0); |
178 { | 167 { |
179 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 168 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
180 } | 169 } |
181 else | 170 else |
182 { | 171 { |
183 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 172 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
184 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
185 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
186 return NULL; | 173 return NULL; |
187 } | 174 } |
188 } | 175 } |
189 | 176 |
190 static PyObject* sdk_OrthancPluginRestApiPost(PyObject* module, PyObject* args) | 177 static PyObject* sdk_OrthancPluginRestApiPost(PyObject* module, PyObject* args) |
194 const char* arg0 = NULL; | 181 const char* arg0 = NULL; |
195 Py_buffer arg1; | 182 Py_buffer arg1; |
196 | 183 |
197 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) | 184 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) |
198 { | 185 { |
199 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
200 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 186 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
201 return NULL; | 187 return NULL; |
202 } | 188 } |
203 OrthancPlugins::MemoryBuffer buffer; | 189 OrthancPlugins::MemoryBuffer buffer; |
204 OrthancPluginErrorCode code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); | 190 OrthancPluginErrorCode code = OrthancPluginRestApiPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); |
207 { | 193 { |
208 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 194 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
209 } | 195 } |
210 else | 196 else |
211 { | 197 { |
212 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 198 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
213 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
214 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
215 return NULL; | 199 return NULL; |
216 } | 200 } |
217 } | 201 } |
218 | 202 |
219 static PyObject* sdk_OrthancPluginRestApiPostAfterPlugins(PyObject* module, PyObject* args) | 203 static PyObject* sdk_OrthancPluginRestApiPostAfterPlugins(PyObject* module, PyObject* args) |
223 const char* arg0 = NULL; | 207 const char* arg0 = NULL; |
224 Py_buffer arg1; | 208 Py_buffer arg1; |
225 | 209 |
226 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) | 210 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) |
227 { | 211 { |
228 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
229 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 212 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
230 return NULL; | 213 return NULL; |
231 } | 214 } |
232 OrthancPlugins::MemoryBuffer buffer; | 215 OrthancPlugins::MemoryBuffer buffer; |
233 OrthancPluginErrorCode code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); | 216 OrthancPluginErrorCode code = OrthancPluginRestApiPostAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); |
236 { | 219 { |
237 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 220 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
238 } | 221 } |
239 else | 222 else |
240 { | 223 { |
241 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 224 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
242 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
243 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
244 return NULL; | 225 return NULL; |
245 } | 226 } |
246 } | 227 } |
247 | 228 |
248 static PyObject* sdk_OrthancPluginRestApiDelete(PyObject* module, PyObject* args) | 229 static PyObject* sdk_OrthancPluginRestApiDelete(PyObject* module, PyObject* args) |
251 | 232 |
252 const char* arg0 = NULL; | 233 const char* arg0 = NULL; |
253 | 234 |
254 if (!PyArg_ParseTuple(args, "s", &arg0)) | 235 if (!PyArg_ParseTuple(args, "s", &arg0)) |
255 { | 236 { |
256 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
257 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 237 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
258 return NULL; | 238 return NULL; |
259 } | 239 } |
260 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(OrthancPlugins::GetGlobalContext(), arg0); | 240 OrthancPluginErrorCode code = OrthancPluginRestApiDelete(OrthancPlugins::GetGlobalContext(), arg0); |
261 | 241 |
265 Py_INCREF(Py_None); | 245 Py_INCREF(Py_None); |
266 return Py_None; | 246 return Py_None; |
267 } | 247 } |
268 else | 248 else |
269 { | 249 { |
270 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 250 PythonLock::RaiseException(code); |
271 //PythonLock::RaiseException(module, code); | |
272 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
273 return NULL; | 251 return NULL; |
274 } | 252 } |
275 } | 253 } |
276 | 254 |
277 static PyObject* sdk_OrthancPluginRestApiDeleteAfterPlugins(PyObject* module, PyObject* args) | 255 static PyObject* sdk_OrthancPluginRestApiDeleteAfterPlugins(PyObject* module, PyObject* args) |
280 | 258 |
281 const char* arg0 = NULL; | 259 const char* arg0 = NULL; |
282 | 260 |
283 if (!PyArg_ParseTuple(args, "s", &arg0)) | 261 if (!PyArg_ParseTuple(args, "s", &arg0)) |
284 { | 262 { |
285 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
286 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 263 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
287 return NULL; | 264 return NULL; |
288 } | 265 } |
289 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(OrthancPlugins::GetGlobalContext(), arg0); | 266 OrthancPluginErrorCode code = OrthancPluginRestApiDeleteAfterPlugins(OrthancPlugins::GetGlobalContext(), arg0); |
290 | 267 |
294 Py_INCREF(Py_None); | 271 Py_INCREF(Py_None); |
295 return Py_None; | 272 return Py_None; |
296 } | 273 } |
297 else | 274 else |
298 { | 275 { |
299 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 276 PythonLock::RaiseException(code); |
300 //PythonLock::RaiseException(module, code); | |
301 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
302 return NULL; | 277 return NULL; |
303 } | 278 } |
304 } | 279 } |
305 | 280 |
306 static PyObject* sdk_OrthancPluginRestApiPut(PyObject* module, PyObject* args) | 281 static PyObject* sdk_OrthancPluginRestApiPut(PyObject* module, PyObject* args) |
310 const char* arg0 = NULL; | 285 const char* arg0 = NULL; |
311 Py_buffer arg1; | 286 Py_buffer arg1; |
312 | 287 |
313 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) | 288 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) |
314 { | 289 { |
315 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
316 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 290 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
317 return NULL; | 291 return NULL; |
318 } | 292 } |
319 OrthancPlugins::MemoryBuffer buffer; | 293 OrthancPlugins::MemoryBuffer buffer; |
320 OrthancPluginErrorCode code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); | 294 OrthancPluginErrorCode code = OrthancPluginRestApiPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); |
323 { | 297 { |
324 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 298 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
325 } | 299 } |
326 else | 300 else |
327 { | 301 { |
328 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 302 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
329 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
330 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
331 return NULL; | 303 return NULL; |
332 } | 304 } |
333 } | 305 } |
334 | 306 |
335 static PyObject* sdk_OrthancPluginRestApiPutAfterPlugins(PyObject* module, PyObject* args) | 307 static PyObject* sdk_OrthancPluginRestApiPutAfterPlugins(PyObject* module, PyObject* args) |
339 const char* arg0 = NULL; | 311 const char* arg0 = NULL; |
340 Py_buffer arg1; | 312 Py_buffer arg1; |
341 | 313 |
342 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) | 314 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) |
343 { | 315 { |
344 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
345 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 316 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
346 return NULL; | 317 return NULL; |
347 } | 318 } |
348 OrthancPlugins::MemoryBuffer buffer; | 319 OrthancPlugins::MemoryBuffer buffer; |
349 OrthancPluginErrorCode code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); | 320 OrthancPluginErrorCode code = OrthancPluginRestApiPutAfterPlugins(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len); |
352 { | 323 { |
353 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 324 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
354 } | 325 } |
355 else | 326 else |
356 { | 327 { |
357 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 328 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
358 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
359 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
360 return NULL; | 329 return NULL; |
361 } | 330 } |
362 } | 331 } |
363 | 332 |
364 static PyObject* sdk_OrthancPluginLookupPatient(PyObject* module, PyObject* args) | 333 static PyObject* sdk_OrthancPluginLookupPatient(PyObject* module, PyObject* args) |
367 | 336 |
368 const char* arg0 = NULL; | 337 const char* arg0 = NULL; |
369 | 338 |
370 if (!PyArg_ParseTuple(args, "s", &arg0)) | 339 if (!PyArg_ParseTuple(args, "s", &arg0)) |
371 { | 340 { |
372 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
373 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 341 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
374 return NULL; | 342 return NULL; |
375 } | 343 } |
376 OrthancPlugins::OrthancString s; | 344 OrthancPlugins::OrthancString s; |
377 s.Assign(OrthancPluginLookupPatient(OrthancPlugins::GetGlobalContext(), arg0)); | 345 s.Assign(OrthancPluginLookupPatient(OrthancPlugins::GetGlobalContext(), arg0)); |
378 | 346 |
379 if (s.GetContent() == NULL) | 347 if (s.GetContent() == NULL) |
380 { | 348 { |
381 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 349 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
382 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
383 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
384 return NULL; | 350 return NULL; |
385 } | 351 } |
386 else | 352 else |
387 { | 353 { |
388 return PyUnicode_FromString(s.GetContent()); | 354 return PyUnicode_FromString(s.GetContent()); |
395 | 361 |
396 const char* arg0 = NULL; | 362 const char* arg0 = NULL; |
397 | 363 |
398 if (!PyArg_ParseTuple(args, "s", &arg0)) | 364 if (!PyArg_ParseTuple(args, "s", &arg0)) |
399 { | 365 { |
400 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
401 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 366 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
402 return NULL; | 367 return NULL; |
403 } | 368 } |
404 OrthancPlugins::OrthancString s; | 369 OrthancPlugins::OrthancString s; |
405 s.Assign(OrthancPluginLookupStudy(OrthancPlugins::GetGlobalContext(), arg0)); | 370 s.Assign(OrthancPluginLookupStudy(OrthancPlugins::GetGlobalContext(), arg0)); |
406 | 371 |
407 if (s.GetContent() == NULL) | 372 if (s.GetContent() == NULL) |
408 { | 373 { |
409 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 374 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
410 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
411 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
412 return NULL; | 375 return NULL; |
413 } | 376 } |
414 else | 377 else |
415 { | 378 { |
416 return PyUnicode_FromString(s.GetContent()); | 379 return PyUnicode_FromString(s.GetContent()); |
423 | 386 |
424 const char* arg0 = NULL; | 387 const char* arg0 = NULL; |
425 | 388 |
426 if (!PyArg_ParseTuple(args, "s", &arg0)) | 389 if (!PyArg_ParseTuple(args, "s", &arg0)) |
427 { | 390 { |
428 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
429 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 391 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
430 return NULL; | 392 return NULL; |
431 } | 393 } |
432 OrthancPlugins::OrthancString s; | 394 OrthancPlugins::OrthancString s; |
433 s.Assign(OrthancPluginLookupStudyWithAccessionNumber(OrthancPlugins::GetGlobalContext(), arg0)); | 395 s.Assign(OrthancPluginLookupStudyWithAccessionNumber(OrthancPlugins::GetGlobalContext(), arg0)); |
434 | 396 |
435 if (s.GetContent() == NULL) | 397 if (s.GetContent() == NULL) |
436 { | 398 { |
437 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 399 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
438 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
439 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
440 return NULL; | 400 return NULL; |
441 } | 401 } |
442 else | 402 else |
443 { | 403 { |
444 return PyUnicode_FromString(s.GetContent()); | 404 return PyUnicode_FromString(s.GetContent()); |
451 | 411 |
452 const char* arg0 = NULL; | 412 const char* arg0 = NULL; |
453 | 413 |
454 if (!PyArg_ParseTuple(args, "s", &arg0)) | 414 if (!PyArg_ParseTuple(args, "s", &arg0)) |
455 { | 415 { |
456 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
457 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 416 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
458 return NULL; | 417 return NULL; |
459 } | 418 } |
460 OrthancPlugins::OrthancString s; | 419 OrthancPlugins::OrthancString s; |
461 s.Assign(OrthancPluginLookupSeries(OrthancPlugins::GetGlobalContext(), arg0)); | 420 s.Assign(OrthancPluginLookupSeries(OrthancPlugins::GetGlobalContext(), arg0)); |
462 | 421 |
463 if (s.GetContent() == NULL) | 422 if (s.GetContent() == NULL) |
464 { | 423 { |
465 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 424 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
466 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
467 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
468 return NULL; | 425 return NULL; |
469 } | 426 } |
470 else | 427 else |
471 { | 428 { |
472 return PyUnicode_FromString(s.GetContent()); | 429 return PyUnicode_FromString(s.GetContent()); |
479 | 436 |
480 const char* arg0 = NULL; | 437 const char* arg0 = NULL; |
481 | 438 |
482 if (!PyArg_ParseTuple(args, "s", &arg0)) | 439 if (!PyArg_ParseTuple(args, "s", &arg0)) |
483 { | 440 { |
484 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
485 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 441 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
486 return NULL; | 442 return NULL; |
487 } | 443 } |
488 OrthancPlugins::OrthancString s; | 444 OrthancPlugins::OrthancString s; |
489 s.Assign(OrthancPluginLookupInstance(OrthancPlugins::GetGlobalContext(), arg0)); | 445 s.Assign(OrthancPluginLookupInstance(OrthancPlugins::GetGlobalContext(), arg0)); |
490 | 446 |
491 if (s.GetContent() == NULL) | 447 if (s.GetContent() == NULL) |
492 { | 448 { |
493 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 449 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
494 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
495 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
496 return NULL; | 450 return NULL; |
497 } | 451 } |
498 else | 452 else |
499 { | 453 { |
500 return PyUnicode_FromString(s.GetContent()); | 454 return PyUnicode_FromString(s.GetContent()); |
509 OrthancPlugins::OrthancString s; | 463 OrthancPlugins::OrthancString s; |
510 s.Assign(OrthancPluginGetOrthancPath(OrthancPlugins::GetGlobalContext())); | 464 s.Assign(OrthancPluginGetOrthancPath(OrthancPlugins::GetGlobalContext())); |
511 | 465 |
512 if (s.GetContent() == NULL) | 466 if (s.GetContent() == NULL) |
513 { | 467 { |
514 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 468 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
515 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
516 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
517 return NULL; | 469 return NULL; |
518 } | 470 } |
519 else | 471 else |
520 { | 472 { |
521 return PyUnicode_FromString(s.GetContent()); | 473 return PyUnicode_FromString(s.GetContent()); |
530 OrthancPlugins::OrthancString s; | 482 OrthancPlugins::OrthancString s; |
531 s.Assign(OrthancPluginGetOrthancDirectory(OrthancPlugins::GetGlobalContext())); | 483 s.Assign(OrthancPluginGetOrthancDirectory(OrthancPlugins::GetGlobalContext())); |
532 | 484 |
533 if (s.GetContent() == NULL) | 485 if (s.GetContent() == NULL) |
534 { | 486 { |
535 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 487 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
536 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
537 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
538 return NULL; | 488 return NULL; |
539 } | 489 } |
540 else | 490 else |
541 { | 491 { |
542 return PyUnicode_FromString(s.GetContent()); | 492 return PyUnicode_FromString(s.GetContent()); |
551 OrthancPlugins::OrthancString s; | 501 OrthancPlugins::OrthancString s; |
552 s.Assign(OrthancPluginGetConfigurationPath(OrthancPlugins::GetGlobalContext())); | 502 s.Assign(OrthancPluginGetConfigurationPath(OrthancPlugins::GetGlobalContext())); |
553 | 503 |
554 if (s.GetContent() == NULL) | 504 if (s.GetContent() == NULL) |
555 { | 505 { |
556 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 506 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
557 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
558 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
559 return NULL; | 507 return NULL; |
560 } | 508 } |
561 else | 509 else |
562 { | 510 { |
563 return PyUnicode_FromString(s.GetContent()); | 511 return PyUnicode_FromString(s.GetContent()); |
570 | 518 |
571 const char* arg0 = NULL; | 519 const char* arg0 = NULL; |
572 | 520 |
573 if (!PyArg_ParseTuple(args, "s", &arg0)) | 521 if (!PyArg_ParseTuple(args, "s", &arg0)) |
574 { | 522 { |
575 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
576 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 523 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
577 return NULL; | 524 return NULL; |
578 } | 525 } |
579 OrthancPluginSetRootUri(OrthancPlugins::GetGlobalContext(), arg0); | 526 OrthancPluginSetRootUri(OrthancPlugins::GetGlobalContext(), arg0); |
580 | 527 |
589 | 536 |
590 const char* arg0 = NULL; | 537 const char* arg0 = NULL; |
591 | 538 |
592 if (!PyArg_ParseTuple(args, "s", &arg0)) | 539 if (!PyArg_ParseTuple(args, "s", &arg0)) |
593 { | 540 { |
594 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
595 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 541 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
596 return NULL; | 542 return NULL; |
597 } | 543 } |
598 OrthancPluginSetDescription(OrthancPlugins::GetGlobalContext(), arg0); | 544 OrthancPluginSetDescription(OrthancPlugins::GetGlobalContext(), arg0); |
599 | 545 |
608 | 554 |
609 const char* arg0 = NULL; | 555 const char* arg0 = NULL; |
610 | 556 |
611 if (!PyArg_ParseTuple(args, "s", &arg0)) | 557 if (!PyArg_ParseTuple(args, "s", &arg0)) |
612 { | 558 { |
613 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
614 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 559 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
615 return NULL; | 560 return NULL; |
616 } | 561 } |
617 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), arg0); | 562 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), arg0); |
618 | 563 |
628 long int arg0 = 0; | 573 long int arg0 = 0; |
629 const char* arg1 = NULL; | 574 const char* arg1 = NULL; |
630 | 575 |
631 if (!PyArg_ParseTuple(args, "ls", &arg0, &arg1)) | 576 if (!PyArg_ParseTuple(args, "ls", &arg0, &arg1)) |
632 { | 577 { |
633 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
634 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 578 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
635 return NULL; | 579 return NULL; |
636 } | 580 } |
637 OrthancPlugins::OrthancString s; | 581 OrthancPlugins::OrthancString s; |
638 s.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1)); | 582 s.Assign(OrthancPluginGetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1)); |
639 | 583 |
640 if (s.GetContent() == NULL) | 584 if (s.GetContent() == NULL) |
641 { | 585 { |
642 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 586 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
643 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
644 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
645 return NULL; | 587 return NULL; |
646 } | 588 } |
647 else | 589 else |
648 { | 590 { |
649 return PyUnicode_FromString(s.GetContent()); | 591 return PyUnicode_FromString(s.GetContent()); |
657 long int arg0 = 0; | 599 long int arg0 = 0; |
658 const char* arg1 = NULL; | 600 const char* arg1 = NULL; |
659 | 601 |
660 if (!PyArg_ParseTuple(args, "ls", &arg0, &arg1)) | 602 if (!PyArg_ParseTuple(args, "ls", &arg0, &arg1)) |
661 { | 603 { |
662 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
663 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 604 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
664 return NULL; | 605 return NULL; |
665 } | 606 } |
666 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1); | 607 OrthancPluginErrorCode code = OrthancPluginSetGlobalProperty(OrthancPlugins::GetGlobalContext(), arg0, arg1); |
667 | 608 |
671 Py_INCREF(Py_None); | 612 Py_INCREF(Py_None); |
672 return Py_None; | 613 return Py_None; |
673 } | 614 } |
674 else | 615 else |
675 { | 616 { |
676 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 617 PythonLock::RaiseException(code); |
677 //PythonLock::RaiseException(module, code); | |
678 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
679 return NULL; | 618 return NULL; |
680 } | 619 } |
681 } | 620 } |
682 | 621 |
683 static PyObject* sdk_OrthancPluginGetCommandLineArgumentsCount(PyObject* module, PyObject* args) | 622 static PyObject* sdk_OrthancPluginGetCommandLineArgumentsCount(PyObject* module, PyObject* args) |
696 | 635 |
697 unsigned long arg0 = 0; | 636 unsigned long arg0 = 0; |
698 | 637 |
699 if (!PyArg_ParseTuple(args, "k", &arg0)) | 638 if (!PyArg_ParseTuple(args, "k", &arg0)) |
700 { | 639 { |
701 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
702 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 640 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
703 return NULL; | 641 return NULL; |
704 } | 642 } |
705 OrthancPlugins::OrthancString s; | 643 OrthancPlugins::OrthancString s; |
706 s.Assign(OrthancPluginGetCommandLineArgument(OrthancPlugins::GetGlobalContext(), arg0)); | 644 s.Assign(OrthancPluginGetCommandLineArgument(OrthancPlugins::GetGlobalContext(), arg0)); |
707 | 645 |
708 if (s.GetContent() == NULL) | 646 if (s.GetContent() == NULL) |
709 { | 647 { |
710 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 648 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
711 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
712 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
713 return NULL; | 649 return NULL; |
714 } | 650 } |
715 else | 651 else |
716 { | 652 { |
717 return PyUnicode_FromString(s.GetContent()); | 653 return PyUnicode_FromString(s.GetContent()); |
736 OrthancPlugins::OrthancString s; | 672 OrthancPlugins::OrthancString s; |
737 s.Assign(OrthancPluginGetConfiguration(OrthancPlugins::GetGlobalContext())); | 673 s.Assign(OrthancPluginGetConfiguration(OrthancPlugins::GetGlobalContext())); |
738 | 674 |
739 if (s.GetContent() == NULL) | 675 if (s.GetContent() == NULL) |
740 { | 676 { |
741 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 677 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
742 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
743 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
744 return NULL; | 678 return NULL; |
745 } | 679 } |
746 else | 680 else |
747 { | 681 { |
748 return PyUnicode_FromString(s.GetContent()); | 682 return PyUnicode_FromString(s.GetContent()); |
757 long int arg2 = 0; | 691 long int arg2 = 0; |
758 unsigned char arg3 = 0; | 692 unsigned char arg3 = 0; |
759 | 693 |
760 if (!PyArg_ParseTuple(args, "s*lb", &arg0, &arg2, &arg3)) | 694 if (!PyArg_ParseTuple(args, "s*lb", &arg0, &arg2, &arg3)) |
761 { | 695 { |
762 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
763 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 696 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
764 return NULL; | 697 return NULL; |
765 } | 698 } |
766 OrthancPlugins::MemoryBuffer buffer; | 699 OrthancPlugins::MemoryBuffer buffer; |
767 OrthancPluginErrorCode code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast<OrthancPluginCompressionType>(arg2), arg3); | 700 OrthancPluginErrorCode code = OrthancPluginBufferCompression(OrthancPlugins::GetGlobalContext(), *buffer, arg0.buf, arg0.len, static_cast<OrthancPluginCompressionType>(arg2), arg3); |
770 { | 703 { |
771 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 704 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
772 } | 705 } |
773 else | 706 else |
774 { | 707 { |
775 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 708 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
776 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
777 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
778 return NULL; | 709 return NULL; |
779 } | 710 } |
780 } | 711 } |
781 | 712 |
782 static PyObject* sdk_OrthancPluginReadFile(PyObject* module, PyObject* args) | 713 static PyObject* sdk_OrthancPluginReadFile(PyObject* module, PyObject* args) |
785 | 716 |
786 const char* arg0 = NULL; | 717 const char* arg0 = NULL; |
787 | 718 |
788 if (!PyArg_ParseTuple(args, "s", &arg0)) | 719 if (!PyArg_ParseTuple(args, "s", &arg0)) |
789 { | 720 { |
790 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
791 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 721 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
792 return NULL; | 722 return NULL; |
793 } | 723 } |
794 OrthancPlugins::MemoryBuffer buffer; | 724 OrthancPlugins::MemoryBuffer buffer; |
795 OrthancPluginErrorCode code = OrthancPluginReadFile(OrthancPlugins::GetGlobalContext(), *buffer, arg0); | 725 OrthancPluginErrorCode code = OrthancPluginReadFile(OrthancPlugins::GetGlobalContext(), *buffer, arg0); |
798 { | 728 { |
799 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 729 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
800 } | 730 } |
801 else | 731 else |
802 { | 732 { |
803 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 733 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
804 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
805 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
806 return NULL; | 734 return NULL; |
807 } | 735 } |
808 } | 736 } |
809 | 737 |
810 static PyObject* sdk_OrthancPluginWriteFile(PyObject* module, PyObject* args) | 738 static PyObject* sdk_OrthancPluginWriteFile(PyObject* module, PyObject* args) |
814 const char* arg0 = NULL; | 742 const char* arg0 = NULL; |
815 Py_buffer arg1; | 743 Py_buffer arg1; |
816 | 744 |
817 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) | 745 if (!PyArg_ParseTuple(args, "ss*", &arg0, &arg1)) |
818 { | 746 { |
819 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
820 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 747 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
821 return NULL; | 748 return NULL; |
822 } | 749 } |
823 OrthancPluginErrorCode code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); | 750 OrthancPluginErrorCode code = OrthancPluginWriteFile(OrthancPlugins::GetGlobalContext(), arg0, arg1.buf, arg1.len); |
824 PyBuffer_Release(&arg1); | 751 PyBuffer_Release(&arg1); |
828 Py_INCREF(Py_None); | 755 Py_INCREF(Py_None); |
829 return Py_None; | 756 return Py_None; |
830 } | 757 } |
831 else | 758 else |
832 { | 759 { |
833 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 760 PythonLock::RaiseException(code); |
834 //PythonLock::RaiseException(module, code); | |
835 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
836 return NULL; | 761 return NULL; |
837 } | 762 } |
838 } | 763 } |
839 | 764 |
840 static PyObject* sdk_OrthancPluginGetErrorDescription(PyObject* module, PyObject* args) | 765 static PyObject* sdk_OrthancPluginGetErrorDescription(PyObject* module, PyObject* args) |
843 | 768 |
844 long int arg0 = 0; | 769 long int arg0 = 0; |
845 | 770 |
846 if (!PyArg_ParseTuple(args, "l", &arg0)) | 771 if (!PyArg_ParseTuple(args, "l", &arg0)) |
847 { | 772 { |
848 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
849 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 773 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
850 return NULL; | 774 return NULL; |
851 } | 775 } |
852 const char* s = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginErrorCode>(arg0)); | 776 const char* s = OrthancPluginGetErrorDescription(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginErrorCode>(arg0)); |
853 | 777 |
869 Py_buffer arg0; | 793 Py_buffer arg0; |
870 long int arg2 = 0; | 794 long int arg2 = 0; |
871 | 795 |
872 if (!PyArg_ParseTuple(args, "s*l", &arg0, &arg2)) | 796 if (!PyArg_ParseTuple(args, "s*l", &arg0, &arg2)) |
873 { | 797 { |
874 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
875 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 798 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
876 return NULL; | 799 return NULL; |
877 } | 800 } |
878 // This is the case of a constructor | 801 // This is the case of a constructor |
879 OrthancPluginImage* obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginImageFormat>(arg2)); | 802 OrthancPluginImage* obj = OrthancPluginUncompressImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginImageFormat>(arg2)); |
880 PyBuffer_Release(&arg0); | 803 PyBuffer_Release(&arg0); |
881 if (obj == NULL) | 804 if (obj == NULL) |
882 { | 805 { |
883 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 806 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
884 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
885 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
886 return NULL; | 807 return NULL; |
887 } | 808 } |
888 else | 809 else |
889 { | 810 { |
890 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 811 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
904 unsigned long arg3 = 0; | 825 unsigned long arg3 = 0; |
905 Py_buffer arg4; | 826 Py_buffer arg4; |
906 | 827 |
907 if (!PyArg_ParseTuple(args, "lkkks*", &arg0, &arg1, &arg2, &arg3, &arg4)) | 828 if (!PyArg_ParseTuple(args, "lkkks*", &arg0, &arg1, &arg2, &arg3, &arg4)) |
908 { | 829 { |
909 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
910 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); | 830 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (5 arguments expected)"); |
911 return NULL; | 831 return NULL; |
912 } | 832 } |
913 OrthancPlugins::MemoryBuffer buffer; | 833 OrthancPlugins::MemoryBuffer buffer; |
914 OrthancPluginErrorCode code = OrthancPluginCompressPngImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf); | 834 OrthancPluginErrorCode code = OrthancPluginCompressPngImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf); |
917 { | 837 { |
918 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 838 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
919 } | 839 } |
920 else | 840 else |
921 { | 841 { |
922 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 842 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
923 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
924 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
925 return NULL; | 843 return NULL; |
926 } | 844 } |
927 } | 845 } |
928 | 846 |
929 static PyObject* sdk_OrthancPluginCompressJpegImage(PyObject* module, PyObject* args) | 847 static PyObject* sdk_OrthancPluginCompressJpegImage(PyObject* module, PyObject* args) |
937 Py_buffer arg4; | 855 Py_buffer arg4; |
938 unsigned char arg5 = 0; | 856 unsigned char arg5 = 0; |
939 | 857 |
940 if (!PyArg_ParseTuple(args, "lkkks*b", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) | 858 if (!PyArg_ParseTuple(args, "lkkks*b", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) |
941 { | 859 { |
942 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
943 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); | 860 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); |
944 return NULL; | 861 return NULL; |
945 } | 862 } |
946 OrthancPlugins::MemoryBuffer buffer; | 863 OrthancPlugins::MemoryBuffer buffer; |
947 OrthancPluginErrorCode code = OrthancPluginCompressJpegImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf, arg5); | 864 OrthancPluginErrorCode code = OrthancPluginCompressJpegImage(OrthancPlugins::GetGlobalContext(), *buffer, static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2, arg3, arg4.buf, arg5); |
950 { | 867 { |
951 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 868 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
952 } | 869 } |
953 else | 870 else |
954 { | 871 { |
955 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 872 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
956 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
957 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
958 return NULL; | 873 return NULL; |
959 } | 874 } |
960 } | 875 } |
961 | 876 |
962 static PyObject* sdk_OrthancPluginHttpGet(PyObject* module, PyObject* args) | 877 static PyObject* sdk_OrthancPluginHttpGet(PyObject* module, PyObject* args) |
967 const char* arg1 = NULL; | 882 const char* arg1 = NULL; |
968 const char* arg2 = NULL; | 883 const char* arg2 = NULL; |
969 | 884 |
970 if (!PyArg_ParseTuple(args, "sss", &arg0, &arg1, &arg2)) | 885 if (!PyArg_ParseTuple(args, "sss", &arg0, &arg1, &arg2)) |
971 { | 886 { |
972 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
973 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 887 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
974 return NULL; | 888 return NULL; |
975 } | 889 } |
976 OrthancPlugins::MemoryBuffer buffer; | 890 OrthancPlugins::MemoryBuffer buffer; |
977 OrthancPluginErrorCode code = OrthancPluginHttpGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1, arg2); | 891 OrthancPluginErrorCode code = OrthancPluginHttpGet(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1, arg2); |
980 { | 894 { |
981 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 895 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
982 } | 896 } |
983 else | 897 else |
984 { | 898 { |
985 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 899 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
986 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
987 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
988 return NULL; | 900 return NULL; |
989 } | 901 } |
990 } | 902 } |
991 | 903 |
992 static PyObject* sdk_OrthancPluginHttpPost(PyObject* module, PyObject* args) | 904 static PyObject* sdk_OrthancPluginHttpPost(PyObject* module, PyObject* args) |
998 const char* arg3 = NULL; | 910 const char* arg3 = NULL; |
999 const char* arg4 = NULL; | 911 const char* arg4 = NULL; |
1000 | 912 |
1001 if (!PyArg_ParseTuple(args, "ss*ss", &arg0, &arg1, &arg3, &arg4)) | 913 if (!PyArg_ParseTuple(args, "ss*ss", &arg0, &arg1, &arg3, &arg4)) |
1002 { | 914 { |
1003 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1004 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); | 915 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); |
1005 return NULL; | 916 return NULL; |
1006 } | 917 } |
1007 OrthancPlugins::MemoryBuffer buffer; | 918 OrthancPlugins::MemoryBuffer buffer; |
1008 OrthancPluginErrorCode code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); | 919 OrthancPluginErrorCode code = OrthancPluginHttpPost(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); |
1011 { | 922 { |
1012 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 923 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
1013 } | 924 } |
1014 else | 925 else |
1015 { | 926 { |
1016 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 927 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1017 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1018 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1019 return NULL; | 928 return NULL; |
1020 } | 929 } |
1021 } | 930 } |
1022 | 931 |
1023 static PyObject* sdk_OrthancPluginHttpPut(PyObject* module, PyObject* args) | 932 static PyObject* sdk_OrthancPluginHttpPut(PyObject* module, PyObject* args) |
1029 const char* arg3 = NULL; | 938 const char* arg3 = NULL; |
1030 const char* arg4 = NULL; | 939 const char* arg4 = NULL; |
1031 | 940 |
1032 if (!PyArg_ParseTuple(args, "ss*ss", &arg0, &arg1, &arg3, &arg4)) | 941 if (!PyArg_ParseTuple(args, "ss*ss", &arg0, &arg1, &arg3, &arg4)) |
1033 { | 942 { |
1034 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1035 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); | 943 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); |
1036 return NULL; | 944 return NULL; |
1037 } | 945 } |
1038 OrthancPlugins::MemoryBuffer buffer; | 946 OrthancPlugins::MemoryBuffer buffer; |
1039 OrthancPluginErrorCode code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); | 947 OrthancPluginErrorCode code = OrthancPluginHttpPut(OrthancPlugins::GetGlobalContext(), *buffer, arg0, arg1.buf, arg1.len, arg3, arg4); |
1042 { | 950 { |
1043 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 951 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
1044 } | 952 } |
1045 else | 953 else |
1046 { | 954 { |
1047 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 955 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1048 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1049 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1050 return NULL; | 956 return NULL; |
1051 } | 957 } |
1052 } | 958 } |
1053 | 959 |
1054 static PyObject* sdk_OrthancPluginHttpDelete(PyObject* module, PyObject* args) | 960 static PyObject* sdk_OrthancPluginHttpDelete(PyObject* module, PyObject* args) |
1059 const char* arg1 = NULL; | 965 const char* arg1 = NULL; |
1060 const char* arg2 = NULL; | 966 const char* arg2 = NULL; |
1061 | 967 |
1062 if (!PyArg_ParseTuple(args, "sss", &arg0, &arg1, &arg2)) | 968 if (!PyArg_ParseTuple(args, "sss", &arg0, &arg1, &arg2)) |
1063 { | 969 { |
1064 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1065 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 970 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
1066 return NULL; | 971 return NULL; |
1067 } | 972 } |
1068 OrthancPluginErrorCode code = OrthancPluginHttpDelete(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); | 973 OrthancPluginErrorCode code = OrthancPluginHttpDelete(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); |
1069 | 974 |
1073 Py_INCREF(Py_None); | 978 Py_INCREF(Py_None); |
1074 return Py_None; | 979 return Py_None; |
1075 } | 980 } |
1076 else | 981 else |
1077 { | 982 { |
1078 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 983 PythonLock::RaiseException(code); |
1079 //PythonLock::RaiseException(module, code); | |
1080 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1081 return NULL; | 984 return NULL; |
1082 } | 985 } |
1083 } | 986 } |
1084 | 987 |
1085 static PyObject* sdk_OrthancPluginGetFontsCount(PyObject* module, PyObject* args) | 988 static PyObject* sdk_OrthancPluginGetFontsCount(PyObject* module, PyObject* args) |
1098 | 1001 |
1099 unsigned long arg0 = 0; | 1002 unsigned long arg0 = 0; |
1100 | 1003 |
1101 if (!PyArg_ParseTuple(args, "k", &arg0)) | 1004 if (!PyArg_ParseTuple(args, "k", &arg0)) |
1102 { | 1005 { |
1103 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1104 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1006 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1105 return NULL; | 1007 return NULL; |
1106 } | 1008 } |
1107 const char* s = OrthancPluginGetFontName(OrthancPlugins::GetGlobalContext(), arg0); | 1009 const char* s = OrthancPluginGetFontName(OrthancPlugins::GetGlobalContext(), arg0); |
1108 | 1010 |
1123 | 1025 |
1124 unsigned long arg0 = 0; | 1026 unsigned long arg0 = 0; |
1125 | 1027 |
1126 if (!PyArg_ParseTuple(args, "k", &arg0)) | 1028 if (!PyArg_ParseTuple(args, "k", &arg0)) |
1127 { | 1029 { |
1128 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1129 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1030 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1130 return NULL; | 1031 return NULL; |
1131 } | 1032 } |
1132 long value = OrthancPluginGetFontSize(OrthancPlugins::GetGlobalContext(), arg0); | 1033 long value = OrthancPluginGetFontSize(OrthancPlugins::GetGlobalContext(), arg0); |
1133 | 1034 |
1142 unsigned short arg1 = 0; | 1043 unsigned short arg1 = 0; |
1143 const char* arg2 = NULL; | 1044 const char* arg2 = NULL; |
1144 | 1045 |
1145 if (!PyArg_ParseTuple(args, "lHs", &arg0, &arg1, &arg2)) | 1046 if (!PyArg_ParseTuple(args, "lHs", &arg0, &arg1, &arg2)) |
1146 { | 1047 { |
1147 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1148 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 1048 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
1149 return NULL; | 1049 return NULL; |
1150 } | 1050 } |
1151 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); | 1051 OrthancPluginErrorCode code = OrthancPluginRegisterErrorCode(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2); |
1152 | 1052 |
1156 Py_INCREF(Py_None); | 1056 Py_INCREF(Py_None); |
1157 return Py_None; | 1057 return Py_None; |
1158 } | 1058 } |
1159 else | 1059 else |
1160 { | 1060 { |
1161 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1061 PythonLock::RaiseException(code); |
1162 //PythonLock::RaiseException(module, code); | |
1163 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1164 return NULL; | 1062 return NULL; |
1165 } | 1063 } |
1166 } | 1064 } |
1167 | 1065 |
1168 static PyObject* sdk_OrthancPluginRegisterDictionaryTag(PyObject* module, PyObject* args) | 1066 static PyObject* sdk_OrthancPluginRegisterDictionaryTag(PyObject* module, PyObject* args) |
1176 unsigned long arg4 = 0; | 1074 unsigned long arg4 = 0; |
1177 unsigned long arg5 = 0; | 1075 unsigned long arg5 = 0; |
1178 | 1076 |
1179 if (!PyArg_ParseTuple(args, "HHlskk", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) | 1077 if (!PyArg_ParseTuple(args, "HHlskk", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5)) |
1180 { | 1078 { |
1181 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1182 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); | 1079 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (6 arguments expected)"); |
1183 return NULL; | 1080 return NULL; |
1184 } | 1081 } |
1185 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5); | 1082 OrthancPluginErrorCode code = OrthancPluginRegisterDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5); |
1186 | 1083 |
1190 Py_INCREF(Py_None); | 1087 Py_INCREF(Py_None); |
1191 return Py_None; | 1088 return Py_None; |
1192 } | 1089 } |
1193 else | 1090 else |
1194 { | 1091 { |
1195 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1092 PythonLock::RaiseException(code); |
1196 //PythonLock::RaiseException(module, code); | |
1197 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1198 return NULL; | 1093 return NULL; |
1199 } | 1094 } |
1200 } | 1095 } |
1201 | 1096 |
1202 static PyObject* sdk_OrthancPluginRegisterPrivateDictionaryTag(PyObject* module, PyObject* args) | 1097 static PyObject* sdk_OrthancPluginRegisterPrivateDictionaryTag(PyObject* module, PyObject* args) |
1211 unsigned long arg5 = 0; | 1106 unsigned long arg5 = 0; |
1212 const char* arg6 = NULL; | 1107 const char* arg6 = NULL; |
1213 | 1108 |
1214 if (!PyArg_ParseTuple(args, "HHlskks", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6)) | 1109 if (!PyArg_ParseTuple(args, "HHlskks", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6)) |
1215 { | 1110 { |
1216 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1217 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); | 1111 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); |
1218 return NULL; | 1112 return NULL; |
1219 } | 1113 } |
1220 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5, arg6); | 1114 OrthancPluginErrorCode code = OrthancPluginRegisterPrivateDictionaryTag(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginValueRepresentation>(arg2), arg3, arg4, arg5, arg6); |
1221 | 1115 |
1225 Py_INCREF(Py_None); | 1119 Py_INCREF(Py_None); |
1226 return Py_None; | 1120 return Py_None; |
1227 } | 1121 } |
1228 else | 1122 else |
1229 { | 1123 { |
1230 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1124 PythonLock::RaiseException(code); |
1231 //PythonLock::RaiseException(module, code); | |
1232 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1233 return NULL; | 1125 return NULL; |
1234 } | 1126 } |
1235 } | 1127 } |
1236 | 1128 |
1237 static PyObject* sdk_OrthancPluginDicomBufferToJson(PyObject* module, PyObject* args) | 1129 static PyObject* sdk_OrthancPluginDicomBufferToJson(PyObject* module, PyObject* args) |
1243 long int arg3 = 0; | 1135 long int arg3 = 0; |
1244 unsigned long arg4 = 0; | 1136 unsigned long arg4 = 0; |
1245 | 1137 |
1246 if (!PyArg_ParseTuple(args, "s*llk", &arg0, &arg2, &arg3, &arg4)) | 1138 if (!PyArg_ParseTuple(args, "s*llk", &arg0, &arg2, &arg3, &arg4)) |
1247 { | 1139 { |
1248 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1249 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); | 1140 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); |
1250 return NULL; | 1141 return NULL; |
1251 } | 1142 } |
1252 OrthancPlugins::OrthancString s; | 1143 OrthancPlugins::OrthancString s; |
1253 s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); | 1144 s.Assign(OrthancPluginDicomBufferToJson(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, static_cast<OrthancPluginDicomToJsonFormat>(arg2), static_cast<OrthancPluginDicomToJsonFlags>(arg3), arg4)); |
1254 PyBuffer_Release(&arg0); | 1145 PyBuffer_Release(&arg0); |
1255 if (s.GetContent() == NULL) | 1146 if (s.GetContent() == NULL) |
1256 { | 1147 { |
1257 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1148 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1258 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1259 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1260 return NULL; | 1149 return NULL; |
1261 } | 1150 } |
1262 else | 1151 else |
1263 { | 1152 { |
1264 return PyUnicode_FromString(s.GetContent()); | 1153 return PyUnicode_FromString(s.GetContent()); |
1274 long int arg2 = 0; | 1163 long int arg2 = 0; |
1275 unsigned long arg3 = 0; | 1164 unsigned long arg3 = 0; |
1276 | 1165 |
1277 if (!PyArg_ParseTuple(args, "sllk", &arg0, &arg1, &arg2, &arg3)) | 1166 if (!PyArg_ParseTuple(args, "sllk", &arg0, &arg1, &arg2, &arg3)) |
1278 { | 1167 { |
1279 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1280 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); | 1168 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (4 arguments expected)"); |
1281 return NULL; | 1169 return NULL; |
1282 } | 1170 } |
1283 OrthancPlugins::OrthancString s; | 1171 OrthancPlugins::OrthancString s; |
1284 s.Assign(OrthancPluginDicomInstanceToJson(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3)); | 1172 s.Assign(OrthancPluginDicomInstanceToJson(OrthancPlugins::GetGlobalContext(), arg0, static_cast<OrthancPluginDicomToJsonFormat>(arg1), static_cast<OrthancPluginDicomToJsonFlags>(arg2), arg3)); |
1285 | 1173 |
1286 if (s.GetContent() == NULL) | 1174 if (s.GetContent() == NULL) |
1287 { | 1175 { |
1288 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1176 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1289 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1290 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1291 return NULL; | 1177 return NULL; |
1292 } | 1178 } |
1293 else | 1179 else |
1294 { | 1180 { |
1295 return PyUnicode_FromString(s.GetContent()); | 1181 return PyUnicode_FromString(s.GetContent()); |
1304 unsigned long arg1 = 0; | 1190 unsigned long arg1 = 0; |
1305 unsigned long arg2 = 0; | 1191 unsigned long arg2 = 0; |
1306 | 1192 |
1307 if (!PyArg_ParseTuple(args, "lkk", &arg0, &arg1, &arg2)) | 1193 if (!PyArg_ParseTuple(args, "lkk", &arg0, &arg1, &arg2)) |
1308 { | 1194 { |
1309 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1310 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 1195 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
1311 return NULL; | 1196 return NULL; |
1312 } | 1197 } |
1313 // This is the case of a constructor | 1198 // This is the case of a constructor |
1314 OrthancPluginImage* obj = OrthancPluginCreateImage(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2); | 1199 OrthancPluginImage* obj = OrthancPluginCreateImage(OrthancPlugins::GetGlobalContext(), static_cast<OrthancPluginPixelFormat>(arg0), arg1, arg2); |
1315 | 1200 |
1316 if (obj == NULL) | 1201 if (obj == NULL) |
1317 { | 1202 { |
1318 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1203 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1319 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1320 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1321 return NULL; | 1204 return NULL; |
1322 } | 1205 } |
1323 else | 1206 else |
1324 { | 1207 { |
1325 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1208 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1336 Py_buffer arg0; | 1219 Py_buffer arg0; |
1337 unsigned long arg2 = 0; | 1220 unsigned long arg2 = 0; |
1338 | 1221 |
1339 if (!PyArg_ParseTuple(args, "s*k", &arg0, &arg2)) | 1222 if (!PyArg_ParseTuple(args, "s*k", &arg0, &arg2)) |
1340 { | 1223 { |
1341 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1342 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 1224 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
1343 return NULL; | 1225 return NULL; |
1344 } | 1226 } |
1345 // This is the case of a constructor | 1227 // This is the case of a constructor |
1346 OrthancPluginImage* obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); | 1228 OrthancPluginImage* obj = OrthancPluginDecodeDicomImage(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); |
1347 PyBuffer_Release(&arg0); | 1229 PyBuffer_Release(&arg0); |
1348 if (obj == NULL) | 1230 if (obj == NULL) |
1349 { | 1231 { |
1350 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1232 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1351 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1352 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1353 return NULL; | 1233 return NULL; |
1354 } | 1234 } |
1355 else | 1235 else |
1356 { | 1236 { |
1357 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1237 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1367 | 1247 |
1368 Py_buffer arg0; | 1248 Py_buffer arg0; |
1369 | 1249 |
1370 if (!PyArg_ParseTuple(args, "s*", &arg0)) | 1250 if (!PyArg_ParseTuple(args, "s*", &arg0)) |
1371 { | 1251 { |
1372 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1373 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1252 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1374 return NULL; | 1253 return NULL; |
1375 } | 1254 } |
1376 OrthancPlugins::OrthancString s; | 1255 OrthancPlugins::OrthancString s; |
1377 s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); | 1256 s.Assign(OrthancPluginComputeMd5(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); |
1378 PyBuffer_Release(&arg0); | 1257 PyBuffer_Release(&arg0); |
1379 if (s.GetContent() == NULL) | 1258 if (s.GetContent() == NULL) |
1380 { | 1259 { |
1381 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1260 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1382 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1383 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1384 return NULL; | 1261 return NULL; |
1385 } | 1262 } |
1386 else | 1263 else |
1387 { | 1264 { |
1388 return PyUnicode_FromString(s.GetContent()); | 1265 return PyUnicode_FromString(s.GetContent()); |
1395 | 1272 |
1396 Py_buffer arg0; | 1273 Py_buffer arg0; |
1397 | 1274 |
1398 if (!PyArg_ParseTuple(args, "s*", &arg0)) | 1275 if (!PyArg_ParseTuple(args, "s*", &arg0)) |
1399 { | 1276 { |
1400 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1401 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1277 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1402 return NULL; | 1278 return NULL; |
1403 } | 1279 } |
1404 OrthancPlugins::OrthancString s; | 1280 OrthancPlugins::OrthancString s; |
1405 s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); | 1281 s.Assign(OrthancPluginComputeSha1(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len)); |
1406 PyBuffer_Release(&arg0); | 1282 PyBuffer_Release(&arg0); |
1407 if (s.GetContent() == NULL) | 1283 if (s.GetContent() == NULL) |
1408 { | 1284 { |
1409 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1285 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1410 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1411 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1412 return NULL; | 1286 return NULL; |
1413 } | 1287 } |
1414 else | 1288 else |
1415 { | 1289 { |
1416 return PyUnicode_FromString(s.GetContent()); | 1290 return PyUnicode_FromString(s.GetContent()); |
1425 OrthancPlugins::OrthancString s; | 1299 OrthancPlugins::OrthancString s; |
1426 s.Assign(OrthancPluginGenerateUuid(OrthancPlugins::GetGlobalContext())); | 1300 s.Assign(OrthancPluginGenerateUuid(OrthancPlugins::GetGlobalContext())); |
1427 | 1301 |
1428 if (s.GetContent() == NULL) | 1302 if (s.GetContent() == NULL) |
1429 { | 1303 { |
1430 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1304 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1431 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1432 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1433 return NULL; | 1305 return NULL; |
1434 } | 1306 } |
1435 else | 1307 else |
1436 { | 1308 { |
1437 return PyUnicode_FromString(s.GetContent()); | 1309 return PyUnicode_FromString(s.GetContent()); |
1444 | 1316 |
1445 Py_buffer arg0; | 1317 Py_buffer arg0; |
1446 | 1318 |
1447 if (!PyArg_ParseTuple(args, "s*", &arg0)) | 1319 if (!PyArg_ParseTuple(args, "s*", &arg0)) |
1448 { | 1320 { |
1449 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1450 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1321 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1451 return NULL; | 1322 return NULL; |
1452 } | 1323 } |
1453 // This is the case of a constructor | 1324 // This is the case of a constructor |
1454 OrthancPluginFindMatcher* obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); | 1325 OrthancPluginFindMatcher* obj = OrthancPluginCreateFindMatcher(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); |
1455 PyBuffer_Release(&arg0); | 1326 PyBuffer_Release(&arg0); |
1456 if (obj == NULL) | 1327 if (obj == NULL) |
1457 { | 1328 { |
1458 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1329 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1459 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1460 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1461 return NULL; | 1330 return NULL; |
1462 } | 1331 } |
1463 else | 1332 else |
1464 { | 1333 { |
1465 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1334 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1477 // This is the case of a constructor | 1346 // This is the case of a constructor |
1478 OrthancPluginPeers* obj = OrthancPluginGetPeers(OrthancPlugins::GetGlobalContext()); | 1347 OrthancPluginPeers* obj = OrthancPluginGetPeers(OrthancPlugins::GetGlobalContext()); |
1479 | 1348 |
1480 if (obj == NULL) | 1349 if (obj == NULL) |
1481 { | 1350 { |
1482 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1351 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1483 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1484 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1485 return NULL; | 1352 return NULL; |
1486 } | 1353 } |
1487 else | 1354 else |
1488 { | 1355 { |
1489 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1356 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1499 | 1366 |
1500 const char* arg0 = NULL; | 1367 const char* arg0 = NULL; |
1501 | 1368 |
1502 if (!PyArg_ParseTuple(args, "s", &arg0)) | 1369 if (!PyArg_ParseTuple(args, "s", &arg0)) |
1503 { | 1370 { |
1504 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1505 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1371 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1506 return NULL; | 1372 return NULL; |
1507 } | 1373 } |
1508 const char* s = OrthancPluginAutodetectMimeType(OrthancPlugins::GetGlobalContext(), arg0); | 1374 const char* s = OrthancPluginAutodetectMimeType(OrthancPlugins::GetGlobalContext(), arg0); |
1509 | 1375 |
1526 float arg1 = 0; | 1392 float arg1 = 0; |
1527 long int arg2 = 0; | 1393 long int arg2 = 0; |
1528 | 1394 |
1529 if (!PyArg_ParseTuple(args, "sfl", &arg0, &arg1, &arg2)) | 1395 if (!PyArg_ParseTuple(args, "sfl", &arg0, &arg1, &arg2)) |
1530 { | 1396 { |
1531 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1532 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 1397 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
1533 return NULL; | 1398 return NULL; |
1534 } | 1399 } |
1535 OrthancPluginSetMetricsValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginMetricsType>(arg2)); | 1400 OrthancPluginSetMetricsValue(OrthancPlugins::GetGlobalContext(), arg0, arg1, static_cast<OrthancPluginMetricsType>(arg2)); |
1536 | 1401 |
1547 unsigned short arg1 = 0; | 1412 unsigned short arg1 = 0; |
1548 const char* arg2 = NULL; | 1413 const char* arg2 = NULL; |
1549 | 1414 |
1550 if (!PyArg_ParseTuple(args, "HHs", &arg0, &arg1, &arg2)) | 1415 if (!PyArg_ParseTuple(args, "HHs", &arg0, &arg1, &arg2)) |
1551 { | 1416 { |
1552 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1553 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); | 1417 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (3 arguments expected)"); |
1554 return NULL; | 1418 return NULL; |
1555 } | 1419 } |
1556 OrthancPlugins::OrthancString s; | 1420 OrthancPlugins::OrthancString s; |
1557 s.Assign(OrthancPluginGetTagName(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2)); | 1421 s.Assign(OrthancPluginGetTagName(OrthancPlugins::GetGlobalContext(), arg0, arg1, arg2)); |
1558 | 1422 |
1559 if (s.GetContent() == NULL) | 1423 if (s.GetContent() == NULL) |
1560 { | 1424 { |
1561 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1425 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1562 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1563 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1564 return NULL; | 1426 return NULL; |
1565 } | 1427 } |
1566 else | 1428 else |
1567 { | 1429 { |
1568 return PyUnicode_FromString(s.GetContent()); | 1430 return PyUnicode_FromString(s.GetContent()); |
1575 | 1437 |
1576 Py_buffer arg0; | 1438 Py_buffer arg0; |
1577 | 1439 |
1578 if (!PyArg_ParseTuple(args, "s*", &arg0)) | 1440 if (!PyArg_ParseTuple(args, "s*", &arg0)) |
1579 { | 1441 { |
1580 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1581 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1442 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1582 return NULL; | 1443 return NULL; |
1583 } | 1444 } |
1584 // This is the case of a constructor | 1445 // This is the case of a constructor |
1585 OrthancPluginDicomInstance* obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); | 1446 OrthancPluginDicomInstance* obj = OrthancPluginCreateDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len); |
1586 PyBuffer_Release(&arg0); | 1447 PyBuffer_Release(&arg0); |
1587 if (obj == NULL) | 1448 if (obj == NULL) |
1588 { | 1449 { |
1589 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1450 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1590 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1591 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1592 return NULL; | 1451 return NULL; |
1593 } | 1452 } |
1594 else | 1453 else |
1595 { | 1454 { |
1596 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1455 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1607 Py_buffer arg0; | 1466 Py_buffer arg0; |
1608 const char* arg2 = NULL; | 1467 const char* arg2 = NULL; |
1609 | 1468 |
1610 if (!PyArg_ParseTuple(args, "s*s", &arg0, &arg2)) | 1469 if (!PyArg_ParseTuple(args, "s*s", &arg0, &arg2)) |
1611 { | 1470 { |
1612 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1613 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); | 1471 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (2 arguments expected)"); |
1614 return NULL; | 1472 return NULL; |
1615 } | 1473 } |
1616 // This is the case of a constructor | 1474 // This is the case of a constructor |
1617 OrthancPluginDicomInstance* obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); | 1475 OrthancPluginDicomInstance* obj = OrthancPluginTranscodeDicomInstance(OrthancPlugins::GetGlobalContext(), arg0.buf, arg0.len, arg2); |
1618 PyBuffer_Release(&arg0); | 1476 PyBuffer_Release(&arg0); |
1619 if (obj == NULL) | 1477 if (obj == NULL) |
1620 { | 1478 { |
1621 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1479 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1622 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1623 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1624 return NULL; | 1480 return NULL; |
1625 } | 1481 } |
1626 else | 1482 else |
1627 { | 1483 { |
1628 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | 1484 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); |
1638 | 1494 |
1639 unsigned long arg0 = 0; | 1495 unsigned long arg0 = 0; |
1640 | 1496 |
1641 if (!PyArg_ParseTuple(args, "k", &arg0)) | 1497 if (!PyArg_ParseTuple(args, "k", &arg0)) |
1642 { | 1498 { |
1643 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | |
1644 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | 1499 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); |
1645 return NULL; | 1500 return NULL; |
1646 } | 1501 } |
1647 OrthancPlugins::MemoryBuffer buffer; | 1502 OrthancPlugins::MemoryBuffer buffer; |
1648 OrthancPluginErrorCode code = OrthancPluginCreateMemoryBuffer(OrthancPlugins::GetGlobalContext(), *buffer, arg0); | 1503 OrthancPluginErrorCode code = OrthancPluginCreateMemoryBuffer(OrthancPlugins::GetGlobalContext(), *buffer, arg0); |
1651 { | 1506 { |
1652 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); | 1507 return PyBytes_FromStringAndSize(buffer.GetData(), buffer.GetSize()); |
1653 } | 1508 } |
1654 else | 1509 else |
1655 { | 1510 { |
1656 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1511 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1657 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1658 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1659 return NULL; | 1512 return NULL; |
1660 } | 1513 } |
1661 } | 1514 } |
1662 | 1515 |
1663 static PyObject* sdk_OrthancPluginGenerateRestApiAuthorizationToken(PyObject* module, PyObject* args) | 1516 static PyObject* sdk_OrthancPluginGenerateRestApiAuthorizationToken(PyObject* module, PyObject* args) |
1668 OrthancPlugins::OrthancString s; | 1521 OrthancPlugins::OrthancString s; |
1669 s.Assign(OrthancPluginGenerateRestApiAuthorizationToken(OrthancPlugins::GetGlobalContext())); | 1522 s.Assign(OrthancPluginGenerateRestApiAuthorizationToken(OrthancPlugins::GetGlobalContext())); |
1670 | 1523 |
1671 if (s.GetContent() == NULL) | 1524 if (s.GetContent() == NULL) |
1672 { | 1525 { |
1673 // TODO => RAISE : https://stackoverflow.com/questions/60832317 | 1526 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); |
1674 //PythonLock::RaiseException(module, OrthancPluginErrorCode_InternalError); | |
1675 PyErr_SetString(PyExc_ValueError, "Internal error"); | |
1676 return NULL; | 1527 return NULL; |
1677 } | 1528 } |
1678 else | 1529 else |
1679 { | 1530 { |
1680 return PyUnicode_FromString(s.GetContent()); | 1531 return PyUnicode_FromString(s.GetContent()); |