MCPcopy Create free account
hub / github.com/EasyIME/PIME / wrapper

Function wrapper

python/python3/tornado/web.py:1877–1890  ·  view source on GitHub ↗
(  # type: ignore
        self: RequestHandler, *args, **kwargs
    )

Source from the content-addressed store, hash-verified

1875
1876 @functools.wraps(method)
1877 def wrapper( # type: ignore
1878 self: RequestHandler, *args, **kwargs
1879 ) -> Optional[Awaitable[None]]:
1880 if self.request.path.endswith("/"):
1881 if self.request.method in ("GET", "HEAD"):
1882 uri = self.request.path.rstrip("/")
1883 if uri: # don't try to redirect '/' to ''
1884 if self.request.query:
1885 uri += "?" + self.request.query
1886 self.redirect(uri, permanent=True)
1887 return None
1888 else:
1889 raise HTTPError(404)
1890 return method(self, *args, **kwargs)
1891
1892 return wrapper
1893

Callers

nothing calls this directly

Calls 4

HTTPErrorClass · 0.85
redirectMethod · 0.80
full_urlMethod · 0.80
get_login_urlMethod · 0.45

Tested by

no test coverage detected