Am Samstag, 30. August 2008 13:44:37 schrieb John Aherne:
> Thanks for the reply.
>
> It's good to know that it works for someone else, so I can react
> accordingly.
>
Do you use the MySQL database on dabodev.com?
> > This is quite strange. You are sure that nowhere in the getClients()
> > method of the Hours bizobj or in the afterInit() method of the dropdown
> > list the fields from the Clients table ("clientname" and "pkid") have
> > changed places by mistake? Because that would give exactly the error you
> > described, I think.
>
> Yes. I am as positive as I can be that I have that correct. The
> dropdownlist does display the name not the key.
>
> > 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]
> > return (names, keys)
> > def afterInit(self):
> > biz = self.Form.getBizobj("hours")
> > names, pks = biz.getClients()
> > self.Choices = pks
> > self.Keys = names
> > self.valueMode = "Key"
> > print 'names',names
> > print 'keys',pks
>
> I decided to change the order around of setting the list as you can see
> in AfterInit above and I get a Type error: string or unicode type required.
>
That's because dDropdownList.Choices expects a list of strings. The exception
is raised at "Self.Choices = pks", right? So pks contains the (integer) pkid
values, as expected. So why you get the error you do when you change back
again I still can't understand.
> > You can set
> > self.NonUpdateFields = ["clientname"]
> > in BizHours.initProperties(), then it works. That was the answer I got to
> > the same question (http://leafe.com/archives/showFullThd/395297#0).
>
> Apolgies. I thought I had read the whole of the thread. Obviously not.
> I'll make sure to be more thorough next time.
>
When I searched for the right message I thought this was rather inconspicuous
in the context of the thread. Even though I had seen it before it wasn't easy
to find again.
Sibylle
--
Dr. Sibylle Koczian
Fasanenstraße 12
82293 Mittelstetten
_______________________________________________
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]