Home | Trees | Indices | Help |
|
---|
|
1 """NDG XACML ElementTree based reader for AttributeDesignator type 2 3 NERC DataGrid 4 """ 5 __author__ = "P J Kershaw" 6 __date__ = "16/03/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: attributedesignatorreader.py 7109 2010-06-28 12:54:57Z pjkersha $" 12 from ndg.xacml.utils import str2Bool 13 from ndg.xacml.parsers import XMLParseError 14 from ndg.xacml.parsers.etree import QName 15 from ndg.xacml.parsers.etree.expressionreader import ExpressionReader 16 1719 '''ElementTree based XACML Attribute Designator base class type parser 20 '''6022 """Parse Attribute Designator element 23 24 @param elem: ElementTree XML element 25 @type elem: xml.etree.Element 26 27 @param attributeDesignator: attribute designator 28 @type attributeDesignator: ndg.xacml.core.attributedesignator.AttributeDesignator 29 30 @raise XMLParseError: error parsing attribute ID XML attribute 31 32 @return: updated attribute designator 33 @rtype: ndg.xacml.core.attributedesignator.AttributeDesignator 34 """ 35 xacmlType = self.__class__.TYPE 36 37 # Unpack additional *required* attributes from top-level element 38 attributeValues = [] 39 for attributeName in (xacmlType.ATTRIBUTE_ID_ATTRIB_NAME,): 40 attributeValue = elem.attrib.get(attributeName) 41 if attributeValue is None: 42 raise XMLParseError('No "%s" attribute found in "%s" element' % 43 (attributeName, 44 xacmlType.ELEMENT_LOCAL_NAME)) 45 46 attributeValues.append(attributeValue) 47 48 attributeDesignator.attributeId, = attributeValues 49 50 # Optional attributes 51 issuer = elem.attrib.get(xacmlType.ISSUER_ATTRIB_NAME) 52 if issuer is not None: 53 attributeDesignator.issuer = issuer 54 55 mustBePresent = elem.attrib.get(xacmlType.MUST_BE_PRESENT_ATTRIB_NAME) 56 if mustBePresent is not None: 57 attributeDesignator.mustBePresent = str2Bool(mustBePresent) 58 59 return attributeDesignator
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Apr 5 08:44:42 2012 | http://epydoc.sourceforge.net |