source: TI05-delivery/ows_framework/trunk/ows_server/ows_server/lib/csml.py @ 2501

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

Many new ideas in this commit. It's still in a state of flux.
I'm exploring using decorators and class attributes with the prefix "_ows"
to declare properties that need to be in the OWS capabilities document.

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"""
10def get_csml_doc(file):
11    """
12    A trivial document retrieval function.
13
14    This could be replaced with a proper csml server object that supports
15    multiple stores (filesystem, exist) and cache's the results for
16    performance.
17
18    """
19    csml_dir = request.environ['paste.config']['app_conf']['csml_dir']
20    path = os.path.join(csml_dir, file)
21    if os.path.exists(path+'.csml'):
22        f = path+'.csml'
23    elif os.path.exists(path+'.xml'):
24        f = path +'.xml'
25    else:
26        raise ValueError("Cannot find CSML file %s" % file)
27   
28    d = csml.parser.Dataset()
29    d.parse(f)
30       
31    return d
Note: See TracBrowser for help on using the repository browser.