I still haven't had luck with populating a dropdown list.  I decided to not
use Postgresql to avoid any specific issues with that database and am
following the PyCon tutorial to the letter.  The steps I took are as
follows:

1. I made the ClientBizobj.py look like this:

import dabo

class ClientBizobj(dabo.biz.dBizobj):
    def afterInit(self):
        self.DataSource = "clients"
        self.KeyField = "pkid"
        self.addFrom("clients")
        self.addField("pkid")
        self.addField("clientname")
        self.addField("attn")
        self.addField("rate")
        self.addField("street1")
        self.addField("street2")
        self.addField("city")
        self.addField("stateprov")
        self.addField("postalcode")
        
    def getNamesAndKeys(self):
        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]
        return (names, keys)

I added this to the /biz/__init__.py

from ClientBizobj import ClientBizobj

In form design I added a dropdown list.  I changed the datasource property
to "hours", the datafield property to clientfk, the valuemode property to
"Key" and the regid property to ClientList.

In the afterInitAll method I added:

        clientBiz = self.getBizobj("clients")
        names, keys = clientBiz.getNamesAndKeys()
        self.ClientList.Choices = names
        self.ClientList.Keys = keys
        self.ClientList.ValueMode = "Key"
        self.requery()

I updated main.py to use the hours form as the default form.  I closed
everything down and ran main.py.  This is the output:

dave@dave-Mint ~/pycon $ python main.py
/usr/local/lib/python2.7/dist-packages/dabo/lib/SimpleCrypt.py:52:
UserWarning: WARNING: SimpleCrypt is not secure. Please see
http://wiki.dabodev.com/SimpleCrypt for more information
  warnings.warn("WARNING: SimpleCrypt is not secure. Please see
http://wiki.dabodev.com/SimpleCrypt for more information")
Traceback (most recent call last):
  File "main.py", line 13, in <module>
    app.start()
  File "/usr/local/lib/python2.7/dist-packages/dabo/dApp.py", line 395, in
start
    self.setup()
  File "/usr/local/lib/python2.7/dist-packages/dabo/dApp.py", line 347, in
setup
    self.initUIApp()
  File "/usr/local/lib/python2.7/dist-packages/dabo/dApp.py", line 387, in
initUIApp
    self.uiApp.setup()
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/uiApp.py", line
429, in setup
    frm = self.dApp.MainForm = dabo.ui.createForm(mfc)
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/__init__.py",
line 1354, in createForm
    frm = cls(*args, **kwargs)
  File "/tmp/tmp91Jzpj.py", line 10, in __init__
    super(dForm_15476, self).__init__(parent=parent,
attProperties=attProperties, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dForm.py", line
1062, in __init__
    *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dForm.py", line
49, in __init__
    attProperties=attProperties, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dFormMixin.py",
line 76, in __init__
    attProperties=attProperties, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dPemMixin.py",
line 201, in __init__
    self._afterInit()
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dForm.py", line
76, in _afterInit
    super(BaseForm, self)._afterInit()
  File "/usr/local/lib/python2.7/dist-packages/dabo/ui/uiwx/dFormMixin.py",
line 124, in _afterInit
    self.createBizobjs()
  File "/tmp/tmp91Jzpj.py", line 172, in createBizobjs
    clientBizobj = self.Application.biz.clientBizobj(self.Connection)
AttributeError: 'module' object has no attribute 'clientBizobj'

Obviously, it doesn't like what I have done in the CreateBizobjs.  This is
exactly the behaviour I was experiencing when I was using my own Postgres
database.  

I am at a loss.  Any help?

Thanks!



_______________________________________________
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]

Reply via email to