Have you created a Bizobj class definition for your table? Looks like it is looking for ClientBizobj.py in the biz directory.
On Sun, Jul 19, 2009 at 8:19 PM, Carey Gagnon<[email protected]> wrote: > As recommended while I was trying to figure out, and finally succeeding with > a Simple Drop Down List (hard coded, not from db), I decided to try it > another way, by following the step by step. I created a table in the > database called states: > > CREATE TABLE IF NOT EXISTS states ( > pkid INT NOT NULL auto_increment, > statename CHAR(40) NOT NULL, > stateabbrev CHAR(2) NOT NULL, > PRIMARY KEY (pkid) > ) > > Good so far. > > Modified the ClientAddForm.cdxml file for the stateprov field: > > <dDropdownList code-ID="dDropdownList-dPanel" sizerInfo="{'RowSpan': 1, > 'ColSpan': 1, 'HAlign': 'Left', 'ColExpand': True}" rowColPos="(5, 1)" > Choices="[]" designerClass="controlMix" DataSource="clients" RegID="ddState" > DataField="stateprov"></dDropdownList> > > Again...good so far. > Now following the step by step for the HoursForm portion I changed the code > for buttons & drop down etc with appropriate changes (deleted the old > ClientAddForm-code.py file) in Class Designer accordingly to populate the > dropdown from the states field so that I end up with a new > ClientAddForm-code.py file as follows: > > # -*- coding: utf-8 -*- > ### Dabo Class Designer code. You many freely edit the code, > ### but do not change the comments containing: > ### 'Dabo Code ID: XXXX', > ### as these are needed to link the code to the objects. > > ## *!* ## Dabo Code ID: dButton-dPanel-182 > def onHit(self, evt): > self.Form.cancel() > > > > ## *!* ## Dabo Code ID: dDropdownList-dPanel > def afterInit(self): > biz = self.Form.getBizobj("client") > names, pks = biz.getStates() > self.Choices = names > self.Keys = pks > self.ValueMode = "Key" > > > > ## *!* ## Dabo Code ID: dButton-dPanel-205 > def onHit(self, evt): > self.Form.close() > > > > ## *!* ## Dabo Code ID: dForm-top > def afterInitAll(self): > self.new() > > > def afterSave(self): > # This will only get called if the save succeeds > self.new() > self.clientName.setFocus() > > > def beforeSave(self): > bizobj = self.getBizobj(self.dataSourceParameter) > # If the bizobj hasn't changed, we want to notify the user > # and abort the save process, so that the new record is > # not added afterwards. > if not bizobj.isChanged(): > return "No changes have been made; cannot save." > > > def createBizobjs(self): > conn = self.Application.getConnectionByName("ConsultHours") > bizClient = self.Application.biz.ClientBizobj(conn) > self.addBizobj(bizClient) > > > > ## *!* ## Dabo Code ID: dButton-dPanel > def onHit(self, evt): > self.Form.save() > > I figured I was good to go. Saved the ClientAddForm file and closed CD. Ran > my main.py file and got the following error: > > AttributeError: 'NoneType' object has no attribute 'ClientBizobj' > > Here's the full trace back: > > Traceback (most recent call last): > File "main.py", line 17, in <module> > app.start() > File "/usr/lib/python2.5/site-packages/dabo/dApp.py", line 376, in start > self.setup() > File "/usr/lib/python2.5/site-packages/dabo/dApp.py", line 332, in setup > self.initUIApp() > File "/usr/lib/python2.5/site-packages/dabo/dApp.py", line 368, in > initUIApp > self.uiApp.setup() > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/uiApp.py", line 412, > in setup > frm = self.dApp.MainForm = dabo.ui.createForm(mfc) > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/__init__.py", line > 1145, in createForm > frm = cls(*args, **kwargs) > File "/tmp/tmpWMYPqT.py", line 9, in __init__ > super(dForm_89864, self).__init__(parent=parent, > attProperties=attProperties, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dForm.py", line 931, > in __init__ > BaseForm.__init__(self, preClass, parent, properties, attProperties, > *args, **kwargs) > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dForm.py", line 44, in > __init__ > fm.dFormMixin.__init__(self, preClass, parent, properties, > attProperties, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dFormMixin.py", line > 89, in __init__ > attProperties, *args, **kwargs) > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dPemMixin.py", line > 186, in __init__ > self._afterInit() > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dForm.py", line 71, in > _afterInit > super(BaseForm, self)._afterInit() > File "/usr/lib/python2.5/site-packages/dabo/ui/uiwx/dFormMixin.py", line > 139, in _afterInit > self.createBizobjs() > File "/tmp/tmpWMYPqT.py", line 235, in createBizobjs > bizClient = self.Application.biz.ClientBizobj(conn) > AttributeError: 'NoneType' object has no attribute 'ClientBizobj' > > > What am I doing wrong??? > > Thanks in advance > Carey > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ 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]
