#124 Make sure that openid redirects back to root on no request
Merged 3 years ago by puiterwijk. Opened 3 years ago by puiterwijk.
puiterwijk/ipsilon fix-openid-redirect  into  master

@@ -85,7 +85,7 @@ 


          if request is None:

              self.debug('No request')

-             raise cherrypy.HTTPRedirect(self.basepath)

+             raise cherrypy.HTTPRedirect(self.basepath or '/')


          return request


If there is no request, we redirect to self.basepath, but if Ipsilon is mounted
to the root (/), basepath is set to None.
Sending a HTTPRedirect(None) redirects back to the current page.
So this change makes OpenID send the user to / in this case.

Fixes: #225
Signed-off-by: Patrick Uiterwijk puiterwijk@redhat.com

I decided to use the "or '/'" method for now.
Refactoring everything to use the posixpath.join method is a bigger change, and not needed for this.

This change is fine with me so you have an LGTM, but I would also suggest that another good change would be to consider making it "illegal" for basepath to be None so that this problem just doesn't happen. I think it's good to enforce data rules like this so all of your code can be cleaner and assume that basepath isn't None.

That's just a suggestion, so if you want to go this route instead, that's fine ☺

The problem is that due to stuff inside cherrypy, we need to allow base.mount to be unset to get stuff on the web root :).


3 years ago

Pull-Request has been merged by puiterwijk

3 years ago