Exemple #1
0
def createBlock(typeId, size, data):
    '''
    This method will create a block from the typeId
    '''
    className = BLOCKS[typeId]
    path = "blocks." + className + "." + className
    block = None

    try:
        clazz = import_class(path)
        block = clazz(typeId, size, data)
    except:
        print "Block type not implemented. typeId: %s; Class: %s" % (
            str(typeId), className)

        # Return generic block for now
        block = Block(typeId, size, data)

    return block