Skip to content

Commit

Permalink
+ improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Aug 25, 2015
1 parent 7055073 commit 1e745a6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Gui/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,8 +807,10 @@ PythonCommand::PythonCommand(const char* name, PyObject * pcPyCommand, const cha
// call the method "GetResources()" of the command object
_pcPyResourceDict = Interpreter().runMethodObject(_pcPyCommand, "GetResources");
// check if the "GetResources()" method returns a Dict object
if (!PyDict_Check(_pcPyResourceDict))
throw Base::Exception("PythonCommand::PythonCommand(): Method GetResources() of the Python command object returns the wrong type (has to be Py Dictonary)");
if (!PyDict_Check(_pcPyResourceDict)) {
throw Base::Exception("PythonCommand::PythonCommand(): Method GetResources() of the Python "
"command object returns the wrong type (has to be dict)");
}

// check for command type
std::string cmdType = getResource("CmdType");
Expand All @@ -834,8 +836,10 @@ const char* PythonCommand::getResource(const char* sName) const
pcTemp = PyDict_GetItemString(_pcPyResourceDict,sName);
if (!pcTemp)
return "";
if (!PyString_Check(pcTemp))
throw Base::Exception("PythonCommand::getResource(): Method GetResources() of the Python command object returns a dictionary which holds not only strings");
if (!PyString_Check(pcTemp)) {
throw Base::Exception("PythonCommand::getResource(): Method GetResources() of the Python "
"command object returns a dictionary which holds not only strings");
}

return PyString_AsString(pcTemp);
}
Expand Down Expand Up @@ -963,7 +967,7 @@ PythonGroupCommand::PythonGroupCommand(const char* name, PyObject * pcPyCommand)
// check if the "GetResources()" method returns a Dict object
if (!PyDict_Check(_pcPyResource)) {
throw Base::TypeError("PythonGroupCommand::PythonGroupCommand(): Method GetResources() of the Python "
"command object returns the wrong type (has to be Py Dictonary)");
"command object returns the wrong type (has to be dict)");
}

// check for command type
Expand Down

0 comments on commit 1e745a6

Please sign in to comment.