On Saturday, December 3, 2011 4:52:43 PM UTC-5, Alan Etkin wrote:
>
> You are right, but this would send that output for all id fields as
> long as there is not a new request (is that so?), and with the linkto
> argument it would work just once.


No, it would only apply to the particular id field (not all id fields), and 
since you can set the 'represent' attribute anywhere, you can do this only 
for the particular SQLTABLE if desired. For example, in the controller that 
creates the SQLTABLE:

def show_table():
    db.mytable.id.represent = lambda id, row: etc.
    table = SQLTABLE(...)
    return dict(table=table)
 
This change doesn't affect requests for other functions -- it will only 
take affect when this particular SQLTABLE is created. If you happen to need 
a different 'represent' within the same action, you can simply redefine 
db.mytable.id.represent as needed.

Note, this method is even more flexible than allowing linkto to return a 
tuple, because it allows you to return any arbitrary output, including a 
button element, or a link with special classes, or an onclick handler, etc.

Anthony

Reply via email to