[web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread mdipierro
or

URL('account', 'log_in')

On Dec 29, 3:14 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
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,
  inmodule
     File D:\web2py\gluon\globals.py, line 96, inlambda
       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




[web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread snapy666
It doesn't break backwards compatibility, because it *should not* work
the way it did.

@massimo: I think a SyntaxError should not be used for a case like
this. See that the syntax is correct and the passed values not, a
ValueError or the like shall be used.

On 29 Dez., 11:59, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 I might be completly wrong but I think the way URL was used by Maurice
 was wrong, it should not have worked, but thanks to a bug in URL it
 worked the way Maurice wanted.

 So I guess it depends on how you look at it. Did it break backwards
 compatibility.

 If your are using a bug and somebody repairs that bug your application
 stops working.

 Kenneth

 2010/12/29 Kenneth Lundstr m kenneth.t.lundst...@gmail.com:

  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.
  Hm. Isn't that technically a case of breaking backwards compatibility?




[web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread mdipierro
I agree.

On Dec 29, 7:29 am, snapy666 joschu...@yahoo.de wrote:
 It doesn't break backwards compatibility, because it *should not* work
 the way it did.

 @massimo: I think a SyntaxError should not be used for a case like
 this. See that the syntax is correct and the passed values not, a
 ValueError or the like shall be used.

 On 29 Dez., 11:59, Kenneth Lundström kenneth.t.lundst...@gmail.com
 wrote:

  I might be completly wrong but I think the way URL was used by Maurice
  was wrong, it should not have worked, but thanks to a bug in URL it
  worked the way Maurice wanted.

  So I guess it depends on how you look at it. Did it break backwards
  compatibility.

  If your are using a bug and somebody repairs that bug your application
  stops working.

  Kenneth

  2010/12/29 Kenneth Lundstr m kenneth.t.lundst...@gmail.com:

   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.
   Hm. Isn't that technically a case of breaking backwards compatibility?




[web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread Maurice Ling
Thanks everyone.

It worked.

On Dec 29, 6:45 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 or

 URL('account', 'log_in')

 On Dec 29, 3:14 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
 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,
   inmodule
      File D:\web2py\gluon\globals.py, line 96, inlambda
        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




Re: [web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread Branko Vukelić
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').

On Thu, Dec 30, 2010 at 1:15 AM, Maurice Ling mauricel...@gmail.com wrote:
 Thanks everyone.

 It worked.

 On Dec 29, 6:45 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 or

 URL('account', 'log_in')

 On Dec 29, 3:14 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
 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,
   inmodule
      File D:\web2py\gluon\globals.py, line 96, inlambda
        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






-- 
Branko Vukelic

stu...@brankovukelic.com
http://www.brankovukelic.com/


Re: [web2py] Re: Problems in web2py 1.83.2

2010-12-29 Thread Jonathan Lundell
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 mauricel...@gmail.com wrote:
 Thanks everyone.
 
 It worked.
 
 On Dec 29, 6:45 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 or
 
 URL('account', 'log_in')
 
 On Dec 29, 3:14 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
 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,
 inmodule
File D:\web2py\gluon\globals.py, line 96, inlambda
  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