## The code ...
from gluon.contrib.populate import populate

db.define_table('product',
    Field('field_n1'),
    Field('field_n2'))

if db(db.product).isempty():
    populate(db.product, 17)

some_function = 'function_n1'
some_action = 'action_n1'
some_table = 'table_n1'
back_to = 'back_to_pt01'
db.product.id.represent = lambda value,row: A('Ed',
_href=URL(f=some_function, args=(some_action, some_table, back_to,
value)))

## (1)
## when id=1 as a result I expect a link named Ed with href = '../app/
default/function_n1/action_n1/table_n1/back_to_pt01/1'

some_function = 'function_n2'
some_action = 'action_n2'
some_table = 'table_n2'
back_to = 'back_to_pt02'
db.product.field_n1.represent = lambda value,row: A(value,
_href=URL(f=some_function, args=(some_action, some_table, back_to,
row.id)))

## (2)
## when id=1 as a result I expect the content of field_n1 with href =
'../app/default/function_n2/action_n2/table_n2/back_to_pt02/1'

## (3) and here is the question ...
## for both (1) and (2)
## I am geting href = '../app/default/function_n2/action_n2/table_n2/
back_to_pt02/1'
## Is that correct?


## with this code I get what I am expecting
##xsome_function = 'function_n2'
##xsome_action = 'action_n2'
##xsome_table = 'table_n2'
##xback_to = 'back_to_pt02'
##db.product.field_n1.represent = lambda value,row: A(value,
_href=URL(f=xsome_function, args=(xsome_action, xsome_table, xback_to,
row.id)))


Can someone switch on the light, please.
Lazaro

Reply via email to