Changeset 676 for oss/oidtool

Show
Ignore:
Timestamp:
05/15/08 08:52:13 (3 months ago)
Author:
sylvain
Message:

updated for CherryPy? 3.1

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • oss/oidtool/example.py

    r179 r676  
    6868    store = filestore.FileOpenIDStore(tempfile.gettempdir()) 
    6969 
    70     # This is not required but we create our own CherryPy toolbox 
    71     # to avoid polluting the default one 
    72     from cherrypy._cptools import Toolbox 
    73     mytb = Toolbox('mytb') 
    74  
    75     # we the attach our tool instance to this toolbox 
    76     mytb.openid = oidtool.OpenIDTool(store, '/connect') 
     70    cherrypy.tools.openid = oidtool.OpenIDTool(store, '/connect') 
    7771 
    7872    conf = {'/': {'tools.sessions.on': True, 
    7973                  'tools.sessions.storage_type': 'ram', 
    80                   'mytb.openid.on': True}} 
     74                  'tools.openid.on': True}} 
    8175 
    8276    root = Root() 
  • oss/oidtool/oidtool.py

    r180 r676  
    1 #!/usr/bin/env python 
    21# -*- coding: utf-8 -*- 
    32 
    4 __version__ = "0.1
     3__version__ = "0.2
    54__authors__ = ["Sylvain Hellegouarch (sh@defuze.org)"] 
    6 __date__ = "2006/12/28
     5__date__ = "2008/05/15
    76__copyright__ = """ 
    8 Copyright (c) 2006 Sylvain Hellegouarch 
     7Copyright (c) 2006, 2007, 2008 Sylvain Hellegouarch 
    98All rights reserved. 
    109""" 
     
    137136        we redirect the user-agent to that url for authentication. 
    138137        """ 
    139  
    140138        # If the requested path belongs to the one defined for the 
    141139        # connection handlers then we do not performany verification 
     
    148146        if self.is_processing(): 
    149147            return  
    150              
     148         
    151149        openid_url = cherrypy.request.params.get('openid_url', None) 
    152150        if not openid_url: 
    153151            raise cherrypy.HTTPRedirect(self.login_path) 
     152 
     153        del cherrypy.request.params['openid_url'] 
    154154 
    155155        oidconsumer = consumer.Consumer(self.get_session(), self.store) 
     
    175175                redirect_url = request.redirectURL(cherrypy.request.base, return_to) 
    176176 
     177                cherrypy.session[self.session_name]['return_to'] = return_to 
    177178                cherrypy.session[self.session_name]['status'] = PROCESSING 
    178179                raise cherrypy.HTTPRedirect(redirect_url) 
     
    202203        # either None or a string containing more information about 
    203204        # the return type. 
    204         info = oidconsumer.complete(cherrypy.request.params) 
     205        info = oidconsumer.complete(cherrypy.request.params, 
     206                                    return_to=cherrypy.session[self.session_name]['return_to']) 
    205207        cherrypy.session[self.session_name]['info'] = info 
    206208        if info.status == consumer.FAILURE and info.identity_url: