Re: [dabo-users] AttributeError

Author: jpoorrandp@aol.com

Posted: 2009-07-24 at 14:05:24

BTW, I'm not sure where those question marks are coming from. I checked my files, and those are chr(20) (spaces). (I'm running in Windows).

Jonathan

-----Original Message-----

From: jpoorrandp@aol.com

To: Dabo-users@leafe.com

Sent: Fri, Jul 24, 2009 1:48 pm

Subject: [dabo-users] AttributeError

Dabo folks:

I'm working on the HoursForm part of the "Step by Step" application tutorial.

I've put together the data entry fields, and have entered in the biz obj code

and the code in the afterInit method on the form. I'm getting the error

<<AttributeError: 'NoneType' object has no attribute 'getBizobj'>>

I don't fully understand (on my third day with Dabo) what's going on with the

bizobj stuff.

->I'm using the standard directory structure (created by quickstart)

->I've got "HoursBizobj.py" located in the biz directory

->the HoursBizobj has the code suggested in tutorial:?

??? def getClients(self):

??????? """Return a 2-tuple of lists of the client names and their keys."""

??????? crs = self.getTempCursor()

??????? crs.execute("select pkid, clientname from clients order by clientname")

??????? ds = crs.getDataSet()

??????? # Create the lists

??????? names = [rec["clientname"] for rec in ds]

??????? keys = [rec["pkid"] for rec in ds]

??????? # Add the entry for an undefined (new) client

??????? names.insert(0, "-Please Select a Client-")

??????? keys.insert(0, 0)

??????? return (names, keys)

??? def validateRecord(self):

??????? ret = ""

??????? # Make sure that the user selected a valid client

??????? if self.Record.clientfk == 0:

??????????? ret = "You must select a valid client"

??????? return ret

-> the afterInit method has the code suggested in the tutorial:

def afterInit(self):

??biz = self.Form.getBizobj("hours")???

??names, pks = biz.getClients()???

??self.Choices = names???

??self.Keys = pks???

??self.ValueMode = "Key"

??? I don't understand why we pass "hours" to the getBizobj function -- the the

bizobj file located in the biz directory is called HoursBizobj.py. I get same

error when I change "hours" to "HoursBizobj" though. How can self.Form.getBizobj

find the HoursBizobj.py code based on the parameter "hours" ???

Thanks for your help, and here's the full "trace back"

C:\Documents and Settings\Jonathan Poor\DABO\ClientHours>python main.py

Traceback (most recent call last):

? Fil

e "main.py", line 13, in <module>

??? app.start()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3

72, in start

??? self.setup()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3

28, in setup

??? self.initUIApp()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\dApp.py", line 3

64, in initUIApp

??? self.uiApp.setup()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\uiApp.py

", line 412, in setup

??? frm = self.dApp.MainForm = dabo.ui.createForm(mfc)

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\__init__

.py", line 1145, in createForm

??? frm = cls(*args, **kwargs)

? File "c:\docume~1\jonath~1\locals~1\temp\tmpf23nhk.py", line 9, in __init__

??? super(dForm_95973, self).__init__(parent=parent, attProperties=attProperties

, *args, **kwargs)

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dForm.py

", line 931, in __init__

??? BaseForm.__init__(self, preClass, parent, properties, attProperties, *args,

**kwargs)

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dForm.py

", line 44, in __init__

??? fm.dFormMixin.__init__(self, preClass, parent, properties, attProperties, *a

rgs, **kwargs)

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dFormMix

in.py", line 89, in __init__

??? attProperties, *args, **kwargs)

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dPemMixi

n.py", line 186, in __init__

??? self._afterInit()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dForm.py

", line 71, in _afterInit

??? super(BaseForm, self)._afterInit()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dFormMix

in.py", line 143, in _afterInit

??? super(dFormMixin, self)._afterInit()

? File "c:\python25\lib\site-packages\Dabo-0.9.2-py2.5.egg\dabo\ui\uiwx\dPemMixi

n.py", line 320, in _afterInit

??? self.afterInit()

? File "c:\docume~1\jonath~1\locals~1\temp\tmpf23nhk.py", line

248, in afterInit

??? biz = self.Form.getBizobj("hours")

AttributeError: 'NoneType' object has no attribute 'getBizobj'

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

[excessive quoting removed by server]

©2009 jpoorrandp@aol.com