Package pulp :: Package server :: Package webservices :: Package controllers :: Module test
[hide private]
[frames] | no frames]

Source Code for Module pulp.server.webservices.controllers.test

 1  #!/usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3  # 
 4  # Copyright © 2010 Red Hat, Inc. 
 5  # 
 6  # This software is licensed to you under the GNU General Public License, 
 7  # version 2 (GPLv2). There is NO WARRANTY for this software, express or 
 8  # implied, including the implied warranties of MERCHANTABILITY or FITNESS 
 9  # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 
10  # along with this software; if not, see 
11  # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 
12  # 
13  # Red Hat trademarks are not licensed under GPLv2. No permission is 
14  # granted to use or replicate Red Hat trademarks that are incorporated 
15  # in this software or its documentation. 
16   
17  import logging 
18  import web 
19   
20  from pulp.server.webservices.controllers.base import JSONController 
21  from pulp.server.webservices.role_check import RoleCheck 
22   
23  log = logging.getLogger('pulp') 
24 25 -class Index(JSONController):
26
27 - def GET(self):
28 valid_filters = ('name', 'occupation') 29 filters = self.filters(valid_filters) 30 return self.ok(filters)
31
32 - def HEAD(self):
33 # should get through, but shouldn't return the body 34 return self.ok(False)
35
36 - def POST(self):
37 params = self.params() 38 return self.ok(params)
39
40 - def PUT(self):
41 params = self.params() 42 return self.created(params)
43
44 - def DELETE(self):
45 return self.ok(True)
46
47 - def TRACE(self):
48 # should get through, but shouldn't return the body 49 return self.ok(True)
50
51 - def OPTIONS(self):
52 return self.ok(True)
53
54 - def CONNECT(self):
55 # proxy-only command, most likely not supported 56 return self.ok(False)
57
58 59 -class AuthTest(JSONController):
60 #https://localhost:443/test/some-id/auth/ 61 @RoleCheck(admin=True, consumer=True)
62 - def GET(self, id):
63 log.error("AuthTest.GET") 64 ret = {'idparam': id} 65 return self.ok(ret)
66 67 # web.py application ---------------------------------------------------------- 68 69 URLS = ( 70 '/$', 'Index', 71 '/([^/]+)/auth/$', 'AuthTest' 72 ) 73 74 application = web.application(URLS, globals()) 75