source: cows_wps/trunk/cows_wps/controllers/test.py @ 6947

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/cows_wps/controllers/test.py@6947
Revision 6947, 2.0 KB checked in by astephen, 10 years ago (diff)

lots of minor fixes. including removing username from process configs.

Line 
1import logging
2
3from pylons import config
4
5from pylons import request, response, session, tmpl_context as c
6from pylons.controllers.util import abort, redirect_to
7
8from cows_wps.renderer.ui_renderer import *
9from cows_wps.controllers import *
10from cows_wps.lib.ui.proc_config import *
11
12from cows_wps.utils.user_roles_dict import user_roles_config_dict
13from cows_wps.lib.user_manager import *
14
15
16log = logging.getLogger(__name__)
17
18
19class TestController(BaseController):
20
21    def index(self):
22        """
23        Shows a table of all procs.
24        """
25        try:
26            resp = str(user_roles_config_dict)
27        except Exception, err:
28            resp = str(err)
29
30               
31        return resp
32
33    def forward2(self):
34#        from paste.recursive import ForwardRequestException
35#        raise ForwardRequestException('/home.html')
36        result = request.environ['paste.recursive.include']('/test')
37        return str(result)
38
39    def sess(self):
40        resp = str(session)
41        return resp
42
43    def REQUEST_METHOD(self):
44        return request.environ.get("REQUEST_METHOD")
45
46    def userid(self):
47        um = UserManager()
48        return um.getUserName()
49
50    def email(self):
51        um = UserManager()
52        return um.getEmailAddress()
53
54    def abort(self):
55        """405 Method Not Allowed
56    A request was made of a resource using a request method not supported by that resource;[2] for example, using GET on a form which requires data to be presented via POST, or using PUT on a read-only resource."""
57        return abort(405)
58
59    def filterpost(self):
60        if self.REQUEST_METHOD() == "POST":
61            return abort(405)
62        else:
63            return "Good request"
64
65    def secured(self):
66        return "Did you get asked for security info?"
67
68    def email2(self):
69        securitySession = request.environ.get('beaker.session.ndg.security')
70        openIdAxParams = securitySession["openid.ax"] 
71        resp = openIdAxParams["emailAddress"]
72        return resp
Note: See TracBrowser for help on using the repository browser.