MCPcopy
hub / github.com/cherrypy/cherrypy / script_name

Method script_name

cherrypy/_cptree.py:272–293  ·  view source on GitHub ↗

Return the script_name of the app at the given path, or None. If path is None, cherrypy.request is used.

(self, path=None)

Source from the content-addressed store, hash-verified

270 self.apps[script_name] = wsgi_callable
271
272 def script_name(self, path=None):
273 """Return the script_name of the app at the given path, or None.
274
275 If path is None, cherrypy.request is used.
276 """
277 if path is None:
278 try:
279 request = cherrypy.serving.request
280 path = httputil.urljoin(request.script_name,
281 request.path_info)
282 except AttributeError:
283 return None
284
285 while True:
286 if path in self.apps:
287 return path
288
289 if path == '':
290 return None
291
292 # Move one node up the tree and try again.
293 path = path[:path.rfind('/')]
294
295 def __call__(self, environ, start_response):
296 """Pre-initialize WSGI env and call WSGI-callable."""

Callers 3

__call__Method · 0.95
handlerFunction · 0.45
respondMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected