Ignore:
Timestamp:
05/09/07 14:53:20 (12 years ago)
Author:
pjkersha
Message:

ows_server/ows_server/controllers/logout.py:

  • tidy up error handling with separate redirect method
  • don't catch errors on redirect_to - HTTP 302 exception is expected.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/logout.py

    r2878 r2879  
    6666            # There's no handle to a security session 
    6767            log.error("logout called but no 'ndgSec' key in session object") 
    68             return render_response('content') 
     68            return self.__redirect() 
    6969         
    7070        # Look into the session and go kill the wallet 
     
    8585        except Exception, e: 
    8686            log.error("logout - creating Session Manager client: %s" % e) 
    87                 
     87            return self.__redirect()   
     88         
    8889        # Disconnect from Session Manager 
    8990        log.info("Calling Session Manager disconnect for logout") 
     
    9293        except Exception, e: 
    9394            log.error("Error with Session Manager logout: %s" % e) 
    94  
     95            self.__redirect() 
     96             
    9597        try: 
    9698            # easy to kill our cookie 
     
    101103        except Exception, e:    
    102104            log.error("logout - clearing security session: %s" % e) 
    103              
    104         try: 
     105 
     106        return self.__redirect() 
     107     
     108     
     109    def __redirect(self): 
     110        """Handle redirect back to previous page""" 
     111        if c.returnTo: 
     112            # Decode the return to address 
    105113            try: 
    106                 if c.returnTo: 
    107                     # Decode the return to address 
    108                     b64decReturnTo = base64.urlsafe_b64decode(c.returnTo) 
    109                     
    110                     # and now go back to whence we had come 
    111                     h.redirect_to(b64decReturnTo) 
     114                b64decReturnTo = base64.urlsafe_b64decode(c.returnTo) 
    112115            except Exception, e: 
    113116                log.error("logout - decoding return URL: %s" % e)  
    114         finally: 
     117                return render_response('content') 
     118             
     119            # and now go back to whence we had come 
     120            h.redirect_to(b64decReturnTo) 
     121        else: 
    115122            return render_response('content') 
Note: See TracChangeset for help on using the changeset viewer.