papo-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Papo-hackers] Intento mostrar una fecha en un labelEntry y falla.


From: maram
Subject: [Papo-hackers] Intento mostrar una fecha en un labelEntry y falla.
Date: Wed, 6 Oct 2004 15:50:43 -0300

Al intentar cargar una fecha en un labelEntry:

la seteo por defecto en newModel a : today() 
****Valor: 2004-10-05 00:00:00.00

Si a continuacion presiono "guardar" en la pantalla, se guarda sin errores.
pero si ingreso al labelEntry y cambio en el campo fecha el dia 05 por
06 , al presionar "guardar" da el error:

...     action=lambda *ignore: self.save (),
...   File 
"/home/marceloa/src/papo_project/src/cimarron/src/C/ConsistencyController.py",
line 69, in save
...     self.editingContext.saveChanges ()
...   File "/usr/lib/python2.3/site-packages/Modeling/EditingContext.py",
line 737, in saveChanges
...     self.validateChanges()
...   File "/usr/lib/python2.3/site-packages/Modeling/EditingContext.py",
line 765, in validateChanges
...     self.objectForGlobalID(gID).validateForSave()
...   File "/usr/lib/python2.3/site-packages/Modeling/CustomObject.py",
line 595, in validateForSave
...     error.finalize()
...   File "/usr/lib/python2.3/site-packages/Modeling/Validation.py",
line 145, in finalize
...     if self._dict: raise self
... ValidationException: Validation for key receptionDate failed:
... - Wrong type
... Validation for key OBJECT_WIDE_VALIDATION failed:
... - Validation of object <SIGALv1.Reception.Reception object at
0x411380ec> as a whole failed
 

el codigo utilizado es:

Dentro de PantallaABM, en la funcion newModel()

        #Fecha Inicial
        date=today()
        r.setReceptionDate(date)

El labelEntry de la pantalla es:

        self.receptionDate= LabeledEntry (parent=h0,label=u'_Fecha',
                                 orientation=LabeledEntry.vertical,
                                 action=lambda control, *i:
self.setReceptionDate (control.getValue ()),
                                 valueLoader=lambda *i: self.getReceptionDate ()
                                 )

y los set/get son:

    def setReceptionDate (self, value):        
        print "***Valor ",value, type(value)
        self.getModel().setReceptionDate (value)
        
    def getReceptionDate (self):
        value=self.getModel().getReceptionDate ()       
        return value


Tampoco se si tengo que convertirlo a str o date?
Ademas me gustaria que se muestre solo dd/mm/yyyy.

-- 
Marcelo
---------------------------------
Maram Sistemas
Debian Sarge - Linux User: 354777




reply via email to

[Prev in Thread] Current Thread [Next in Thread]