On Dec 29, 2010, at 4:32 PM, Branko Vukelić wrote: > > Btw, in case you're new to these things, the main point of URL helpers > (called URL generators in some frameworks) is to generate the URL > based on the information about the internal structure of the > application. This is done to avoid hard-coding the paths. If you > merely use the URL helper function to pass a full relative path, it > sort of beats the purpose (that's what others meant by 'not supposed > to work that way').
It also takes into account URL rewriting. > > On Thu, Dec 30, 2010 at 1:15 AM, Maurice Ling <[email protected]> wrote: >> Thanks everyone. >> >> It worked. >> >> On Dec 29, 6:45 pm, mdipierro <[email protected]> wrote: >>> or >>> >>> URL('account', 'log_in') >>> >>> On Dec 29, 3:14 am, Kenneth Lundström <[email protected]> >>> wrote: >>> >>>> If I remember correctly there was something about this on the list. >>> >>>> I think you use the URL the wrong way and until version 1.83.2 the >>>> helper worked wrongly. In your case it "worked" but it has been >>>> corrected and it doesn t work anymore. >>> >>>> Try something like URL(c='account', f='log_in') >>> >>>> Kenneth >>> >>>>> Hi >>> >>>>> I have a problem since version 1.83.2. It gives me this error: >>> >>>>> Traceback (most recent call last): >>>>> File "D:\web2py\gluon\restricted.py", line 186, in restricted >>>>> exec ccode in environment >>>>> File "D:/web2py/applications/init/controllers/default.py", line 91, >>>>> in<module> >>>>> File "D:\web2py\gluon\globals.py", line 96, in<lambda> >>>>> self._caller = lambda f: f() >>>>> File "D:/web2py/applications/init/controllers/default.py", line 55, >>>>> in index >>>>> name = check_login() >>>>> File "D:/web2py/applications/init/controllers/default.py", line 38, >>>>> in check_login >>>>> redirect(URL(r=request, f='../account/log_in')) >>>>> File "D:\web2py\gluon\html.py", line 226, in _URL >>>>> return URL(*args, **kwargs) >>>>> File "D:\web2py\gluon\html.py", line 186, in URL >>>>> raise SyntaxError, 'not enough information to build the url' >>>>> SyntaxError: not enough information to build the url >>> >>>>> My codes worked up to version 1.82.1. >>> >>>>> I am using my own authorization/login codes which is in controllers/ >>>>> account.py. The offending code (check_login function) is as follows: >>> >>>>> def check_login(session=session): >>>>> if session.login_time == None: >>>>> session.login_time = 0 >>>>> if session.username == None or \ >>>>> session.login_time + login_expiry * 3600< int(time.time()): >>>>> redirect(URL(r=request, f='../account/log_in')) >>>>> else: >>>>> return session.username >>> >>>>> In version 1.82.1, check_login (called byhttp://localhost:8000/init) >>>>> redirects tohttp://localhost:8000/init/account/login. But from >>>>> version 1.83.2, it seems to redirect >>>>> tohttp://localhost:8000/init/default/init/account/login >>>>> which is non-existent. >>> >>>>> Any ideas what might be happening? >>> >>>>> Thanks >>>>> Maurice Ling

