Weheh,

Thanks for your reply.

> Ah, I see. You want it inline, outside the functions. First of all,
> the 2 lines session.id and session.name at the very top will probably
> cause trouble all by themselves. Why don't you delete them?

I deleted them, and that solved the problem.

> I suppose the rest of the code should work, but perhaps you should put
> the rest of the code inside a function and use routes to remap URL?
> Anyway, I'm still curious what results you got?

I haven't used routes before to remap URLs, for now your solution
works:


if not request.args:
    redirect(URL(r=request,c='default',f='error'))
else:
    if not session.id or session.id!=request.args[0]:
        session.id=request.args[0]
        row=db(db.member.id==session.id).select(db.member.name)
        if row:
            session.name=row[0].name

response.menu = [
 
['Home',request.function=='index',URL(r=request,f='index',args=session.id)],
    [...],
 
['Contact',request.function=='contact',URL(r=request,f='contact',args=session.id)]]


Massimo,

> This does not work because if not request.args you redirect to a url
> that does not have request.args and your server gets into an infinite
> loop.

Actually the visitor should never see the error view. The visitor
either visits
the application from a link in an index function:

<td>
  {{=A(row.member.name,_onmouseover="this.style.cursor='pointer';",\
  _onclick="javascript:details('%s')"%URL(r=request,a='demo',c='site',
  f='home',args=[row.member.id]))}}
</td>

from, a bookmarked page:

http://www.mydomain.nl/demo/site/f/1

or from a domain registered by the member which points to a Static/CGI/
PHP
application in which I use an iFrame tag in the index.html file to
include the
contents of http://www.mydomain.nl/demo/site/f/1

At the moment the error view is just there to prevent web2py from
issuing an error ticket when I expose a function from within the admin
interface that requires args to be set.


> You are reinventing the wheel. Why don't you just use auth and
> decorate the functions that require a user?

Because it has nothing to do with auth. I assume you got confused by
the table name user. I changed that to member. I am working on an
idea and I was curious whether my idea about navigation would work
this way.


Kind regards,

Annet.

Reply via email to