| 611 | } |
| 612 | |
| 613 | PyObject* ApplicationPy::sSaveParameter(PyObject* /*self*/, PyObject* args) |
| 614 | { |
| 615 | const char* pstr = "User parameter"; |
| 616 | if (!PyArg_ParseTuple(args, "|s", &pstr)) { |
| 617 | return nullptr; |
| 618 | } |
| 619 | |
| 620 | PY_TRY |
| 621 | { |
| 622 | ParameterManager* param = App::GetApplication().GetParameterSet(pstr); |
| 623 | if (!param) { |
| 624 | std::stringstream str; |
| 625 | str << "No parameter set found with name: " << pstr; |
| 626 | PyErr_SetString(PyExc_ValueError, str.str().c_str()); |
| 627 | return nullptr; |
| 628 | } |
| 629 | if (!param->HasSerializer()) { |
| 630 | std::stringstream str; |
| 631 | str << "Parameter set cannot be serialized: " << pstr; |
| 632 | PyErr_SetString(PyExc_RuntimeError, str.str().c_str()); |
| 633 | return nullptr; |
| 634 | } |
| 635 | |
| 636 | param->SaveDocument(); |
| 637 | Py_INCREF(Py_None); |
| 638 | return Py_None; |
| 639 | } |
| 640 | PY_CATCH; |
| 641 | } |
| 642 |
nothing calls this directly
no test coverage detected