source: cows/trunk/cows/test/testapp/controllers/wxs.py @ 4614

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/test/testapp/controllers/wxs.py@4614
Revision 4614, 1.2 KB checked in by spascoe, 12 years ago (diff)

Fixed bugs in qs_util.py via a regression test (test_wxs.py).

Line 
1import logging
2
3log = logging.getLogger(__name__)
4
5from pylons import response
6
7from cows.pylons.ows_controller import OWSController, addOperation
8
9class WxsController(OWSController):
10
11    service = 'WXS'
12    owsOperations = (OWSController.owsOperations + ['GetPiza'])
13
14    validVersions = ['0.1']
15
16    def _loadCapabilities(self):
17        """This is a hook used to populate c.capabilites with service metadata.
18
19        """
20        pass
21
22    def _renderCapabilities(self, version, format):
23        """Select a Genshi template for rendering the capabilities according
24        to version and format.
25
26        c.capabilities will contain the OWS-Common model for the capabilities.
27
28        Return any pylons controller response.
29        """
30        pass
31
32    def GetPiza(self):
33        toppings = self.getOwsParam('toppings',
34                                    default='cheese,tomato').split(',')
35
36        response.headers['Content-Type'] = 'text/plain'
37        if len(toppings) > 1:
38            t1 = toppings[:-1]
39            t2 = toppings[-1]
40            return 'One %s and %s piza to go!' % (', '.join(t1), t2)
41        else:
42            return 'One %s piza to go!' % toppings[0]
Note: See TracBrowser for help on using the repository browser.