Maram wrote: > Max Ischenko escribió: > > Try to replace line > > lectura.set(consumo=datos['consumo']) > > with > > lectura.consumo = datos['consumo'] > > and post traceback if any > > > > > > thanks to all! > > > the next code is ok! > > lectura.set(periodo=datos['periodo'], > consumo=datos['consumo'], > ) > > in model: > periodo=UnicodeCol( length=6, notNone=True) > consumo=IntCol(default=0) > > but in the fields/form: > > consumo=TextField(label="Consumo",validator=v.Int) > periodo = TextField(label="Periodo: yyyymm", validator=v.Int) > ------------------------------------------------------^^^^^^ > > periodo is not integer in the model. > The traceback show error in field 'consumo' or another one, but really > the error is in field 'periodo' ... > > sorry for the stupid question...
Is Periodo a date? If so both SQLObject and the validator system have built in constructs for handling dates so you can work with them directly. From what you posted it looks like a date that stores the year and month. It might make it easier if you handle it that way. If not, try changing it so that instead of using "lectura.set" you are accessing the attributes of lectura directly. So this is what your code to set values on lectura would look like: lectura.periodo=datos['periodo'] lectura.consumo=datos['consumo'] hope that helps. -Adam --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TurboGears" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/turbogears -~----------~----~----~----~------~----~------~--~---

