def __call__(self, req): context = Location() directlyProvides(context, IPublicationRoot) form = Interface(context, req, name=self.formname) return form()
input("Ingrese la posicion en la que se va a insertar: ")) try: coleccion.insertarElemento(numero, pos) except ErrorPosicion as e: print( "El numero {} no pudo ser insertado debido al siguiente error:" .format(e.getElemento())) print(e.getMensaje()) elif op == 2: numero = int(input("Ingrese un numero a agregar al final: ")) coleccion.agregarElemento(numero) elif op == 3: pos = int(input("Ingrese la posicion del numero a mostrar: ")) try: print(coleccion.mostrarElemento(pos)) except ErrorPosicion as e: print( "El numero {} no pudo ser mostrado debido al siguiente error:" .format(e.getElemento())) print(e.getMensaje()) elif op == 0: flag = True else: print("Opcion no valida") if __name__ == "__main__": c = Coleccion() Interface(IColeccion(c))