TechDraw: Improve and clean up code in some Python classes
This commit is contained in:
@@ -45,14 +45,10 @@ PyObject* DrawViewSymbolPy::dumpSymbol(PyObject *args)
|
||||
{
|
||||
const char* fileSpec;
|
||||
if (!PyArg_ParseTuple(args, "s", &fileSpec)) {
|
||||
throw Py::TypeError("** dumpSymbol bad args.");
|
||||
}
|
||||
auto dvs = getDrawViewSymbolPtr();
|
||||
std::string symbolRepr;
|
||||
if (dvs) {
|
||||
symbolRepr = dvs->Symbol.getValue();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string symbolRepr = getDrawViewSymbolPtr()->Symbol.getValue();
|
||||
Base::FileInfo fi(fileSpec);
|
||||
Base::ofstream outfile;
|
||||
outfile.open(fi);
|
||||
@@ -63,8 +59,10 @@ PyObject* DrawViewSymbolPy::dumpSymbol(PyObject *args)
|
||||
} else {
|
||||
std::string error = std::string("Can't write ");
|
||||
error += fileSpec;
|
||||
throw Py::RuntimeError(error);
|
||||
PyErr_SetString(PyExc_RuntimeError, error.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user