Ignore:
Timestamp:
23/01/09 21:53:34 (11 years ago)
Author:
pjkersha
Message:
  • added initialisation decorator for use with derived classes if ndg.security.server.wsgi.NDGSecurityMiddlewareBase.call
  • fixed SSO Client Middleware - client interface for using Single Sign On Service from Pylons or other app
  • Added capability to pass in args to class to be instantiated from instantiateClass factory function in classfactory module
  • Modified SSO wayf template to enable login from this page if the user is at their home site - saves an extra login step
  • Added Signin interface plugin for OpenID Relying Party middleware. The plugin is itself middleware so that it can include other middleware filters such StaticURLParser to include static content used in template.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg.security.common/ndg/security/common/utils/classfactory.py

    r4855 r4863  
    2121 
    2222def instantiateClass(moduleName, className, moduleFilePath=None,  
    23                      objectType=None, classProperties={}): 
     23                     objectType=None, classArgs=(), classProperties={}): 
    2424    ''' 
    2525    Create and return an instance of the specified class 
     
    4040    ''' 
    4141 
    42     log.debug("Instantiating class, %s" % className) 
     42    log.debug("Instantiating class '%s'" % className) 
    4343     
    4444    # ensure that classproperties is a dict - NB, it may be passed in as a null 
     
    6565             
    6666            # Import module name specified in properties file 
    67             importModule = __import__(moduleName) 
     67            module = __import__(moduleName) 
    6868            components = moduleName.split('.') 
    6969            for component in components[1:]: 
    70                 importModule = getattr(importModule, component) 
     70                module = getattr(module, component) 
    7171 
    72             importClass = getattr(importModule, className) 
     72            importedClass = getattr(module, className) 
    7373        finally: 
    7474            # revert back to original sys path, if necessary 
     
    8484 
    8585    # Check class inherits from AAproxy abstract base class 
    86     if objectType and not issubclass(importClass, objectType): 
     86    if objectType and not issubclass(importedClass, objectType): 
    8787        raise ClassFactoryError("Specified class %s must be derived from %s" % 
    8888                                (className, objectType)) 
     
    9090    # Instantiate class 
    9191    try: 
    92         object = importClass(**classProperties) 
     92        if classArgs: 
     93            object = importedClass(*classArgs, **classProperties) 
     94        else: 
     95            object = importedClass(**classProperties) 
     96             
    9397        log.info('Instantiated "%s" class from module, "%s"' % (className, 
    9498                                                                moduleName)) 
     
    96100 
    97101    except Exception, e: 
    98         log.error("Instantiating class, %s: %s"%(importClass.__name__,e)) 
     102        log.error("Instantiating class, %s: %s" % (importedClass.__name__, e)) 
    99103        raise 
    100104             
Note: See TracChangeset for help on using the changeset viewer.