mirror of
https://github.com/wassname/sloth.git
synced 2026-07-09 18:21:07 +08:00
fix factory mapping when using QString as arguments
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user