Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2551 (closed defect: migrated)

Opened 6 years ago

Last modified 6 years ago

Identity redirection stopped working in TG 1.5

Reported by: chrisz Owned by:
Priority: normal Milestone: 1.5
Component: TurboGears Version: 1.5b2
Severity: normal Keywords: identity


Reported by Jorge Godoy on the mailing list:

After some updates -- from OpenSuSE to Ubuntu, mainly -- the redirection feature when I get an IdentityFailure exception stopped working (using " http://localhost:8080").

Using "external redirects" on app.cfg provides me with a URL that when clicked redirects me to the login screen and back to the application, working correctly. Connecting directly to "/login" also works. It is just the internal redirection that stopped working.

Here's the full trace:

URL: http://localhost:8080/
Module paste.evalexception.middleware:306 in respond        
<<          try:
                __traceback_supplement__ = errormiddleware.Supplement, self, environ
                app_iter = self.application(environ, detect_start_response)
                    return_iter = list(app_iter)>>  app_iter = self.application(environ, detect_start_response)
Module cherrypy._cpwsgi:318 in tail        
<<          so that any WSGI middleware in self.pipeline can run first.
            return self.response_class(environ, start_response, self.cpapp)
        def __call__(self, environ, start_response):>>  return self.response_class(environ, start_response, self.cpapp)
Module cherrypy._cpwsgi:211 in __init__        
<<          self.cpapp = cpapp
                self.close()>>  self.run()
Module cherrypy._cpwsgi:259 in run        
<<          headers = self.translate_headers(self.environ)
            rfile = self.environ['wsgi.input']
            request.run(meth, path, qs, rproto, headers, rfile)
        headerNames = {'HTTP_CGI_AUTHORIZATION': 'Authorization',>>  request.run(meth, path, qs, rproto, headers, rfile)
Module cherrypy._cprequest:564 in run        
                self.stage = 'respond'
            except self.throws:>>  self.respond(pi)
Module cherrypy._cprequest:645 in respond        
<<                      if self.handler:
                            self.stage = 'handler'
                            response.body = self.handler()
                        # Finalize>>  response.body = self.handler()
Module cherrypy._cpdispatch:29 in __call__        
<<      def __call__(self):
                return self.callable(*self.args, **self.kwargs)
            except TypeError:
                x = sys.exc_info()[1]>>  return self.callable(*self.args, **self.kwargs)
Module ?:3 in index        
Module turbogears.controllers:364 in expose        
<<                          output = database.run_with_transaction(
                                    func._expose, func, accept, func._allow_json,
                                    *args, **kw)
                    except NoApplicableMethods, e:
                        args = e.args # args from the last generic function call>>  *args, **kw)
Module turbogears.database:? in run_with_transaction        
Module turbogears.database:424 in so_rwt        
<<      try:
                retval = func(*args, **kw)
                return retval>>  retval = func(*args, **kw)
Module turbogears.controllers:? in _expose        
Module turbogears.controllers:393 in <lambda>        
<<              rulefunc=lambda _func, accept, allow_json, *args, **kw:
                    _execute_func(_func, template, format, content_type,
                                  fragment, options, args, kw)))
            if allow_json:>>  fragment, options, args, kw)))
Module turbogears.controllers:428 in _execute_func        
<<          log.debug("Calling %s with *(%s), **(%s)", func, args, kw)
        output = errorhandling.try_call(func, *args, **kw)
        if str(getattr(response, 'status', '')).startswith('204'):>>  output = errorhandling.try_call(func, *args, **kw)
Module turbogears.errorhandling:83 in try_call        
<<      from turbogears.database import restart_transaction
            return func(self, *args, **kw)
        except Exception, e:
            if (isinstance(e, cherrypy.HTTPRedirect)>>  return func(self, *args, **kw)
Module ?:3 in index        
Module turbogears.identity.conditions:236 in require        
<<              except IdentityException, e:
                    errors = [str(e)]
                raise IdentityFailure(errors)
            fn._require = predicate
            return require>>  raise IdentityFailure(errors)
IdentityFailure: ('/login', '')

(Extra Data from the fancy tracing)

CGI Variables
HTTP_ACCEPT 	'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
HTTP_ACCEPT_CHARSET 	'ISO-8859-1,utf-8;q=0.7,*;q=0.7'
HTTP_ACCEPT_ENCODING 	'gzip,deflate'
HTTP_ACCEPT_LANGUAGE 	'pt-br,en-us;q=0.7,en;q=0.3'
HTTP_CONNECTION 	'keep-alive'
HTTP_COOKIE 	'__utmz=111872281.1292153145.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); __utma=111872281.1083124596.1292153145.1299111190.1299337634.76; tg-visit=c539d28a31662a51093a4cd763a61d081bc13fd9; __utmc=111872281'
HTTP_HOST 	'localhost:8080'
HTTP_PRAGMA 	'no-cache'
HTTP_USER_AGENT 	'Mozilla/5.0 (X11; U; Linux x86_64; pt-BR; rv: Gecko/20110303 Ubuntu/10.10 (maverick) Firefox/3.6.15'
REMOTE_PORT 	'54280'
SERVER_SOFTWARE 	'CherryPy/3.2.0 Server'

WSGI Variables
application 	<bound method CPWSGIApp.tail of <cherrypy._cpwsgi.CPWSGIApp object at 0x5603bd0>>
identity_status 	'403 Forbidden'
paste.evalexception 	<paste.evalexception.middleware.EvalException object at 0x44b4650>
paste.evalexception.debug_count 	1299667494
paste.throw_errors 	True
wsgi process 	'Multithreaded'

Another thing that I have noticed is that now the order of "identity.source" seems to be relevant. I mean, if I have "visit,form,http_auth" then I can't login, but if I change it to "form,visit,http_auth" it works just fine. I don't remember it being that way before.

A last note is that this project has been upgraded (tg-admin upgrade) from 1.0 to 1.1 and then to 1.5. All is working fine, except for the redirection thing.

Again, this started when I moved from OpenSuSE 11.3 to Ubuntu 10.10. Even moving back on the svn tree up to r7130 didn't solve the problem so I guess that there might be some hidden condition or package dependency that I am missing and that isn't listed on TG.

Change History

comment:2 Changed 6 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to migrated
Note: See TracTickets for help on using tickets.