diff --git a/sloth/items/factory.py b/sloth/items/factory.py index d3b8195..d622819 100644 --- a/sloth/items/factory.py +++ b/sloth/items/factory.py @@ -32,6 +32,7 @@ class Factory: item: python callable or string Reference to the callable which creates the new object. """ + _type = str(_type) if _type in self.items_ and not replace: raise Exception("Type %s already has an item: %s" % \ (_type, str(self.items_[_type]))) @@ -50,6 +51,7 @@ class Factory: Type for which the mapping should be removed. If None, all mappings will be removed. """ + _type = str(_type) if _type is None: self.items_ = {} else: @@ -73,6 +75,7 @@ class Factory: Newly created object. If for the given type no mapping exists, this function returns ``None``. """ + _type = str(_type) if _type not in self.items_: return None item = self.items_[_type]