It's also called by openid_login_complete(), appearing above it.   And in that case the retfun is not set.  So don't remove the redirect, unless you move it up into openid_login_complete().  Which is a reasonable option (and remove the default value for retfun=None).