I haven't checked if this breaks anything in the code, but if you use the default values

    def __init__(self, name='', componentUrl={}):

then you don't need to initialize these variables on lines 30 & 31 and you won't need the check on line 34.