diff options
Diffstat (limited to 'lib/kross/python')
-rw-r--r-- | lib/kross/python/cxx/Objects.hxx | 2 | ||||
-rw-r--r-- | lib/kross/python/cxx/PyCXX.html | 6 | ||||
-rw-r--r-- | lib/kross/python/pythonextension.cpp | 50 | ||||
-rw-r--r-- | lib/kross/python/pythoninterpreter.cpp | 18 | ||||
-rw-r--r-- | lib/kross/python/pythonmodule.cpp | 8 | ||||
-rw-r--r-- | lib/kross/python/pythonobject.cpp | 8 | ||||
-rw-r--r-- | lib/kross/python/pythonscript.cpp | 40 | ||||
-rw-r--r-- | lib/kross/python/pythonsecurity.cpp | 18 |
8 files changed, 75 insertions, 75 deletions
diff --git a/lib/kross/python/cxx/Objects.hxx b/lib/kross/python/cxx/Objects.hxx index 900a347b..3aa790e6 100644 --- a/lib/kross/python/cxx/Objects.hxx +++ b/lib/kross/python/cxx/Objects.hxx @@ -54,7 +54,7 @@ namespace Py // The purpose of this class is to serve as the most general kind of // Python object, for the purpose of writing C++ extensions in Python // Objects hold a PyObject* which they own. This pointer is always a - // valid pointer to a Python object. In tqchildren we must maintain this behavior. + // valid pointer to a Python object. In children we must maintain this behavior. // // Instructions on how to make your own class MyType descended from Object: // (0) Pick a base class, either Object or perhaps SeqBase<T> or MapBase<T>. diff --git a/lib/kross/python/cxx/PyCXX.html b/lib/kross/python/cxx/PyCXX.html index 7213ad70..e162e601 100644 --- a/lib/kross/python/cxx/PyCXX.html +++ b/lib/kross/python/cxx/PyCXX.html @@ -303,7 +303,7 @@ returned by such a function, you need to know if the function returns you an <i> or <i>unowned</i> reference. Unowned references are unusual but there are some cases where unowned references are returned.</p> -<p>Usually, <cite>Object</cite> and its tqchildren acquire a new reference when constructed from a +<p>Usually, <cite>Object</cite> and its children acquire a new reference when constructed from a <cite>PyObject *</cite>. This is usually not the right behavior if the reference comes from one of the Python C API calls.</p> @@ -1571,7 +1571,7 @@ converted to a standard string which is passed to std::ostream& operator< <p>The Python exception facility and the C++ exception facility can be merged via the use of try/catch blocks in the bodies of extension objects and module functions.</p> -<h3>Class Exception and its tqchildren</h3> +<h3>Class Exception and its children</h3> <p>A set of classes is provided. Each is derived from class Exception, and represents a particular sort of Python exception, such as IndexError, RuntimeError, ValueError. Each of @@ -1612,7 +1612,7 @@ classes are shown here.</p> </tr> <tr> <td class=code></td> - <td>Constructors for other tqchildren of class Exception</td> + <td>Constructors for other children of class Exception</td> </tr> <tr> <td class=code> </td> diff --git a/lib/kross/python/pythonextension.cpp b/lib/kross/python/pythonextension.cpp index f13cf93a..9d8c3ece 100644 --- a/lib/kross/python/pythonextension.cpp +++ b/lib/kross/python/pythonextension.cpp @@ -31,7 +31,7 @@ PythonExtension::PythonExtension(Kross::Api::Object::Ptr object) , m_object(object) { #ifdef KROSS_PYTHON_EXTENSION_CTOR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::Constructor objectname='%1' objectclass='%2'").tqarg(m_object->getName()).tqarg(m_object->getClassName()) ); + krossdebug( TQString("Kross::Python::PythonExtension::Constructor objectname='%1' objectclass='%2'").arg(m_object->getName()).arg(m_object->getClassName()) ); #endif behaviors().name("KrossPythonExtension"); @@ -55,7 +55,7 @@ PythonExtension::PythonExtension(Kross::Api::Object::Ptr object) PythonExtension::~PythonExtension() { #ifdef KROSS_PYTHON_EXTENSION_DTOR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::Destructor objectname='%1' objectclass='%2'").tqarg(m_object->getName()).tqarg(m_object->getClassName()) ); + krossdebug( TQString("Kross::Python::PythonExtension::Destructor objectname='%1' objectclass='%2'").arg(m_object->getName()).arg(m_object->getClassName()) ); #endif delete m_proxymethod; } @@ -77,7 +77,7 @@ Py::Object PythonExtension::repr() Py::Object PythonExtension::getattr(const char* n) { #ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1'").tqarg(n) ); + krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1'").arg(n) ); #endif if(n[0] == '_') { @@ -86,7 +86,7 @@ Py::Object PythonExtension::getattr(const char* n) TQStringList calls = m_object->getCalls(); for(TQStringList::Iterator it = calls.begin(); it != calls.end(); ++it) { #ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' callable='%2'").tqarg(n).tqarg(*it) ); + krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' callable='%2'").arg(n).arg(*it) ); #endif methods.append(Py::String( (*it).latin1() )); } @@ -97,11 +97,11 @@ Py::Object PythonExtension::getattr(const char* n) Py::List members; Kross::Api::Callable* callable = dynamic_cast<Kross::Api::Callable*>(m_object.data()); if(callable) { - TQMap<TQString, Kross::Api::Object::Ptr> tqchildren = callable->getChildren(); - TQMap<TQString, Kross::Api::Object::Ptr>::Iterator it( tqchildren.begin() ); - for(; it != tqchildren.end(); ++it) { + TQMap<TQString, Kross::Api::Object::Ptr> children = callable->getChildren(); + TQMap<TQString, Kross::Api::Object::Ptr>::Iterator it( children.begin() ); + for(; it != children.end(); ++it) { #ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::getattr n='%1' child='%2'").tqarg(n).tqarg(it.key()) ); + krossdebug( TQString("Kross::Python::PythonExtension::getattr n='%1' child='%2'").arg(n).arg(it.key()) ); #endif members.append(Py::String( it.key().latin1() )); } @@ -109,11 +109,11 @@ Py::Object PythonExtension::getattr(const char* n) return members; } - //if(n == "__dict__") { krosswarning( TQString("PythonExtension::getattr(%1) __dict__").tqarg(n) ); return Py::None(); } - //if(n == "__class__") { krosswarning( TQString("PythonExtension::getattr(%1) __class__").tqarg(n) ); return Py::None(); } + //if(n == "__dict__") { krosswarning( TQString("PythonExtension::getattr(%1) __dict__").arg(n) ); return Py::None(); } + //if(n == "__class__") { krosswarning( TQString("PythonExtension::getattr(%1) __class__").arg(n) ); return Py::None(); } #ifdef KROSS_PYTHON_EXTENSION_GETATTR_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' is a internal name.").tqarg(n) ); + krossdebug( TQString("Kross::Python::PythonExtension::getattr name='%1' is a internal name.").arg(n) ); #endif return Py::PythonExtension<PythonExtension>::getattr_methods(n); } @@ -130,7 +130,7 @@ Py::Object PythonExtension::getattr(const char* n) Py::Object PythonExtension::getattr_methods(const char* n) { #ifdef KROSS_PYTHON_EXTENSION_GETATTRMETHOD_DEBUG - krossdebug( TQString("PythonExtension::getattr_methods name=%1").tqarg(n) ); + krossdebug( TQString("PythonExtension::getattr_methods name=%1").arg(n) ); #endif return Py::PythonExtension<PythonExtension>::getattr_methods(n); } @@ -138,7 +138,7 @@ Py::Object PythonExtension::getattr_methods(const char* n) int PythonExtension::setattr(const char* name, const Py::Object& value) { #ifdef KROSS_PYTHON_EXTENSION_SETATTR_DEBUG - krossdebug( TQString("PythonExtension::setattr name=%1 value=%2").tqarg(name).tqarg(value.as_string().c_str()) ); + krossdebug( TQString("PythonExtension::setattr name=%1 value=%2").arg(name).arg(value.as_string().c_str()) ); #endif return Py::PythonExtension<PythonExtension>::setattr(name, value); } @@ -185,13 +185,13 @@ Kross::Api::Dict::Ptr PythonExtension::toObject(const Py::Dict& dict) Kross::Api::Object::Ptr PythonExtension::toObject(const Py::Object& object) { #ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) object='%1'").tqarg(object.as_string().c_str()) ); + krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) object='%1'").arg(object.as_string().c_str()) ); #endif if(object == Py::None()) return 0; PyTypeObject *type = (PyTypeObject*) object.type().ptr(); #ifdef KROSS_PYTHON_EXTENSION_TOOBJECT_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) type='%1'").tqarg(type->tp_name) ); + krossdebug( TQString("Kross::Python::PythonExtension::toObject(Py::Object) type='%1'").arg(type->tp_name) ); #endif if(type == &PyInt_Type) return new Kross::Api::Variant(int(Py::Int(object))); @@ -287,7 +287,7 @@ const Py::List PythonExtension::toPyObject(const TQValueList<TQVariant>& list) const Py::Object PythonExtension::toPyObject(const TQVariant& variant) { #ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) typename='%1'").tqarg(variant.typeName()) ); + krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) typename='%1'").arg(variant.typeName()) ); #endif switch(variant.type()) { @@ -331,7 +331,7 @@ const Py::Object PythonExtension::toPyObject(const TQVariant& variant) } break; default: { - krosswarning( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) Not possible to convert the TQVariant type '%1' to a Py::Object.").tqarg(variant.typeName()) ); + krosswarning( TQString("Kross::Python::PythonExtension::toPyObject(TQVariant) Not possible to convert the TQVariant type '%1' to a Py::Object.").arg(variant.typeName()) ); return Py::None(); } } @@ -350,7 +350,7 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object) if(classname == "Kross::Api::Variant") { TQVariant v = static_cast<Kross::Api::Variant*>( object.data() )->getValue(); #ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(Kross::Api::Object) is Kross::Api::Variant %1").tqarg(v.toString()) ); + krossdebug( TQString("Kross::Python::PythonExtension::toPyObject(Kross::Api::Object) is Kross::Api::Variant %1").arg(v.toString()) ); #endif return toPyObject(v); } @@ -382,7 +382,7 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object) } #ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG - krossdebug( TQString("Trying to handle PythonExtension::toPyObject(%1) as PythonExtension").tqarg(object->getClassName()) ); + krossdebug( TQString("Trying to handle PythonExtension::toPyObject(%1) as PythonExtension").arg(object->getClassName()) ); #endif return Py::asObject( new PythonExtension(object) ); } @@ -390,7 +390,7 @@ const Py::Object PythonExtension::toPyObject(Kross::Api::Object::Ptr object) const Py::Tuple PythonExtension::toPyTuple(Kross::Api::List::Ptr list) { #ifdef KROSS_PYTHON_EXTENSION_TOPYOBJECT_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::toPyTuple(Kross::Api::List) name='%1'").tqarg(list ? list->getName() : "NULL") ); + krossdebug( TQString("Kross::Python::PythonExtension::toPyTuple(Kross::Api::List) name='%1'").arg(list ? list->getName() : "NULL") ); #endif uint count = list ? list->count() : 0; Py::Tuple tuple(count); @@ -409,20 +409,20 @@ PyObject* PythonExtension::proxyhandler(PyObject *_self_and_name_tuple, PyObject Kross::Api::List::Ptr arguments = toObject( Py::Tuple(args) ); #ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' arguments='%2'").tqarg(methodname).tqarg(arguments->toString()) ); + krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' arguments='%2'").arg(methodname).arg(arguments->toString()) ); #endif Kross::Api::Callable* callable = dynamic_cast<Kross::Api::Callable*>(self->m_object.data()); if(callable && callable->hasChild(methodname)) { #ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' is a child object of '%2'.").tqarg(methodname).tqarg(self->m_object->getName()) ); + krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler methodname='%1' is a child object of '%2'.").arg(methodname).arg(self->m_object->getName()) ); #endif Py::Object result = toPyObject( callable->getChild(methodname)->call(TQString(), arguments) ); result.increment_reference_count(); return result.ptr(); } #ifdef KROSS_PYTHON_EXTENSION_CALL_DEBUG - krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler try to call function with methodname '%1' in object '%2'.").tqarg(methodname).tqarg(self->m_object->getName()) ); + krossdebug( TQString("Kross::Python::PythonExtension::proxyhandler try to call function with methodname '%1' in object '%2'.").arg(methodname).arg(self->m_object->getName()) ); #endif Py::Object result = toPyObject( self->m_object->call(methodname, arguments) ); result.increment_reference_count(); @@ -430,12 +430,12 @@ PyObject* PythonExtension::proxyhandler(PyObject *_self_and_name_tuple, PyObject } catch(Py::Exception& e) { const TQString err = Py::value(e).as_string().c_str(); - krosswarning( TQString("Py::Exception in Kross::Python::PythonExtension::proxyhandler %1").tqarg(err) ); + krosswarning( TQString("Py::Exception in Kross::Python::PythonExtension::proxyhandler %1").arg(err) ); //throw e; } catch(Kross::Api::Exception::Ptr e) { const TQString err = e->toString(); - krosswarning( TQString("Kross::Api::Exception in Kross::Python::PythonExtension::proxyhandler %1").tqarg(err) ); + krosswarning( TQString("Kross::Api::Exception in Kross::Python::PythonExtension::proxyhandler %1").arg(err) ); // Don't throw here cause it will end in a crash deep in python. The // error is already handled anyway. //throw Py::Exception( (char*) e->toString().latin1() ); diff --git a/lib/kross/python/pythoninterpreter.cpp b/lib/kross/python/pythoninterpreter.cpp index 23f4b8fb..ded5dbc9 100644 --- a/lib/kross/python/pythoninterpreter.cpp +++ b/lib/kross/python/pythoninterpreter.cpp @@ -122,14 +122,14 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info) // Set the extended sys.path. PySys_SetPath( (char*) path.latin1() ); - krossdebug(TQString("Python ProgramName: %1").tqarg(Py_GetProgramName())); - krossdebug(TQString("Python ProgramFullPath: %1").tqarg(Py_GetProgramFullPath())); - krossdebug(TQString("Python Version: %1").tqarg(Py_GetVersion())); - krossdebug(TQString("Python Platform: %1").tqarg(Py_GetPlatform())); - krossdebug(TQString("Python Prefix: %1").tqarg(Py_GetPrefix())); - krossdebug(TQString("Python ExecPrefix: %1").tqarg(Py_GetExecPrefix())); - krossdebug(TQString("Python Path: %1").tqarg(Py_GetPath())); - krossdebug(TQString("Python System Path: %1").tqarg(path)); + krossdebug(TQString("Python ProgramName: %1").arg(Py_GetProgramName())); + krossdebug(TQString("Python ProgramFullPath: %1").arg(Py_GetProgramFullPath())); + krossdebug(TQString("Python Version: %1").arg(Py_GetVersion())); + krossdebug(TQString("Python Platform: %1").arg(Py_GetPlatform())); + krossdebug(TQString("Python Prefix: %1").arg(Py_GetPrefix())); + krossdebug(TQString("Python ExecPrefix: %1").arg(Py_GetExecPrefix())); + krossdebug(TQString("Python Path: %1").arg(Py_GetPath())); + krossdebug(TQString("Python System Path: %1").arg(path)); // Initialize the main module. d->mainmodule = new PythonModule(this); @@ -179,7 +179,7 @@ PythonInterpreter::PythonInterpreter(Kross::Api::InterpreterInfo* info) PyObject* pyrun = PyRun_String(s.latin1(), Py_file_input, moduledict.ptr(), moduledict.ptr()); if(! pyrun) { Py::Object errobj = Py::value(Py::Exception()); // get last error - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to prepare the __main__ module: %1").tqarg(errobj.as_string().c_str())) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to prepare the __main__ module: %1").arg(errobj.as_string().c_str())) ); } Py_XDECREF(pyrun); // free the reference. diff --git a/lib/kross/python/pythonmodule.cpp b/lib/kross/python/pythonmodule.cpp index 24b43159..48131bb8 100644 --- a/lib/kross/python/pythonmodule.cpp +++ b/lib/kross/python/pythonmodule.cpp @@ -65,7 +65,7 @@ PythonModule::PythonModule(PythonInterpreter* interpreter) PythonModule::~PythonModule() { #ifdef KROSS_PYTHON_MODULE_DEBUG - krossdebug( TQString("Kross::Python::PythonModule::Destructor name='%1'").tqarg(name().c_str()) ); + krossdebug( TQString("Kross::Python::PythonModule::Destructor name='%1'").arg(name().c_str()) ); #endif delete d; @@ -82,16 +82,16 @@ Py::Object PythonModule::import(const Py::Tuple& args) TQString modname = args[0].as_string().c_str(); if(modname.startsWith("kross")) { #ifdef KROSS_PYTHON_MODULE_DEBUG - krossdebug( TQString("Kross::Python::PythonModule::import() module=%1").tqarg(modname) ); + krossdebug( TQString("Kross::Python::PythonModule::import() module=%1").arg(modname) ); #endif if( modname.find( TQRegExp("[^a-zA-Z0-9\\_\\-]") ) >= 0 ) { - krosswarning( TQString("Denied import of Kross module '%1' cause of untrusted chars.").tqarg(modname) ); + krosswarning( TQString("Denied import of Kross module '%1' cause of untrusted chars.").arg(modname) ); } else { Kross::Api::Module::Ptr module = Kross::Api::Manager::scriptManager()->loadModule(modname); if(module) return PythonExtension::toPyObject( Kross::Api::Object::Ptr(module) ); - krosswarning( TQString("Loading of Kross module '%1' failed.").tqarg(modname) ); + krosswarning( TQString("Loading of Kross module '%1' failed.").arg(modname) ); } } diff --git a/lib/kross/python/pythonobject.cpp b/lib/kross/python/pythonobject.cpp index 9689d222..e72ad0bb 100644 --- a/lib/kross/python/pythonobject.cpp +++ b/lib/kross/python/pythonobject.cpp @@ -46,7 +46,7 @@ PythonObject::PythonObject(const Py::Object& object) if(o.isSequence()) t += "isSequence "; if(o.isTrue()) t += "isTrue "; if(o.isInstance()) t += "isInstance "; - krossdebug( TQString("PythonObject::PythonObject() method '%1' (%2)").tqarg( (*i).str().as_string().c_str() ).tqarg(t) ); + krossdebug( TQString("PythonObject::PythonObject() method '%1' (%2)").arg( (*i).str().as_string().c_str() ).arg(t) ); if(o.isCallable()) m_calls.append( (*i).str().as_string().c_str() ); @@ -64,7 +64,7 @@ const TQString PythonObject::getClassName() const Kross::Api::Object::Ptr PythonObject::call(const TQString& name, Kross::Api::List::Ptr arguments) { - krossdebug( TQString("PythonObject::call(%1)").tqarg(name) ); + krossdebug( TQString("PythonObject::call(%1)").arg(name) ); if(m_pyobject.isInstance()) { //if(! m_calls.contains(n)) throw ... @@ -72,11 +72,11 @@ Kross::Api::Object::Ptr PythonObject::call(const TQString& name, Kross::Api::Lis PyObject* r = PyObject_CallMethod(m_pyobject.ptr(), (char*) name.latin1(), 0); if(! r) { //FIXME happens too if e.g. number of arguments doesn't match !!! Py::Object errobj = Py::value(Py::Exception()); // get last error - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to call method '%1': %2").tqarg(name).tqarg(errobj.as_string().c_str())) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to call method '%1': %2").arg(name).arg(errobj.as_string().c_str())) ); } Py::Object result(r, true); - //krossdebug( TQString("PythonObject::call(%1) call return value = '%2'").tqarg(name).tqarg(result.as_string().c_str()) ); + //krossdebug( TQString("PythonObject::call(%1) call return value = '%2'").arg(name).arg(result.as_string().c_str()) ); return PythonExtension::toObject(result); } /*TODO??? ELSE create class instance for class-definitions??? diff --git a/lib/kross/python/pythonscript.cpp b/lib/kross/python/pythonscript.cpp index 2329a1d1..8887e13d 100644 --- a/lib/kross/python/pythonscript.cpp +++ b/lib/kross/python/pythonscript.cpp @@ -88,7 +88,7 @@ void PythonScript::initialize() try { if(m_scriptcontainer->getCode().isNull()) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Invalid scripting code for script '%1'").tqarg( m_scriptcontainer->getName() )) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Invalid scripting code for script '%1'").arg( m_scriptcontainer->getName() )) ); if(m_scriptcontainer->getName().isNull()) throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Name for the script is invalid!")) ); @@ -96,10 +96,10 @@ void PythonScript::initialize() PyObject* pymod = PyModule_New( (char*) m_scriptcontainer->getName().latin1() ); d->m_module = new Py::Module(pymod, true); if(! d->m_module) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize local module context for script '%1'").tqarg( m_scriptcontainer->getName() )) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize local module context for script '%1'").arg( m_scriptcontainer->getName() )) ); #ifdef KROSS_PYTHON_SCRIPT_INIT_DEBUG - krossdebug( TQString("PythonScript::initialize() module='%1' refcount='%2'").tqarg(d->m_module->as_string().c_str()).tqarg(d->m_module->reference_count()) ); + krossdebug( TQString("PythonScript::initialize() module='%1' refcount='%2'").arg(d->m_module->as_string().c_str()).arg(d->m_module->reference_count()) ); #endif // Set the "self" variable to point to the ScriptContainer @@ -131,7 +131,7 @@ void PythonScript::initialize() PyObject* code = 0; bool restricted = m_scriptcontainer->getOption("restricted", TQVariant(false,0), true).toBool(); - krossdebug( TQString("PythonScript::initialize() name=%1 restricted=%2").tqarg(m_scriptcontainer->getName()).tqarg(restricted) ); + krossdebug( TQString("PythonScript::initialize() name=%1 restricted=%2").arg(m_scriptcontainer->getName()).arg(restricted) ); if(restricted) { // Use the RestrictedPython module wrapped by the PythonSecurity class. @@ -160,7 +160,7 @@ void PythonScript::initialize() } catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); - Kross::Api::Exception::Ptr exception = toException( TQString("Failed to compile python code: %1").tqarg(err) ); + Kross::Api::Exception::Ptr exception = toException( TQString("Failed to compile python code: %1").arg(err) ); e.clear(); // exception is handled. clear it now. throw exception; } @@ -170,7 +170,7 @@ void PythonScript::finalize() { #ifdef KROSS_PYTHON_SCRIPT_FINALIZE_DEBUG if(d->m_module) - krossdebug( TQString("PythonScript::finalize() module='%1' refcount='%2'").tqarg(d->m_module->as_string().c_str()).tqarg(d->m_module->reference_count()) ); + krossdebug( TQString("PythonScript::finalize() module='%1' refcount='%2'").arg(d->m_module->as_string().c_str()).arg(d->m_module->reference_count()) ); #endif delete d->m_module; d->m_module = 0; @@ -205,7 +205,7 @@ Kross::Api::Exception::Ptr PythonScript::toException(const TQString& error) catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); e.clear(); // exception is handled. clear it now. - krosswarning( TQString("Kross::Python::PythonScript::toException() Failed to fetch a traceback: %1").tqarg(err) ); + krosswarning( TQString("Kross::Python::PythonScript::toException() Failed to fetch a traceback: %1").arg(err) ); } PyObject *next; @@ -226,7 +226,7 @@ Kross::Api::Exception::Ptr PythonScript::toException(const TQString& error) //const char* filename = PyString_AsString(frame->f_code->co_filename); //const char* name = PyString_AsString(frame->f_code->co_name); - //errorlist.append( TQString("%1#%2: \"%3\"").tqarg(filename).tqarg(lineno).tqarg(name) ); + //errorlist.append( TQString("%1#%2: \"%3\"").arg(filename).arg(lineno).arg(name) ); next = PyObject_GetAttrString(traceback, "tb_next"); Py_DECREF(traceback); @@ -318,20 +318,20 @@ Kross::Api::Object::Ptr PythonScript::execute() Py::Object result(pyresult, true); #ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG - krossdebug( TQString("PythonScript::execute() result=%1").tqarg(result.as_string().c_str()) ); + krossdebug( TQString("PythonScript::execute() result=%1").arg(result.as_string().c_str()) ); #endif for(Py::Dict::iterator it = moduledict.begin(); it != moduledict.end(); ++it) { Py::Dict::value_type vt(*it); if(PyClass_Check( vt.second.ptr() )) { #ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG - krossdebug( TQString("PythonScript::execute() class '%1' added.").tqarg(vt.first.as_string().c_str()) ); + krossdebug( TQString("PythonScript::execute() class '%1' added.").arg(vt.first.as_string().c_str()) ); #endif d->m_classes.append( vt.first.as_string().c_str() ); } else if(vt.second.isCallable()) { #ifdef KROSS_PYTHON_SCRIPT_EXEC_DEBUG - krossdebug( TQString("PythonScript::execute() function '%1' added.").tqarg(vt.first.as_string().c_str()) ); + krossdebug( TQString("PythonScript::execute() function '%1' added.").arg(vt.first.as_string().c_str()) ); #endif d->m_functions.append( vt.first.as_string().c_str() ); } @@ -347,13 +347,13 @@ Kross::Api::Object::Ptr PythonScript::execute() errobj = Py::type(e); TQString err = errobj.as_string().c_str(); - Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").tqarg(err) ); + Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").arg(err) ); e.clear(); // exception is handled. clear it now. setException( exception ); } catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); - Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").tqarg(err) ); + Kross::Api::Exception::Ptr exception = toException( TQString("Failed to execute python code: %1").arg(err) ); e.clear(); // exception is handled. clear it now. setException( exception ); } @@ -369,8 +369,8 @@ Kross::Api::Object::Ptr PythonScript::callFunction(const TQString& name, Kross:: { #ifdef KROSS_PYTHON_SCRIPT_CALLFUNC_DEBUG krossdebug( TQString("PythonScript::callFunction(%1, %2)") - .tqarg(name) - .tqarg(args ? TQString::number(args->count()) : TQString("NULL")) ); + .arg(name) + .arg(args ? TQString::number(args->count()) : TQString("NULL")) ); #endif if(hadException()) return 0; // abort if we had an unresolved exception. @@ -387,7 +387,7 @@ Kross::Api::Object::Ptr PythonScript::callFunction(const TQString& name, Kross:: PyObject* func = PyDict_GetItemString(moduledict.ptr(), name.latin1()); if( (! d->m_functions.contains(name)) || (! func) ) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").tqarg(name)) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").arg(name)) ); Py::Callable funcobject(func, true); // the funcobject takes care of freeing our func pyobject. @@ -402,7 +402,7 @@ Kross::Api::Object::Ptr PythonScript::callFunction(const TQString& name, Kross:: catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); e.clear(); // exception is handled. clear it now. - setException( new Kross::Api::Exception(TQString("Python Exception: %1").tqarg(err)) ); + setException( new Kross::Api::Exception(TQString("Python Exception: %1").arg(err)) ); } catch(Kross::Api::Exception::Ptr e) { setException(e); @@ -433,16 +433,16 @@ Kross::Api::Object::Ptr PythonScript::classInstance(const TQString& name) // Try to determinate the class. PyObject* pyclass = PyDict_GetItemString(moduledict.ptr(), name.latin1()); if( (! d->m_classes.contains(name)) || (! pyclass) ) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such class '%1'.").tqarg(name)) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such class '%1'.").arg(name)) ); PyObject *pyobj = PyInstance_New(pyclass, 0, 0);//aclarg, 0); if(! pyobj) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to create instance of class '%1'.").tqarg(name)) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to create instance of class '%1'.").arg(name)) ); Py::Object classobject(pyobj, true); #ifdef KROSS_PYTHON_SCRIPT_CLASSINSTANCE_DEBUG - krossdebug( TQString("PythonScript::classInstance() inst='%1'").tqarg(classobject.as_string().c_str()) ); + krossdebug( TQString("PythonScript::classInstance() inst='%1'").arg(classobject.as_string().c_str()) ); #endif return PythonExtension::toObject(classobject); } diff --git a/lib/kross/python/pythonsecurity.cpp b/lib/kross/python/pythonsecurity.cpp index 941ed0c6..9a7712cb 100644 --- a/lib/kross/python/pythonsecurity.cpp +++ b/lib/kross/python/pythonsecurity.cpp @@ -90,7 +90,7 @@ void PythonSecurity::initRestrictedPython() catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); e.clear(); - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize PythonSecurity module: %1").tqarg(err) ) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Failed to initialize PythonSecurity module: %1").arg(err) ) ); } } @@ -115,12 +115,12 @@ PyObject* PythonSecurity::compile_restricted(const TQString& source, const TQStr PyObject* func = PyDict_GetItemString(m_pymodule->getDict().ptr(), "compile_restricted"); if(! func) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").tqarg("compile_restricted")) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("No such function '%1'.").arg("compile_restricted")) ); Py::Callable funcobject(func, true); // the funcobject takes care of freeing our func pyobject. if(! funcobject.isCallable()) - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' is not callable.").tqarg("compile_restricted")) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' is not callable.").arg("compile_restricted")) ); Py::Tuple args(3); args[0] = Py::String(source.utf8()); @@ -140,17 +140,17 @@ PyObject* PythonSecurity::compile_restricted(const TQString& source, const TQStr /* Py::List ml = mainmoduledict; for(Py::List::size_type mi = 0; mi < ml.length(); ++mi) { - krossdebug( TQString("dir() = %1").tqarg( ml[mi].str().as_string().c_str() ) ); - //krossdebug( TQString("dir().dir() = %1").tqarg( Py::Object(ml[mi]).dir().as_string().c_str() ) ); + krossdebug( TQString("dir() = %1").arg( ml[mi].str().as_string().c_str() ) ); + //krossdebug( TQString("dir().dir() = %1").arg( Py::Object(ml[mi]).dir().as_string().c_str() ) ); } */ Py::Object code(pycode); - krossdebug( TQString("%1 callable=%2").tqarg(code.as_string().c_str()).tqarg(PyCallable_Check(code.ptr())) ); + krossdebug( TQString("%1 callable=%2").arg(code.as_string().c_str()).arg(PyCallable_Check(code.ptr())) ); Py::List l = code.dir(); for(Py::List::size_type i = 0; i < l.length(); ++i) { - krossdebug( TQString("dir() = %1").tqarg( l[i].str().as_string().c_str() ) ); - //krossdebug( TQString("dir().dir() = %1").tqarg( Py::Object(l[i]).dir().as_string().c_str() ) ); + krossdebug( TQString("dir() = %1").arg( l[i].str().as_string().c_str() ) ); + //krossdebug( TQString("dir().dir() = %1").arg( Py::Object(l[i]).dir().as_string().c_str() ) ); } return pycode; @@ -158,7 +158,7 @@ PyObject* PythonSecurity::compile_restricted(const TQString& source, const TQStr catch(Py::Exception& e) { TQString err = Py::value(e).as_string().c_str(); e.clear(); - throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' failed with python exception: %2").tqarg("compile_restricted").tqarg(err) ) ); + throw Kross::Api::Exception::Ptr( new Kross::Api::Exception(TQString("Function '%1' failed with python exception: %2").arg("compile_restricted").arg(err) ) ); } } |