source: TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/utils/classfactory.py @ 6570

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/ndg_security_common/ndg/security/common/utils/classfactory.py@6570
Revision 6570, 905 bytes checked in by pjkersha, 11 years ago (diff)
  • Refactored classfactory module as a more generic factory for importing any module object
  • Started unit tests with refactored SAML SOAP bindings.
Line 
1"""
2Class Factory
3
4NERC DataGrid project
5"""
6__author__ = "C Byrom - Tessella"
7__date__ = "28/08/08"
8__copyright__ = "(C) 2009 Science and Technology Facilities Council"
9__license__ = "BSD - see LICENSE file in top-level directory"
10__contact__ = "Philip.Kershaw@stfc.ac.uk"
11__revision__ = '$Id: $'
12from ndg.security.common.utils.factory import (importModuleObject,
13                                               callModuleObject)
14 
15def importClass(*arg, **kw):
16    """Backwards compatibility - use importModuleObject instead"""
17    kw['objectName'] = kw.pop('className', None)
18    return importModuleObject(*arg, **kw)
19
20           
21def instantiateClass(*arg, **kw):
22    """Wrapper to callModuleObject"""
23    kw['objectName'] = kw.pop('className', None)
24    kw['objectArgs'] = kw.pop('classargs', None)
25    kw['objectProperties'] = kw.pop('classProperties', None)
26
27    return callModuleObject(*arg, **kw)
Note: See TracBrowser for help on using the repository browser.