Skip to content
Snippets Groups Projects
Commit e183e699 authored by Bob Lantz's avatar Bob Lantz
Browse files

Check for Controller type using isinstance()

parent 2a08dec6
No related branches found
No related tags found
No related merge requests found
...@@ -246,7 +246,7 @@ def addController( self, name='c0', controller=None, **params ): ...@@ -246,7 +246,7 @@ def addController( self, name='c0', controller=None, **params ):
if not controller: if not controller:
controller = self.controller controller = self.controller
# Construct new controller if one is not given # Construct new controller if one is not given
if issubclass( name.__class__, Controller ): if isinstance( name, Controller ):
controller_new = name controller_new = name
# Pylint thinks controller is a str() # Pylint thinks controller is a str()
# pylint: disable=E1103 # pylint: disable=E1103
...@@ -358,7 +358,7 @@ def buildFromTopo( self, topo=None ): ...@@ -358,7 +358,7 @@ def buildFromTopo( self, topo=None ):
classes = [ classes ] classes = [ classes ]
for i, cls in enumerate( classes ): for i, cls in enumerate( classes ):
# Allow Controller objects because nobody understands currying # Allow Controller objects because nobody understands currying
if issubclass( cls.__class__, Controller ): if isinstance( cls, Controller ):
self.addController( cls ) self.addController( cls )
else: else:
self.addController( 'c%d' % i, cls ) self.addController( 'c%d' % i, cls )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment