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's right. I thought you were merely removing semi-redundant code, not changing the code. dt should never be anything but a datetime or None. If it is something else, an exception should occur, which is what was happening, so the old way was correct. The fact that an exception occurred doesn't necessarily mean it is the fault of CalPanel. In this case, it appears to be because your bizobj.new() is making the new value a u'' instead of None or a datetime.date. So now we must determine if this is a bug in dBizobj (could very well be) or in your code. Paul -- http://paulmcnett.com _______________________________________________ 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]
