I am working on a web app that serves pages to different domain names. Since the models and views for these domains are the same I decided to put them in one application and create a controller for each domain. In these controllers I put the response attributes, the menu, the variables com_id and session.comname and the functions. From these functions I call functions in a module that implement the various use cases.
The com_id has a constant value. The value of session.comname gets its value from a database query. Since I need the comname in every view, I guess I have to do something like: com_id=1 session.comname def index(): if not session.comname: redirect(URL(r=request, f='comname')) address=... ... return dict(address=address,...) def about(): if not session.comname: redirect(URL(r=request, f='comname')) about=... ... return dict(about=about,...) .... def comname(): com=db(db.com.id==com_id).select(db.com.comname) session.comname=com[0].comname redirect(URL(???) The redirect in def comname(): should redirect to the previous function. What is the correct syntax to implement this? Furthermore, since, all controllers are in the same application I am not sure the session.comname will under all circumstances have the correct value. Say the visitor enters the application through www.com1.eu. In controller com1, com_id=1 and session.comname is set to com1. Then the visitor request www.com2.eu, the application will navigate to the com2 controller and com_id=2. However, since both controllers are in the same application I don't think session.comname will be set to com2. Am I right? I thought changing session.comname to session.comname1 and session.comname2 in the respective controllers would solve the problem, but that would make the whole thing less generic, because in my view I have: {{=A(session.comname,_href=URL(r=request,f='index'))}} I don't see how to solve this problem. I hope one of you does. Kind regards, Annet. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---