Hello everyone,
I'm developping an application over web2py, and I stumbled on a problem 
when I simply log in, using the normal auth() mechanism. It has previously 
always been fine, as I logged in normally before doing anything.
But today:
- I awoke my computer (from hibernate mode) ;
- I accessed one form that I had opened yesterday while logged in ;
- I submitted the form
- The session was not active anymore so web2py asked for my credentials
- I gave them and submitted the credential form
- There I have an internal server error.
It comes from the login module, which tries to format an url with "%" in it:

File 
"C:/Users/cedric/projets/LACT/eclipse/web2py_src/web2py/applications/lact/controllers/default.py"
 <http://127.0.0.1:8000/admin/default/edit/lact/controllers/default.py>, line 
33, in user
    return dict(form=auth())
  File "C:\Users\cedric\projets\LACT\eclipse\web2py_src\web2py\gluon\tools.py", 
line 1126, in __call__
    return getattr(self,args[0])()
  File "C:\Users\cedric\projets\LACT\eclipse\web2py_src\web2py\gluon\tools.py", 
line 1726, in login
    next = replace_id(next, form)
  File "C:\Users\cedric\projets\LACT\eclipse\web2py_src\web2py\gluon\tools.py", 
line 79, in replace_id
    return url % form.vars
ValueError: unsupported format character 'D' (0x44) at index 51

(...)
Code listing 

74.
75.
76.
77.
78.
79.

80.
81.
82.
83.

    if url and not url[0] == '/' and url[:4] != 'http':
        # this is here for backward compatibility
        return URL(url.replace('[id]', str(form.vars.id)))
    elif url:
        # this allows http://..../%(id)s/%(name)s/etc.
        return url % form.vars

    return url

class Mail(object):
    """

 Variables url 
'/lact/editor/question/2?f_comments=&f_form=2+x+3...ar_v_2=6&qvar_v_7=&qvar_v_8=&stay_here=Save&v2x3='
  
form.vars <Storage {'password': '7f689223289a799b54dd575b9...': 
'xxxxxxxxxx', 'remember': 'on'}>  form <gluon.sqlhtml.SQLFORM object at 
0x07D44C70>
Thanks to eclipse, I was able to see the 51th character and the source of 
the error:
url is: 
/lact/editor/question/2?f_comments=&f_form=2+x+3+%3D+%3Cinput...&stay_here=Save&v2x3=

So as the next url contains "%3D", the python formater thinks that it must 
format something, but it doesn't know the format character "D", thus the 
error.
The problem persists if I try to log in simply afterwards, as web2py will 
try to get me the the last "next" url, which leads to the same error.
I was obliged to go to a simple URL that requires to be logged in, in order 
to override this "next" url, and stop the error.

I'm using:
web2py™ (1, 99, 2, datetime.datetime(2011, 9, 26, 6, 55, 33), 'stable')  
Python Python 2.5.4: C:\Program Files (x86)\python25\python.exe
I am new to the web2py group, so please excuse the format of this message.
Is it a known problem? I didn't try with the current 1.99.7 version, maybe 
this is corrected?
Should I open an issue ticket?
Do you think some information is missing?

Thank you all,
Cedric

Reply via email to