fix factory mapping when using QString as arguments

This commit is contained in:
Martin Baeuml
2011-06-29 15:40:41 +02:00
parent bd0ed4d601
commit dca319a919
+3
View File
@@ -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]