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

Method _execute

python/python3/tornado/web.py:1665–1728  ·  view source on GitHub ↗

Executes this request with the given output transforms.

(
        self, transforms: List["OutputTransform"], *args: bytes, **kwargs: bytes
    )

Source from the content-addressed store, hash-verified

1663 return match
1664
1665 async def _execute(
1666 self, transforms: List["OutputTransform"], *args: bytes, **kwargs: bytes
1667 ) -> None:
1668 """Executes this request with the given output transforms."""
1669 self._transforms = transforms
1670 try:
1671 if self.request.method not in self.SUPPORTED_METHODS:
1672 raise HTTPError(405)
1673 self.path_args = [self.decode_argument(arg) for arg in args]
1674 self.path_kwargs = dict(
1675 (k, self.decode_argument(v, name=k)) for (k, v) in kwargs.items()
1676 )
1677 # If XSRF cookies are turned on, reject form submissions without
1678 # the proper cookie
1679 if (
1680 self.request.method
1681 not in (
1682 "GET",
1683 "HEAD",
1684 "OPTIONS",
1685 )
1686 and self.application.settings.get("xsrf_cookies")
1687 ):
1688 self.check_xsrf_cookie()
1689
1690 result = self.prepare()
1691 if result is not None:
1692 result = await result
1693 if self._prepared_future is not None:
1694 # Tell the Application we've finished with prepare()
1695 # and are ready for the body to arrive.
1696 future_set_result_unless_cancelled(self._prepared_future, None)
1697 if self._finished:
1698 return
1699
1700 if _has_stream_request_body(self.__class__):
1701 # In streaming mode request.body is a Future that signals
1702 # the body has been completely received. The Future has no
1703 # result; the data has been passed to self.data_received
1704 # instead.
1705 try:
1706 await self.request._body_future
1707 except iostream.StreamClosedError:
1708 return
1709
1710 method = getattr(self, self.request.method.lower())
1711 result = method(*self.path_args, **self.path_kwargs)
1712 if result is not None:
1713 result = await result
1714 if self._auto_finish and not self._finished:
1715 self.finish()
1716 except Exception as e:
1717 try:
1718 self._handle_request_exception(e)
1719 except Exception:
1720 app_log.error("Exception in exception handler", exc_info=True)
1721 finally:
1722 # Unset result to avoid circular references

Callers 1

executeMethod · 0.80

Calls 12

decode_argumentMethod · 0.95
check_xsrf_cookieMethod · 0.95
prepareMethod · 0.95
finishMethod · 0.95
HTTPErrorClass · 0.85
_has_stream_request_bodyFunction · 0.85
itemsMethod · 0.80
errorMethod · 0.80
getMethod · 0.45
doneMethod · 0.45

Tested by

no test coverage detected