I was following along in the tutorial with no problems until I got to the
section on setting up the Client dropdownlist where you wrote:

"Select the control in the code editing window, and select the afterInit()
method. Add the following code to that method:

def getNamesAndKeys(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]
    return (names, keys)

Let's look at what this is doing: the first line asks the form for a
reference to the client bizobj; it does this by passing the DataSource of
the bizobj it is interested to the form's getBizobj() method."



My first problem is why are we adding the getNamesAndKeys() method to the
dropdownlist's afterInit()?
Second, you wrote that this method was getting a ref to the client bizobj by
the getBizobj() method. I must be blind as I can't see the getBizobj call.

Perhaps you really meant to have the afterInit method for the dropdownlist
to be something like:

def afterInit(self):
    clientBiz = self.Form.getBizobj("clients")
    names, keys = clientBiz.getNamesAndKeys()


Should that section of the tutorial be revised or, as a rookie, am I missing
something?

Steve Rose


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---
_______________________________________________
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