source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/attribute.py @ 6745

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDG_XACML/ndg/xacml/core/attribute.py@6745
Revision 6745, 1.4 KB checked in by pjkersha, 10 years ago (diff)

Moved modules into core package

Line 
1"""NDG XACML attribute type definition
2
3NERC DataGrid Project
4"""
5__author__ = "P J Kershaw"
6__date__ = "25/02/10"
7__copyright__ = "(C) 2010 Science and Technology Facilities Council"
8__contact__ = "Philip.Kershaw@stfc.ac.uk"
9__license__ = "BSD - see LICENSE file in top-level directory"
10__contact__ = "Philip.Kershaw@stfc.ac.uk"
11__revision__ = "$Id: $"
12from ndg.xacml import PolicyComponent
13
14
15class AttributeValue(PolicyComponent):
16    """XACML Attribute Value type"""
17    __slots__ = ('__dataType', '__value')
18   
19    def __init__(self):
20        self.__dataType = None
21        self.__value = None
22       
23    def _get_dataType(self):
24        return self.__dataType
25
26    def _set_dataType(self, value):
27        if not isinstance(value, basestring):
28            raise TypeError('Expecting %r type for "dataType" '
29                            'attribute; got %r' % (basestring, type(value)))
30           
31        self.__dataType = value   
32
33    dataType = property(_get_dataType, _set_dataType, None, 
34                        "attribute value data type") 
35       
36    def _get_value(self):
37        return self.__value
38
39    def _set_value(self, value):
40        if not isinstance(value, basestring):
41            raise TypeError('Expecting %r type for "value" '
42                            'attribute; got %r' % (basestring, type(value)))
43           
44        self.__value = value 
45
46    value = property(_get_value, _set_value, None, "attribute value")   
Note: See TracBrowser for help on using the repository browser.