MCPcopy
hub / github.com/tornadoweb/tornado / get_absolute_path

Method get_absolute_path

tornado/web.py:2940–2954  ·  view source on GitHub ↗

Returns the absolute location of ``path`` relative to ``root``. ``root`` is the path configured for this `StaticFileHandler` (in most cases the ``static_path`` `Application` setting). This class method may be overridden in subclasses. By default it returns a filesy

(cls, root: str, path: str)

Source from the content-addressed store, hash-verified

2938
2939 @classmethod
2940 def get_absolute_path(cls, root: str, path: str) -> str:
2941 """Returns the absolute location of ``path`` relative to ``root``.
2942
2943 ``root`` is the path configured for this `StaticFileHandler`
2944 (in most cases the ``static_path`` `Application` setting).
2945
2946 This class method may be overridden in subclasses. By default
2947 it returns a filesystem path, but other strings may be used
2948 as long as they are unique and understood by the subclass's
2949 overridden `get_content`.
2950
2951 .. versionadded:: 3.1
2952 """
2953 abspath = os.path.abspath(os.path.join(root, path))
2954 return abspath
2955
2956 def validate_absolute_path(self, root: str, absolute_path: str) -> Optional[str]:
2957 """Validate and return the absolute path.

Callers 2

getMethod · 0.95
get_versionMethod · 0.45

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected