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

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

more work on bbox map adjustment.

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 beaker.middleware import SessionMiddleware
9
10from cows_wps.renderer.ui_renderer import *
11from cows_wps.controllers import *
12from cows_wps.lib.ui.proc_config import *
13
14from cows_wps.utils.user_roles_dict import user_roles_config_dict
15from cows_wps.lib.user_manager import *
16
17log = logging.getLogger(__name__)
18
19
20class TestController(BaseController):
21
22    def index(self):
23        """
24        Shows a table of all procs.
25        """
26        try:
27            resp = str(user_roles_config_dict)
28        except Exception, err:
29            resp = str(err)
30
31               
32        return resp
33
34    def beaker(self):
35        session = request.environ["beaker.session"]
36        resp = session
37#        resp = session._params
38        session["test1"] = "hi"
39       # session.save()
40        return str(resp)
41
42    def uu(self):
43        u = request.environ["REMOTE_USER"]
44        return u
45
46    def forward2(self):
47#        from paste.recursive import ForwardRequestException
48#        raise ForwardRequestException('/home.html')
49        result = request.environ['paste.recursive.include']('/test')
50        return str(result)
51
52    def sess(self):
53        resp = str(session)
54        return resp
55
56    def REQUEST_METHOD(self):
57        return request.environ.get("REQUEST_METHOD")
58
59    def userid(self):
60        um = UserManager()
61        return um.getUserName()
62
63    def email(self):
64        um = UserManager()
65        return um.getEmailAddress()
66
67    def abort(self):
68        """405 Method Not Allowed
69    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."""
70        return abort(405)
71
72    def filterpost(self):
73        if self.REQUEST_METHOD() == "POST":
74            return abort(405)
75        else:
76            return "Good request"
77
78    def secured(self):
79        return "Did you get asked for security info?"
80
81    def email2(self):
82        securitySession = request.environ.get('beaker.session.ndg.security')
83        openIdAxParams = securitySession["openid.ax"] 
84        resp = openIdAxParams["emailAddress"]
85        return resp
86
87    def cookies(self):
88        import cookielib
89        cj = cookielib.CookieJar() 
90        #return str(cj)
91        cookies = request.cookies.items()
92        resp = ""
93        for (k, v) in cookies:
94            resp += "<b>%s</b> = %s<br>" % (k, v)
95
96        import Cookie
97        k = Cookie.SimpleCookie()
98        k["ndg.security.session"] = "96bb6499953f3853bd4c36564fa6e266f239b11f232902baee883ece2ac5e73d91fdcbbb"
99
100        return resp
Note: See TracBrowser for help on using the repository browser.