below is an extract from the book which describes the field represent
feature....
- *represent can be None or can point to a function that takes a field
value and returns an alternate representation for the field value. Examples:
*
*1.
2.
3.
4.*
*db.mytable.name.represent = lambda name,row: name.capitalize()
db.mytable.other_id.represent = lambda id,row: row.myfield
db.mytable.some_uploadfield.represent = lambda value,row: \
A('get it', _href=URL('download', args=value))*
The more I look at the examples and read the explanation the less sense I
can make of it? There is no doubt it works (at least sometimes) because I
have pasted modifed versions into my code and seen it works. Problem is I
don't understand how to use it in general.
The text refers to a function that takes a field value but the parameters
in the example imply a whole record can be passed as a parameter. In fact I
found almost any random text can be passed as a parameter without causing
an error? My understanding is that represent expects to receive a string
value, but simply putting a string after the "=" does not work?
Can anyone explain in more detail how this feature works, especialy in
terms of input parameters?