On Nov 5, 2010, at 12:18 PM, Richard Vézina wrote:
> Try this!
>
> table.id.represent = lambda id: \
> A('Edit',_href=URL(r=request,f='FUNCNAME',args=('TABLE',id)))
That's going to have the same problem, since in villas's example, both FUNCNAME
and TABLE are 'mytable'.
My earlier suggestion is to change this:
SQLTABLE(mytablerows,linkto=URL())
to something like this:
SQLTABLE(mytablerows, linkto=lambda rep,t,tn: URL(r=request,
args=[rep]))
> On Fri, Nov 5, 2010 at 3:11 PM, villas <[email protected]> wrote:
> @Jonathan
> I think you are right about the /<function>/<table>/<id> convention
> for SQLTABLE linkto.
> But by using linkto=URL() I should be able specify whichever URL I
> want rather than have to work around an unnecessary convention?
>
> @Richard
> I played around a little, but I couldn't make that work for me, but
> maybe I'm missing something.
>
> On Nov 5, 6:33 pm, Jonathan Lundell <[email protected]> wrote:
> > On Nov 5, 2010, at 11:00 AM, villas wrote:
> >
> >
> >
> > > Does SQLTABLE linkto work properly?
> >
> > > If I use:
> > > SQLTABLE(mytablerows,linkto=URL())
> >
> > > I get URLs like this: myapp/default/mytable/mytable/id
> >
> > > Note the duplication of "mytable".
> >
> > I wonder if this is really a "duplication". As web2py interprets a URL, the
> > first mytable is a function name, and the second (in this case) is a table
> > name, right? They happen to have the same name here.
> >
> > (That said, SQLTABLE's linkto logic is distinctly non-trivial; I'm not at
> > all sure what's going on in several of the cases.)
> >
> > > I have tried with URL('mytable') and URL(f='mytable'), but it's the
> > > same.
> >
> > > Of course I can work around the issue specifying:
> > > db.mytable.id.represent = lambda id:
> > > A('edit:',id,_href=URL(args=(id)))
> >
> > > ...which gives the URL that I expect, but that is not the question
> > > here...
> >
> > > --D
> >
> >
>