Commit a370801d authored by Jiahang Chen's avatar Jiahang Chen
Browse files

fix class name output problem

parent 170dae2e
Pipeline #360361 passed with stages
in 35 seconds
......@@ -296,7 +296,9 @@ def add_function_impl_obj(thing, impl_obj, feature_name):
)
else:
APP_LOGGER.info("Implementation object is added into the functionality %s" % feature_name)
thing.features[feature_name] = impl_obj(feature_name)
impl_ins = impl_obj()
impl_ins.class_name = feature_name
thing.features[feature_name] = impl_ins
def create_thing(model, grant_type="password",
......
from ml.identifier import ID
import sys
from abc import ABC
import os
class Feature(ABC):
def __init__(self, name="", identifier=""):
self.__name = name
path = sys.modules[__name__].__file__ if __name__ == "__main__" else __file__
if "ml/fml40" in path:
if 'ml\\fml40' in sys.modules[self.__class__.__module__].__file__:
self.__class_name = "fml40::{}".format(self.__class__.__name__)
else:
self.__class_name = "ml40::{}".format(self.__class__.__name__)
......@@ -19,6 +18,10 @@ def __init__(self, name="", identifier=""):
def class_name(self):
return self.__class_name
@class_name.setter
def class_name(self, value):
self.__class_name = value
@property
def name(self):
return self.__name
......
......@@ -6,7 +6,7 @@ class Role(ABC):
def __init__(self, name="", identifier=""):
self.__identifier = ID(identifier).identifier
self.__name = name
if "ml/fml40" in sys.modules[self.__class__.__module__].__file__:
if "ml40\\fml40" in sys.modules[self.__class__.__module__].__file__:
self.__class_name = "fml40::{}".format(self.__class__.__name__)
else:
self.__class_name = "ml40::{}".format(self.__class__.__name__)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment