Dow! Sorry for the noise.
Richard On Tue, Feb 14, 2012 at 5:10 PM, Anthony <[email protected]> wrote: > listset = [] >> for r in rowlist: >> listformat = r.id.represent >> listset.append(listformat) >> >> At present this code generates an error saying that the int object "id" >> doesn't have a property 'represent'. I've just re-read the book on the >> represent property and it actually says very little about its >> implementation. I also can't find any explanation of how to pass a row to >> the _format property. So help with either/both would be much appreciated. >> > > "represent" is an attribute of the field object, not the row, so you can > do: > > listformat = db.npcs.id.represent(row=r) > > In that case, the value of listformat will be the value of the "name" > field from the row. > > For the "format" attribute, if it is a string (i.e., like '%(name)s'), > then you can do something like: > > db.npcs._format % row > > If "format" is a lambda, then it would be: > > db.npcs._format(row) > > Anthony >

