__init__.py (1208B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\lib\cherrypy\scaffold\__init__.py 2 import cherrypy 3 from cherrypy import tools, url 4 import os 5 local_dir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 6 7 class Root: 8 _cp_config = {'tools.log_tracebacks.on': True} 9 10 def index(self): 11 return "<html>\n<body>Try some <a href='%s?a=7'>other</a> path,\nor a <a href='%s?n=14'>default</a> path.<br />\nOr, just look at the pretty picture:<br />\n<img src='%s' />\n</body></html>" % (url('other'), url('else'), url('files/made_with_cherrypy_small.png')) 12 13 index.exposed = True 14 15 def default(self, *args, **kwargs): 16 return 'args: %s kwargs: %s' % (args, kwargs) 17 18 default.exposed = True 19 20 def other(self, a = 2, b = 'bananas', c = None): 21 cherrypy.response.headers['Content-Type'] = 'text/plain' 22 if c is None: 23 return 'Have %d %s.' % (int(a), b) 24 else: 25 return 'Have %d %s, %s.' % (int(a), b, c) 26 27 other.exposed = True 28 files = cherrypy.tools.staticdir.handler(section='/files', dir=os.path.join(local_dir, 'static'), match='\\.(css|gif|html?|ico|jpe?g|js|png|swf|xml)$') 29 30 31 root = Root()