factory: dont register twice a class with the same name.

This commit is contained in:
Mathieu Virbel 2012-10-10 00:45:39 +02:00
parent 7fe67a3ba0
commit e267815bc8
1 changed files with 2 additions and 0 deletions

View File

@ -59,6 +59,8 @@ class FactoryBase(object):
'''
if cls is None and module is None:
raise ValueError('You must specify either cls= or module=')
if classname in self.classes:
return
self.classes[classname] = {
'module': module,
'cls': cls,