source: TI02-CSML/trunk/services/3rdParty/pywps-1.0.0/pywps/Wps/wpsexceptions.py @ 2194

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI02-CSML/trunk/services/3rdParty/pywps-1.0.0/pywps/Wps/wpsexceptions.py@2194
Revision 2194, 1.4 KB checked in by lawrence, 13 years ago (diff)

Adding various specs and 3rd party code of interest for the CSML
services development.

Line 
1#!/usr/bin/python
2# -*- coding: ISO-8859-2 -*-
3
4# $Id$
5# Author:       Jachym Cepicky
6#               http://les-ejk.cz
7
8from xml.dom.minidom import Document
9
10class WPSExceptions:
11    def __init__(self):
12        self.document = Document()
13        self.ExceptionReport = self.document.createElementNS("http://www.opengis.net/ows","ExceptionReport")
14        self.ExceptionReport.setAttribute("xmlns","http://www.opengis.net/ows")
15        self.ExceptionReport.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")
16        self.ExceptionReport.setAttribute("version","1.0.0")
17        self.document.appendChild(self.ExceptionReport)
18
19        return
20
21    def make_exception(self,code,locator=None):
22        if locator:
23            locator =  "%s" % locator
24           
25        if code =="NoApplicableCode":
26            self.Exception = self.document.createElement("Exception")
27            self.Exception.setAttribute("exceptionCode",code)
28            self.ExceptionReport.appendChild(self.document.createComment(repr(locator)))
29        else:
30            self.Exception = self.document.createElement("Exception")
31            self.Exception.setAttribute("exceptionCode",code)
32
33        if locator:
34            self.Exception.setAttribute("locator",locator)
35            self.ExceptionReport.appendChild(self.Exception)
36
37        self.ExceptionReport.appendChild(self.Exception)
38
39        return self.document.toprettyxml(indent='\t', newl='\n', encoding="utf-8")
40
41       
42
Note: See TracBrowser for help on using the repository browser.