Ignore:
Timestamp:
25/06/10 17:13:06 (11 years ago)
Author:
pjkersha
Message:

Incomplete - task 2: XACML-Security Integration

  • updating epydoc ready for release.
File:
1 edited

Legend:

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

    r7087 r7101  
    1717 
    1818class AttributeValue(Expression): 
    19     """XACML Attribute Value type""" 
     19    """XACML Attribute Value type 
     20     
     21    @cvar ELEMENT_LOCAL_NAME: XML local name for this element 
     22    @type ELEMENT_LOCAL_NAME: string   
     23    @cvar CLASS_NAME_SUFFIX: all attribute value classes end with this suffix 
     24    @type CLASS_NAME_SUFFIX: string 
     25    @cvar IDENTIFIER_PREFIX: geberic prefix for attribute value URNs 
     26    @type IDENTIFIER_PREFIX: string 
     27    @cvar IDENTIFIER: URN for attribute value in derived class  
     28    @type IDENTIFIER: NoneType - derived classes should set to appropriate  
     29    string 
     30    @cvar TYPE_URIS: URIs for all the different supported types 
     31    @type TYPE_URIS: tuple 
     32    @cvar TYPE_NAMES: corresponding short names for all the types 
     33    @type TYPE_NAMES: tuple 
     34    @cvar NATIVE_TYPES: equivalent python types as implemented 
     35    @cvar TYPE_MAP: mapping from type names to python types 
     36    @type TYPE_MAP: dict 
     37    @cvar TYPE_URI_MAP: mapping from type names to type URIs 
     38    @type TYPE_URI_MAP: dict 
     39    @cvar TYPE: type name for derived type - set to None in this parent class 
     40    @type TYPE: NoneType / string in derived type 
     41     
     42    @ivar __value: setting for this attribute value 
     43    @type __value: any - constrained in derived classes 
     44    """ 
    2045    ELEMENT_LOCAL_NAME = 'AttributeValue' 
    2146    CLASS_NAME_SUFFIX = 'AttributeValue' 
     
    84109     
    85110    def __init__(self): 
     111        """Derived classes must override setting TYPE class variable""" 
     112         
    86113        super(AttributeValue, self).__init__() 
    87114        if self.__class__.TYPE is None: 
    88             raise TypeError('TYPE class variable must be set to a valid type ' 
    89                             'in a derived class') 
     115            raise NotImplementedError('TYPE class variable must be set to a ' 
     116                                      'valid type in a derived class') 
    90117             
    91118        self.__value = None 
     
    99126     
    100127    def _get_value(self): 
     128        """Get value 
     129        @param: setting for this attribute value 
     130        @rtype: any - constrained in derived classes 
     131        """ 
    101132        return self.__value 
    102133 
    103134    def _set_value(self, value): 
     135        """Set value 
     136         
     137        @param value: setting for this attribute value 
     138        @type value: any - constrained in derived classes 
     139        @raise TypeError: if type doesn't match TYPE class variable.  Derived 
     140        classes should set this 
     141        """ 
    104142        if not isinstance(value, self.__class__.TYPE): 
    105143            raise TypeError('Expecting %r type for "value" ' 
     
    139177    @staticmethod 
    140178    def keyFilter(key): 
    141         """Enforce string type keys""" 
     179        """Enforce string type keys 
     180         
     181        @param key: URN for attribute 
     182        @type key: basestring 
     183        @return: boolean True indicating key is OK 
     184        @rtype: bool 
     185        @raise TypeError: incorrect input type 
     186        """ 
    142187        if not isinstance(key, basestring): 
    143188            raise TypeError('Expecting %r type for key; got %r' %  
     
    147192    @staticmethod 
    148193    def valueFilter(value): 
    149         """Enforce AttributeValue derived types for values""" 
    150  
     194        """Enforce AttributeValue derived types for values 
     195        @param value: attribute value 
     196        @type value: ndg.xacml.core.attributevalue.AttributeValue derived type 
     197        @return: boolean True indicating attribute value is correct type 
     198        @rtype: bool 
     199        @raise TypeError: incorrect input type 
     200        """ 
    151201        if not issubclass(value, AttributeValue): 
    152202            raise TypeError('Expecting %r derived type for value; got %r' %  
     
    175225    Convenience wrapper for _IDENTIFIER2CLASS_MAP instance of  
    176226    AttributeValueClassMap 
     227     
     228    @param __classMap: mapping object to map attribute value URIs to their  
     229    implementations as classes 
     230    @type __classMap: ndg.xacml.core.attributevalue.AttributeValueClassMap 
    177231    """ 
     232    __slots__ = ('__classMap',) 
     233     
    178234    def __init__(self, classMap=None): 
     235        """Set a mapping object to map attribute value URIs to their  
     236        implementations as classes 
     237         
     238        @param classMap: input an alternative to the default class mapping  
     239        object _IDENTIFIER2CLASS_MAP, if None, it will default to this setting 
     240        @type classMap: ndg.xacml.core.attributevalue.AttributeValueClassMap 
     241        """ 
    179242        if classMap is None: 
    180243            self.__classMap = _IDENTIFIER2CLASS_MAP 
     
    188251        """Return <type>AttributeValue class for given identifier URI or None 
    189252        if no match is found 
     253         
     254        @return: attribute value class 
     255        @rtype: NoneType / ndg.xacml.core.attributevalue.AttributeValue derived 
     256        type 
    190257        """ 
    191258        return self.__classMap.get(identifier) 
Note: See TracChangeset for help on using the changeset viewer.