Re: [dabo-users] Problem with custom sql-statement and getDataSet() with version>0.9.3

Author: Max Voß

Posted: 2013-05-03 at 10:40:28

Am Freitag, den 03.05.2013, 06:19 -0700 schrieb Paul McNett:

> This is indeed baffling. Either Please put in some sanity checks:

>

> 272 print 1, self, field_val, "field_val: %s" %(_field_val)

> 273 print 2, self, self._field_val.split("."), len(_field_val.split(".")[1])

> 274 if scale is None:

> 275 try:

> 276 scale = len(_field_val.split(".")[1])

> 277 except (IndexError, AttributeError):

> 278 scale = 2

> 279 print 3, self, _field_val, scale, "_field_val: %s scale: %s" % (_field_val,

> scale, )

> Please copy/paste the output of the above.

>

Alright I pasted exactly your sanity checks and got:

1 <dabo.biz.dBizobj.cursorMix (baseclass dabo.biz.dBizobj.cursorMix,

id:193569036)> 135.0 field_val: 135.0

2 <dabo.biz.dBizobj.cursorMix (baseclass dabo.biz.dBizobj.cursorMix,

id:193569036)>

Traceback (most recent call last):

File

"/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dControlMixin.py", line

27, in _onWxHit

self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dPemMixin.py",

line 1074, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,

**kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/lib/eventMixin.py", line

81, in raiseEvent

bindingFunction(event)

File "/tmp/tmpy9LLo7.py", line 4994, in onHit

ds_artikel = tmpCursor.getDataSet()

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

1400, in getDataSet

_correctFieldTypesIfNeeded(rec)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

219, in _correctFieldTypesIfNeeded

rec[fld_name] = _correctFieldType(rec[fld_name], fld_name)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

272, in _correctFieldType

print 2, self, self._field_val.split("."),

len(_field_val.split(".")[1])

AttributeError: 'cursorMix' object has no attribute '_field_val'

x^Cmake: *** [main] Unterbrechung

When I change line 273 to:

273 print 2, self, _field_val.split("."),

len(_field_val.split(".")[1])

What is probably what you wanted anyway, the result is:

1 <dabo.biz.dBizobj.cursorMix (baseclass dabo.biz.dBizobj.cursorMix,

id:177109548)> 135.0 field_val: 135.0

2 <dabo.biz.dBizobj.cursorMix (baseclass dabo.biz.dBizobj.cursorMix,

id:177109548)> [u'135', u'0'] 1

3 <dabo.biz.dBizobj.cursorMix (baseclass dabo.biz.dBizobj.cursorMix,

id:177109548)> 135.0 31 _field_val: 135.0 scale: 31

Traceback (most recent call last):

File

"/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dControlMixin.py", line

27, in _onWxHit

self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/ui/uiwx/dPemMixin.py",

line 1074, in raiseEvent

super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args,

**kwargs)

File "/home/max/projekte/kolibrill/dabo/dabo/lib/eventMixin.py", line

81, in raiseEvent

bindingFunction(event)

File "/tmp/tmpaTnLb8.py", line 4994, in onHit

ds_artikel = tmpCursor.getDataSet()

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

1400, in getDataSet

_correctFieldTypesIfNeeded(rec)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

219, in _correctFieldTypesIfNeeded

rec[fld_name] = _correctFieldType(rec[fld_name], fld_name)

File "/home/max/projekte/kolibrill/dabo/dabo/db/dCursorMixin.py", line

281, in _correctFieldType

return dec.quantize(Decimal("0.%s" % (scale * "0",)))

File "/usr/lib/python2.6/decimal.py", line 2358, in quantize

'quantize result has too many digits for current context')

File "/usr/lib/python2.6/decimal.py", line 3778, in _raise_error

raise error(explanation)

decimal.InvalidOperation: quantize result has too many digits for

current context

> Also, you say nothing else changed in the code or database from 0.9.3 to 0.9.5. I'd

> like to find out the commit where the behavior changed. By any chance are you using git?

>

> Thanks

> Paul

I changed nothing else as far as I know, I just wanted to have the new

dabo-version since you removed a GUI-bug I put in the issue-tracker. I

also switched from your old svn-repo to your new git-repo in the same

step.

And yes I am a big git-fan, but I use my own git server, not a public

one and I would have to anonymize my data before I give you access. I am

ashamed to tell, but I was to lazy to create a database with test-data

so I always used a copy of my live-one, but I have to change that anyway

so I will tell you as soon as I got one.

Max

_______________________________________________

Post Messages to: Dabo-users@leafe.com

Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-users

Searchable Archives: http://leafe.com/archives/search/dabo-users

This message: http://leafe.com/archives/byMID/1367595628.3654.127.camel@t60

©2013 Max Voß