On Sunday 17 August 2008 3:38:03 pm Adrian Klaver wrote:
> On Sunday 17 August 2008 2:58:17 pm Paul McNett wrote:
> > Adrian Klaver wrote:
> > > Try changing:
> > > self.DefaultValues = {"servicedate": datetime.date.today()}
> > >
> > > to:
> > > self.DefaultValues = {"servicedate": datetime.date.today().isoformat()}
> >
> > If the field is date type, you want the default value to be a date, not
> > a string.
> >
> > However, you probably want it to be:
> > self.DefaultValues = {"servicedate": datetime.date.today}
> >
> > (without the '()' after 'today'). This is so that when the new record is
> > added, Dabo will run that function to get the date to use, instead of
> > always using the value returned from that function when the bizobj was
> > instantiated.
> >
> > This won't resolve the issue of getting that message in the log though.
> >
> > As I said before it sounds like everything is working, but Dabo is
> > erroneously informing you of a problem that doesn't actually exist.
> >
> > Paul
>
> Seems the problem might be here:
Oops forgot to add this is from dCursorMixin.py.
>
> if fldType != type(val):
> ignore = False
> # Date and DateTime types are handled as character, even if the
> # native field type is not. Ignore these. NOTE: we have to deal
> with the
> # string representation of these classes, as there is no primitive
> for either
> # 'DateTime' or 'Date'.
>
> *-->dtStrings=("<type 'DateTime'>", "<type 'Date'>", "<type
> 'datetime.datetime'>")
>
> # --- Need to add "<type 'datetime.date'>" ? ---
>
> if str(fldType) in dtStrings and isinstance(val, basestring):
> ignore = True
> elif isinstance(fldType, basestring) and isinstance(val,
> basestring): ignore = True
> elif val is None or fldType is type(None):
> # Any field type can potentially hold None values (NULL). Ignore
> these.
> ignore = True
> elif isinstance(val, dNoEscQuoteStr):
> # Sometimes you want to set it to a sql function, equation, ect.
> ignore = True
> elif fld in nonUpdateFields:
> # don't worry so much if this is just a calculated field.
> ignore = True
> else:
> # This can also happen with a new record, since we just stuff the
> # fields full of empty strings.
> ignore = self._newRecords.has_key(rec.get(keyField, None))
>
> if not ignore:
> msg = _("!!! Data Type Mismatch: field=%s. Expecting: %s; got:
> %s") \
> % (fld, str(fldType), str(type(val)))
> dabo.errorLog.write(msg)
--
Adrian Klaver
[EMAIL PROTECTED]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]