| Home | Trees | Indices | Help |
|
|---|
|
|
1 #----------------------------------------------------------------------- 2 # $Id: wcst11Exception.py 1031 2011-12-27 15:30:26Z meissls $ 3 # 4 # Description: 5 # 6 # WCSt 1.1 Exceptions 7 # 8 #------------------------------------------------------------------------------- 9 # 10 # Project: EOxServer <http://eoxserver.org> 11 # Authors: Martin Paces <martin.paces@iguassu.cz> 12 # 13 #------------------------------------------------------------------------------- 14 # Copyright (C) 2011 Iguassu Software Systems, a.s 15 # 16 # Permission is hereby granted, free of charge, to any person obtaining a copy 17 # of this software and associated documentation files (the "Software"), to deal 18 # in the Software without restriction, including without limitation the rights 19 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 20 # copies of the Software, and to permit persons to whom the Software is 21 # furnished to do so, subject to the following conditions: 22 # 23 # The above copyright notice and this permission notice shall be included in all 24 # copies of this Software or works derived from this Software. 25 # 26 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 27 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 28 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 29 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 31 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 32 # THE SOFTWARE. 33 #------------------------------------------------------------------------------- 34 35 LANG="en" 36 37 #======================================================= 38 # base exception 39 41 """ base WPS exception """ 43 self.locator = locator 44 self.message = message 45 self.msg = unicode( self ) 46 48 return self.__class__.__name__[2:] 49 51 return unicode( self ).encode("UTF-8") 52 54 t = [ u"code=%s" % self.getCode() ] 55 if self.locator is not None : t.append(u"locator=%s"%self.locator) 56 if self.message is not None : t.append(u"message=%s"%self.message) 57 return "OWS11_Exception{%s}"%(";".join(t) ) 58 59 #======================================================= 60 # specific WPS exceptions 61 62 # no locator exceptions 65 68 69 # locator holding exceptions 70 74 78 82 86 90 91 # generic exception 95 96 97 #======================================================= 98 # forming the exception report 99 101 102 xml = ows11ExceptionReport( exception ) 103 xml.insert(0,u'<?xml version="1.0" encoding="UTF-8"?>\n') 104 105 return ( u"".join(xml) ).encode("UTF-8") 106108 109 xml = [] 110 111 # prepare exception 112 113 try : raise exception 114 except OWS11_Exception : pass # the exception is already a OWS11 exception 115 except : # conversion must be done 116 exception = ExNoApplicableCode( unicode( exception ) ) 117 118 # prepare report 119 code = exception.getCode() 120 loc = u' locator="%s"'%( exception.locator ) if exception.locator else "" 121 122 xml.append( u'<ows:ExceptionReport ' ) 123 xml.append( u'xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' ) 124 xml.append( u'xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd" ' ) 125 xml.append( u'xml:lang="%s" version="1.0.0">\n' % LANG ) 126 127 xml.append( u'\t<ows:Exception exceptionCode="%s"%s' % ( code , loc ) ) 128 129 if exception.message : 130 msg = unicode( exception.message ).replace( "]]>" , "]]]]><![CDATA[>" ) 131 xml.append( u">\n\t\t<ows:ExceptionText><![CDATA[%s]]></ows:ExceptionText>\n\t</ows:Exception>\n" % msg ) 132 else : 133 xml.append( u"/>\n" ) 134 135 xml.append( u'</ows:ExceptionReport>' ) 136 137 return xml138
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed May 15 14:50:22 2013 | http://epydoc.sourceforge.net |