On Friday 18 January 2008 10:21:01 am Ed Leafe wrote:
> On Jan 18, 2008, at 9:45 AM, johnf wrote:
> > I believe I have discovered a bug in dDateTextBox.
> >
> > class CalPanel(dPanel):
> >     def __init__(self, parent, pos=None, dt=None, ctrl=None ):
> >
> >             if isinstance(dt, (datetime.datetime, datetime.date)):
> >                     self.date = dt
> >             else:
> >                     self.date = datetime.date.today()
> >             #old code!!!!!!!!!!!!
> >             #if dt is None:
> >                     #self.date = datetime.date.today()
> >             #else:
> >                     #self.date = dt
> >             #end old code!!!!!!!!
> >             self.ctrl = ctrl
> >             super(CalPanel, self).__init__(parent, pos=pos)
> >
> > The above fixes an issue when I my passes a u'' as the value of dt.
>
>       The *only* place that CalPanel should be called is from dDateTextBox.
> It should *always* pass its Value to CalPanel. If your date textbox
> has a string as its Value, something is very wrong there; you
> certainly don't want to mask the problem as you are doing here.
>
> -- Ed

As I see it, the real issue is that a new() does not init the dDateTextBox to 
some date or None (None is what the old code had as a test). That said what 
would the default be - some date or None?  At the moment it is a string.

I'm using the following:
SUSE 10.3
python 2.5.1
wxPython 2.8.6.0

The backend has a data type of date.
The table 'public.agvarieties' is a child table.

hs.append(dabo.ui.dDateTextBox(self,RegID='VarStartID',Width=dWidth,DataSource='public.agvarieties',DataField="dstarting"))

I execute a new() on the table (not the form.new()).  Double click (to fire 
the calendar) on the BLANK or  EMPTY  control (self.VarStartID.)

self.VarStartID.Value is u''

The Value is neither None or a date.  So the class fails.

BTW if I tab off the control (lostFocus) I get a string of "<None>" that 
appears.  Still that is a string and not None.



-- 
John Fabiani


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]

Reply via email to