Beginning with r5224, the insert/update statements are properly 
parameterized instead of converting to string first. Thanks for doing 
this, Ed. Indeed, Carl had a ticket for this but unfortunately soon 
after he submitted his patch we made a bunch of incompatible changes and 
so his patch wouldn't cleanly apply, and he never resubmitted an updated 
patch to account for the differences.

Anyway, I'm running into trouble with a legacy app of mine. It turns out 
that the new changes only exposed a problem that's been there all along, 
but I thought I'd mention it as I think we'll see reports on this 
because of how Dabo assigns default dates/datetimes.

Here's the traceback I'm getting upon frm.save():

Dabo Error Log: Mon Nov 16 13:01:54 2009: Error in scanChangedRows: 
year=1 is before 1900; the datetime strftime() methods require year >= 1900
SQL: insert into `payments` (`mnotes`, `tcreated`, `iclientid`, 
`ldeleted`, `ncheckamt`, `cchecknum`, `dcheckdate`) values 
(%s,%s,%s,%s,%s,%s,%s)
Traceback (most recent call last):
   File "/home/pmcnett/dabo/dabo/ui/uiwx/dMenuItem.py", line 57, in 
__onWxHit
     self.raiseEvent(dEvents.Hit, evt)
   File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dPemMixin.py", line 
952, in raiseEvent
     super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
**kwargs)
   File "/home/pmcnett/dabo-full/trunk/dabo/lib/eventMixin.py", line 93, 
in raiseEvent
     bindingFunction(event)
   File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dForm.py", line 716, 
in onSave
     def onSave(self, evt): self.save()
   File "/home/pmcnett/dabo-full/trunk/dabo/lib/datanav/Form.py", line 
65, in save
     ret = super(Form, self).save(dataSource)
   File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dForm.py", line 409, 
in save
     self.notifyUser(msg, severe=True, exception=e)
   File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dForm.py", line 383, 
in save
     bizobj.saveAll()
   File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 378, 
in saveAll
     startTransaction=False)
   File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 803, 
in scanChangedRows
     func(*args, **kwargs)
   File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 436, 
in save
     cursor.save()
   File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
1317, in save
     saverow(self.RowNumber)
   File "/home/pmcnett/dabo-full/trunk/dabo/db/dCursorMixin.py", line 
1294, in saverow
     raise e
dabo.dException.DBQueryException: year=1 is before 1900; the datetime 
strftime() methods require year >= 1900
SQL: insert into `payments` (`mnotes`, `tcreated`, `iclientid`, 
`ldeleted`, `ncheckamt`, `cchecknum`, `dcheckdate`) values 
(%s,%s,%s,%s,%s,%s,%s)

The cause is that the tcreated field is datetime.datetime(1,1,1,0,0,0). 
It is set to this value because I don't give it an explicit default 
value, and Dabo gives a default value of datetime.datetime.min(). 
However, apparently the mysqldb adapter uses 
datetime.datetime.strftime() to convert the datetime to string, but 
strftime() doesn't handle dates before year 1900.

We ran into this trouble before too, and went to using time.strftime() 
which can handle dates down to year 1.

I can solve my issue by just removing the tcreated field from my bizobj 
- I haven't used it for years and its been filling up with 0001-01-01 
dates for all that time.

Paul

_______________________________________________
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/[email protected]

Reply via email to