def add_child( self, _value ) : # # if _value is a TreeNode, use it # # otherwise we'll create a new TreeNode with _value as __value # # this is in case we want to include other objects in the hieraarchy if( utils.is_subclass( _value, TreeNode ) ) : child = _value else : child = TreeNode( _value=_value ) self._check_tree_children() # child = _value child.__parent = self self.__children.append( child )
def get_entities(name, path=None): models = load_module(name, path=path) return [model for name, model in models.__dict__.iteritems() if is_subclass(model, Entity)]
def is_valid_view(view): return is_subclass(view, View) and hasattr(view, 'url')