From c33327ff43db2e0fd8f4c2d9a7a4333a50e8c605 Mon Sep 17 00:00:00 2001 From: staticfox Date: Thu, 21 Apr 2016 03:01:17 -0400 Subject: Python: Refactor python support Closes #1866 --- src/modules/python/libkvipython.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/modules/python') diff --git a/src/modules/python/libkvipython.cpp b/src/modules/python/libkvipython.cpp index 7d99636d5..e9ebfb9dd 100644 --- a/src/modules/python/libkvipython.cpp +++ b/src/modules/python/libkvipython.cpp @@ -31,7 +31,7 @@ #include "../pythoncore/pythoncoreinterface.h" #include - static KviModule * g_pPythonCoreModule = 0; + static KviModule * g_pPythonCoreModule = nullptr; #define KVS_CHECK_PYTHONCORE(_m,_c) \ g_pPythonCoreModule = g_pModuleManager->getModule("pythoncore"); \ @@ -56,7 +56,7 @@ _c->warning(__tr2qs_ctx("This KVIrc executable has been compiled without Python scripting support","python")); \ return true; - static KviModule * g_pPythonCoreModule = 0; + static KviModule * g_pPythonCoreModule = nullptr; #endif // COMPILE_PYTHON_SUPPORT /* @@ -430,25 +430,17 @@ static bool python_kvs_cmd_begin(KviKvsModuleCommandCall * c) if(!ex.lWarnings.isEmpty()) { - for(QStringList::Iterator it = ex.lWarnings.begin();it != ex.lWarnings.end();++it) - c->warning(*it); + for(const auto& it : ex.lWarnings) + c->warning(it); } - if(!ex.bExitOk) + if(!ex.bExitOk && !c->switches()->find('q',"quiet")) { - if(!c->switches()->find('q',"quiet")) - { + c->warning(__tr2qs_ctx("Python execution error:","python")); + c->warning(ex.szError); - if(c->switches()->find('f',"fail-on-error")) - { - c->warning(__tr2qs_ctx("Python execution error:","python")); - c->warning(ex.szError); - return false; - } else { - c->warning(__tr2qs_ctx("Python execution error:","python")); - c->error(ex.szError); - } - } + if(c->switches()->find('f',"fail-on-error")) + return false; } if(!c->switches()->find('n',"no-return")) @@ -456,7 +448,6 @@ static bool python_kvs_cmd_begin(KviKvsModuleCommandCall * c) #endif //COMPILE_PYTHON_SUPPORT - return true; } -- cgit v1.3.1-10-gc9f91