Changeset 7098
- Timestamp:
- 25/06/10 14:51:24 (11 years ago)
- Location:
- TI12-security/trunk/ndg_xacml/ndg/xacml/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/ndg_xacml/ndg/xacml/core/__init__.py
r7087 r7098 14 14 15 15 class XacmlCoreBase(object): 16 """Base class for all XACML types""" 16 """Base class for all XACML types 17 18 @cvar XACML_1_0_NS_PREFIX: XACML version 1.0 namespace prefix 19 @type XACML_1_0_NS_PREFIX: string 20 @cvar XACML_2_0_NS_PREFIX: XACML version 2.0 namespace prefix 21 @type XACML_2_0_NS_PREFIX: string 22 @cvar XMLNS: list of valid XACML namespaces 23 @type XMLNS: tuple 24 @cvar ELEMENT_LOCAL_NAME: XML element local name for the given type 25 @type ELEMENT_LOCAL_NAME: NoneType but implement as string in derived 26 classes 27 28 @ivar __xmlns: XML namespace for the XACML type 29 @type __xmlns: NoneType / basestring 30 31 @ivar __elem: XML element 32 @type __elem: NoneType / dependent on Python XML parser used 33 """ 17 34 XACML_1_0_NS_PREFIX = "urn:oasis:names:tc:xacml:1.0" 18 35 XACML_2_0_NS_PREFIX = "urn:oasis:names:tc:xacml:2.0" 19 36 37 XMLNS = (XACML_1_0_NS_PREFIX, XACML_2_0_NS_PREFIX) 38 20 39 __slots__ = ('__xmlns', '__reader', '__writer', '__elem') 21 40 … … 23 42 24 43 def __init__(self): 44 """Element local name check makes this a virtual method 45 46 @raise NotImplementedError: derived classes must set 47 ELEMENT_LOCAL_NAME to a string 48 """ 25 49 self.__xmlns = None 26 self.__reader = None27 self.__writer = None28 50 self.__elem = None 29 51 … … 33 55 34 56 def _getXmlns(self): 35 """XML Namespace for this XACML type""" 57 """Get XML Namespace for this XACML type 58 @return: the XML namespace set 59 @rtype: basestring/NoneType 60 """ 36 61 return self.__xmlns 37 62 38 63 def _setXmlns(self, value): 39 """XML Namespace for this XACML type""" 64 """Set XML Namespace for this XACML type 65 @param value: the XML namespace to set 66 @type value: basestring/NoneType 67 """ 40 68 if not isinstance(value, basestring): 41 69 raise TypeError('Expecting string type for "xmlns" ' … … 48 76 @property 49 77 def isValidXmlns(self): 78 """Check XML namespace fits with the known XACML namespaces 79 @return: True if valid, False otherwise 80 @rtype: bool 81 """ 50 82 return self.xmlns in XacmlCoreBase.XMLNS 51 52 def read(self, obj):53 """Read using callable assinged to reader property"""54 if self.__reader is None:55 raise AttributeError('No reader set for %r' % self.__class__)56 57 self.__reader(self, obj)58 59 @classmethod60 def Read(cls, obj):61 """Construct a new Policy"""62 xacmlObj = cls()63 xacmlObj.read(obj)64 return xacmlObj65 66 def write(self, obj):67 """Read using callable assinged to reader property"""68 if self.__writer is None:69 raise AttributeError('No writer set for %r' % self.__class__)70 71 self.__writer(self, obj)72 83 73 84 @property -
TI12-security/trunk/ndg_xacml/ndg/xacml/core/context/resource.py
r7087 r7098 43 43 44 44 def _set_resourceContent(self, value): 45 """Set resource content 46 @param value: content 47 @type value: any 45 48 """ 46 49 self.__resourceContent = value
Note: See TracChangeset
for help on using the changeset viewer.