source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml_util.py @ 2507

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml_util.py@2507
Revision 2507, 994 bytes checked in by spascoe, 12 years ago (diff)

Operations metadata inserted correctly for CSML WMS.

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6csml access routines.
7
8@author: Stephen Pascoe
9"""
10from pylons import Response, c, g, cache, request, session
11
12import csml
13import os
14
15def get_csml_doc(file):
16    """
17    A trivial document retrieval function.
18
19    This could be replaced with a proper csml server object that supports
20    multiple stores (filesystem, exist) and cache's the results for
21    performance.
22
23    """
24    csml_dir = request.environ['paste.config']['app_conf']['csml_dir']
25    path = os.path.join(csml_dir, file)
26    if os.path.exists(path+'.csml'):
27        f = path+'.csml'
28    elif os.path.exists(path+'.xml'):
29        f = path +'.xml'
30    else:
31        raise ValueError("Cannot find CSML file %s" % file)
32   
33    d = csml.parser.Dataset()
34    d.parse(f)
35       
36    return d
Note: See TracBrowser for help on using the repository browser.