Changeset 7652


Ignore:
Timestamp:
22/10/10 17:04:29 (9 years ago)
Author:
pjkersha
Message:

Started adding in support for custom attribute value types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/ndg_xacml/ndg/xacml/core/attributevalue.py

    r7412 r7652  
    256256     
    257257     
     258def extendAttributeValueClassMap(classMap, overwrite=False): 
     259    """Extend Default AttributeValue Class Map with custom types.  This enables 
     260    the policy to support additional attribute types 
     261     
     262    @param classMap: input an alternative to the default class mapping  
     263    object _IDENTIFIER2CLASS_MAP, if None, it will default to this setting 
     264    @type classMap: ndg.xacml.core.attributevalue.AttributeValueClassMap   
     265    @param overwrite: set to True to allow overwriting of existing map entries, 
     266    defaults to disable overwrite 
     267    @type overwrite: bool 
     268    """ 
     269    if not isinstance(classMap, AttributeValueClassMap): 
     270        raise TypeError('Expecting %r derived type for "map" input; got %r' %  
     271                        (AttributeValueClassMap, type(map))) 
     272 
     273    if overwrite: 
     274        _IDENTIFIER2CLASS_MAP.update(classMap) 
     275    else: 
     276        for k, v in classMap.items(): 
     277            if k not in _IDENTIFIER2CLASS_MAP: 
     278                _IDENTIFIER2CLASS_MAP[k] = v 
     279    
     280    
    258281class AttributeValueClassFactory(object): 
    259282    """Create AttributeValue types based on the XML namespace identifier 
Note: See TracChangeset for help on using the changeset viewer.