Package ndg :: Package saml :: Package utils :: Module factory
[hide private]

Module factory

source code

Class Factory for NDG SAML package

NERC DataGrid project


Date: 15/02/10

Author: Philip Kershaw

Contact: Philip.Kershaw@stfc.ac.uk

Copyright: (C) 2010 Science and Technology Facilities Council

License: http://www.apache.org/licenses/LICENSE-2.0

Functions [hide private]
class object
importModuleObject(moduleName, objectName=None, objectType=None)
Import from a string module name and object name.
source code
 
callModuleObject(moduleName, objectName=None, moduleFilePath=None, objectType=None, objectArgs=None, objectProperties=None)
Create and return an instance of the specified class or invoke callable
source code
Variables [hide private]
  __revision__ = '$Id:$'
  log = logging.getLogger(__name__)
  __package__ = 'ndg.saml.utils'
Function Details [hide private]

importModuleObject(moduleName, objectName=None, objectType=None)

source code 

Import from a string module name and object name. Object can be any entity contained in a module

Parameters:
  • moduleName (str) - Name of module containing the class
  • objectName (str) - Name of the class to import. If none is given, the class name will be assumed to be the last component of modulePath
Returns: class object
imported class

callModuleObject(moduleName, objectName=None, moduleFilePath=None, objectType=None, objectArgs=None, objectProperties=None)

source code 

Create and return an instance of the specified class or invoke callable

Parameters:
  • moduleName (str) - Name of module containing the class
  • objectName (str) - Name of the class to instantiate. May be None in which case, the class name is parsed from the moduleName last element
  • moduleFilePath (str) - Path to the module - if unset, assume module on system path already
  • objectProperties (dict) - dict of properties to use when instantiating the class
  • objectType (object) - expected type for the object to instantiate - to enforce use of specific interfaces
Returns:
object - instance of the class specified