source: TI12-security/trunk/NDG_XACML/ndg/xacml/core/condition.py @ 6796

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

Refactored functions package to enable dynamic creation of function classes for all the XACML primitive types for any given function e.g. equal module implements EqualBase? and dynamically creates the <type>-equal classes for all the types: string, AnyURI, Boolean etc.

Line 
1"""NDG Security Condition 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 import XacmlCoreBase
13from ndg.xacml.core.expression import Expression
14
15
16class Condition(XacmlCoreBase):
17    """XACML 2.0 Rule Condition Note the difference to XACML 1.0: the Condition
18    element is its own type and not an Apply type.  It expects a single
19    Expression derived type child element
20    """
21    ELEMENT_LOCAL_NAME = 'Condition'
22    APPLY_ELEMENT_LOCAL_NAME = 'Apply'
23   
24    __slots__ = ('__expression', )
25   
26    def __init__(self):
27        super(Condition, self).__init__()
28        self.__expression = None
29       
30    @property
31    def expression(self):
32        return self.__expression
33   
34    @expression.setter
35    def expression(self, value):
36        if not isinstance(value, Expression):
37            raise TypeError('Expecting Expression or Expression derived type '
38                            'for "expression" attribute; got %r' %
39                            type(value))
40        self.__expression = value
Note: See TracBrowser for help on using the repository browser.