source: TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/exception_report.xml @ 3450

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/pylons/templates/exception_report.xml@3450
Revision 3450, 1.1 KB checked in by spascoe, 12 years ago (diff)

New facade to parts of the OWS common data model which will enable population from config file.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<?python
3"""
4A OWS exception report.
5
6@param report: An ows_common.exception_report object
7"""
8
9def hide_optionals(attrDict, optionals=None):
10    """
11    Returns a copy of attrDict where any value which is None and in optionals is removed.
12
13    If optionals=None all keys are considered optional.
14
15    @todo: move this to a utils module
16    """
17    od = {}
18    for key, value in attrDict.items():
19        if (value is not None) or (optionals and key not in optionals):
20            od[key] = value
21
22    return od
23?>
24<ExceptionReport xmlns="http://www.opengis.net/ows"
25                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
26                 xmlns:py="http://genshi.edgewall.org/"
27                 xsi:schemaLocation="http://www.opengis.net/ows owsExceptionReport.xsd"
28                 version="${report.version}"
29                 py:attrs="hide_optionals(dict(language=report.lang))">
30<!-- generated from genshi -->
31<Exception py:for="e in report.exceptions"
32           py:content="e.text"
33           exceptionCode="${e.code}"
34           py:attrs="hide_optionals(dict(locator=e.locator))"/>
35</ExceptionReport>
36                 
Note: See TracBrowser for help on using the repository browser.