[web2py] Re: sqltable behaviour

2010-10-18 Thread leone

OK.
I was confused by epydoc example:

def mylink(field, type, ref):
return URL(r=request, args=[field])

rows = db.select(db.sometable.ALL)
table = SQLTABLE(rows, linkto=mylink)

Thanks very much.

On 18 Ott, 14:23, mdipierro  wrote:
> This is correct. I think you want this:
>
> def mylink():
>              ...
>              print ">>>I am in mylink at row %s" % request.args
>              ...
>              return URL(r=request,f='something')
>
> def something():
>        ...
>        SQLTABLE( rows,
>                           
>                          linkto=URL('mylink'))
>
> On Oct 18, 5:13 am, leone  wrote:
>
>
>
>
>
>
>
> > Hi,
> > I have this code:
>
> > def something():
> >        ...
> >        def mylink(field,  type, ref):
> >              ...
> >              print ">>>I am in mylink at row %s" % str(field)
> >              ...
> >              return URL(r=request,f='something')
> >        SQLTABLE( rows,
> >                           
> >                          linkto=mylink)
> >        ...
>
> > I can see mylink called for every row in rows-set when I load
> > controller function.
> > Is this behaviour correct?
> > I supposed that mylink  was called only when I click on row-id.
> > Thanks in advance
> > leone


[web2py] Re: sqltable behaviour

2010-10-18 Thread mdipierro
This is correct. I think you want this:

def mylink():
 ...
 print ">>>I am in mylink at row %s" % request.args
 ...
 return URL(r=request,f='something')

def something():
   ...
   SQLTABLE( rows,
  
 linkto=URL('mylink'))

On Oct 18, 5:13 am, leone  wrote:
> Hi,
> I have this code:
>
> def something():
>        ...
>        def mylink(field,  type, ref):
>              ...
>              print ">>>I am in mylink at row %s" % str(field)
>              ...
>              return URL(r=request,f='something')
>        SQLTABLE( rows,
>                           
>                          linkto=mylink)
>        ...
>
> I can see mylink called for every row in rows-set when I load
> controller function.
> Is this behaviour correct?
> I supposed that mylink  was called only when I click on row-id.
> Thanks in advance
> leone