origin URL passed to Login() needs to be quoted

4 views
Skip to first unread message

Jim Eggleston

unread,
Sep 28, 2011, 9:08:52 PM9/28/11
to karrigell
Hi Pierre,

The origin URL passed to the Login() function needs to be quoted if
the URL contains parameters.

For example, if the origin URL passed to Login() is:

/k4wiki/index.py/edit?pageName=AdminPage&admin=on

then the URL generated for the login page will be:

/k4wiki/admin/login.py/login?role=admin&origin=/k4wiki/index.py/
edit?pageName=AdminPage&admin=on

This will generate an exception:

Traceback (most recent call last):
File "b:\python32\app\lib\site-packages\Karrigell\Karrigell.py",
line 156, in handle_data
self.run(func)
File "b:\python32\app\lib\site-packages\Karrigell\Karrigell.py",
line 280, in run
result = self.namespace[func](**self.body) # string or bytes
TypeError: login() got an unexpected keyword argument 'admin'

I quoted the origin URL in my script using urllib.parse.quote_plus()
and this solved the problem.

I then changed line 206 in RequestHandler.login() in Karrigell.py as
follows:

-206 origin = origin or self.path
+206 origin = urllib.parse.quote_plus(origin or self.path)

I have tested this and it works.

Cheers,
Jim
Reply all
Reply to author
Forward
0 new messages