#NEWLINE# def describerecord( self ) : #NEWLINE# #INDENT# ' Handle DescribeRecord request ' #NEWLINE# if ( ( 'typename' not in scn . parent . kvp ) or ( len ( self . parent . kvp [ 'typename' ] ) == 0 ) ) : #NEWLINE# #INDENT# self . parent . kvp [ 'typename' ] = [ 'csw:Record' ] #NEWLINE# if ( self . parent . profiles is not None ) : #NEWLINE# #INDENT# for prof in self . parent . profiles [ 'loaded' ] . keys ( ) : #NEWLINE# #INDENT# self . parent . kvp [ 'typename' ] . append ( self . parent . profiles [ 'loaded' ] [ prof ] . typename ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . parent . requesttype == 'GET' ) : #NEWLINE# #INDENT# self . parent . kvp [ 'typename' ] = self . parent . kvp [ 'typename' ] . split ( ',' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( 'outputformat' in self . parent . kvp ) and ( self . parent . kvp [ 'outputformat' ] not in self . parent . context . model [ 'operations' ] [ 'DescribeRecord' ] [ 'parameters' ] [ 'outputFormat' ] [ 'values' ] ) ) : #NEWLINE# #INDENT# return self . exceptionreport ( 'InvalidParameterValue' , 'outputformat' , ( 'Invalid value for outputformat: %s' % self . parent . kvp [ 'outputformat' ] ) ) #NEWLINE# #UNINDENT# if ( ( 'schemalanguage' in self . parent . kvp ) and ( self . parent . kvp [ 'schemalanguage' ] not in self . parent . context . model [ 'operations' ] [ 'DescribeRecord' ] [ 'parameters' ] [ 'schemaLanguage' ] [ 'values' ] ) ) : #NEWLINE# #INDENT# return self . exceptionreport ( 'InvalidParameterValue' , 'schemalanguage' , ( 'Invalid value for schemalanguage: %s' % self . parent . kvp [ 'schemalanguage' ] ) ) #NEWLINE# #UNINDENT# node = etree . Element ( util . nspath_eval ( 'csw:DescribeRecordResponse' , self . parent . context . namespaces ) , nsmap = self . parent . context . namespaces ) #NEWLINE# node . attrib [ util . nspath_eval ( 'xsi:schemaLocation' , self . parent . context . namespaces ) ] = ( '%s %s/csw/2.0.2/CSW-discovery.xsd' % ( self . parent . context . namespaces [ 'csw' ] , self . parent . config . get ( 'server' , 'ogc_schemas_base' ) ) ) #NEWLINE# for typename in self . parent . kvp [ 'typename' ] : #NEWLINE# #INDENT# if ( typename . find ( ':' ) == ( - 1 ) ) : #NEWLINE# #INDENT# return self . exceptionreport ( 'InvalidParameterValue' , 'typename' , ( 'Typename not qualified: %s' % typename ) ) #NEWLINE# #UNINDENT# if ( typename == 'csw:Record' ) : #NEWLINE# #INDENT# LOGGER . debug ( 'Writing csw:Record schema.' ) #NEWLINE# schemacomponent = etree . SubElement ( node , util . nspath_eval ( 'csw:SchemaComponent' , self . parent . context . namespaces ) , schemaLanguage = 'XMLSCHEMA' , targetNamespace = self . parent . context . namespaces [ 'csw' ] ) #NEWLINE# path = os . path . join ( self . parent . config . get ( 'server' , 'home' ) , 'core' , 'schemas' , 'ogc' , 'csw' , '2.0.2' , 'record.xsd' ) #NEWLINE# dublincore = etree . parse ( path , self . parent . context . parser ) . getroot ( ) #NEWLINE# schemacomponent . append ( dublincore ) #NEWLINE# #UNINDENT# if ( self . parent . profiles is not None ) : #NEWLINE# #INDENT# for prof in self . parent . profiles [ 'loaded' ] . keys ( ) : #NEWLINE# #INDENT# if ( self . parent . profiles [ 'loaded' ] [ prof ] . typename == typename ) : #NEWLINE# #INDENT# scnodes = self . parent . profiles [ 'loaded' ] [ prof ] . get_schemacomponents ( ) #NEWLINE# if scnodes : #NEWLINE# #INDENT# for scn in scnodes : #NEWLINE# #INDENT# node . append ( scn ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# return node