From e8d14012f538359bb9191ce7e46545ece744609f Mon Sep 17 00:00:00 2001 From: wmayer Date: Wed, 10 May 2017 11:23:34 +0200 Subject: [PATCH] fix implementation of Module attribute --- src/Base/BaseClassPy.xml | 4 ++-- src/Base/BaseClassPyImp.cpp | 12 ++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Base/BaseClassPy.xml b/src/Base/BaseClassPy.xml index 4d21220475..0910354d4c 100644 --- a/src/Base/BaseClassPy.xml +++ b/src/Base/BaseClassPy.xml @@ -34,7 +34,7 @@ Module in which this class is defined - + - + diff --git a/src/Base/BaseClassPyImp.cpp b/src/Base/BaseClassPyImp.cpp index 10a0259a36..14aa396622 100644 --- a/src/Base/BaseClassPyImp.cpp +++ b/src/Base/BaseClassPyImp.cpp @@ -67,9 +67,17 @@ Py::String BaseClassPy::getTypeId(void) const return Py::String(std::string(getBaseClassPtr()->getTypeId().getName())); } -Py::Int BaseClassPy::getModule(void) const +Py::String BaseClassPy::getModule(void) const { - return Py::Int(); + std::string module(getBaseClassPtr()->getTypeId().getName()); + std::string::size_type pos = module.find_first_of("::"); + + if (pos != std::string::npos) + module = std::string(module, 0, pos); + else + module.clear(); + + return Py::String(module); } PyObject *BaseClassPy::getCustomAttributes(const char* attr) const