source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/attributevalue.py @ 6748

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

spearate out Expression and AttributeValue? classes into separate modules.

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.core.expression import Expression
13   
14
15class AttributeValue(Expression):
16    """XACML Attribute Value type"""
17    ELEMENT_LOCAL_NAME = 'AttributeValue'
18    __slots__ = ('__value',) 
19   
20    def __init__(self):
21        super(AttributeValue, self).__init__()
22        self.__value = None
23           
24    def _get_value(self):
25        return self.__value
26
27    def _set_value(self, value):
28        if not isinstance(value, basestring):
29            raise TypeError('Expecting %r type for "value" '
30                            'attribute; got %r' % (basestring, type(value)))
31           
32        self.__value = value 
33
34    value = property(_get_value, _set_value, None, "expression value")   
Note: See TracBrowser for help on using the repository browser.