#699: Making Root sublcass identity.SecureResource produces an infinite 
recursive
loop
-------------------------------+--------------------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  anonymous
     Type:  defect             |      Status:  new      
 Priority:  normal             |   Milestone:           
Component:  Identity           |     Version:           
 Severity:  major              |    Keywords:           
-------------------------------+--------------------------------------------
 A controller like this (mostly quickstarted boilerplate):

 {{{
 #!python
 import cherrypy
 import turbogears
 from turbogears import controllers
 from turbogears import identity

 class Root(controllers.RootController, identity.SecureResource):
     require = identity.in_group("admin")

     @turbogears.expose(template="identitiy.templates.welcome")
     def index(self):
         import time
         return dict(now=time.ctime())

     @turbogears.expose(html="identitiy.templates.login")
     def login(self, forward_url=None, previous_url=None, *args, **kw):

         if not identity.current.anonymous and
 identity.was_login_attempted():
             raise turbogears.redirect( forward_url )

         forward_url=None
         previous_url= cherrypy.request.path

         if identity.was_login_attempted():
             msg= _("The credentials you supplied were not correct or "\
                    "did not grant access to this resource.")
         elif identity.get_identity_errors():
             msg= _("You must provide your credentials before accessing "\
                    "this resource.")
         else:
             msg= _("Please log in.")
             forward_url= cherrypy.request.headers.get("Referer", "/")
         cherrypy.response.status=403
         return dict(message=msg, previous_url=previous_url,
 logging_in=True,
                     original_parameters=cherrypy.request.params,
                     forward_url=forward_url)
 }}}

 Produces an infinite recursive loop that shows up like this on the
 console:

 {{{
 2006-03-31 11:00:38,458 turbogears.identity DEBUG Retrieving identity for
 visit: 3
 2006-03-31 11:00:38,459 turbogears.identity INFO Identity is available...
 2006-03-31 11:00:38,461 turbogears.identity DEBUG Retrieving identity for
 visit: 3
 2006-03-31 11:00:38,462 turbogears.identity INFO Identity is available...
 2006-03-31 11:00:38,465 turbogears.identity DEBUG Retrieving identity for
 visit: 3
 2006-03-31 11:00:38,465 turbogears.identity INFO Identity is available...
 }}}

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/699>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to