Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
banama committed May 7, 2014
1 parent 4e2c208 commit b77c85c
Showing 1 changed file with 16 additions and 22 deletions.
38 changes: 16 additions & 22 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,19 +774,15 @@ def __repr__(self):


def create_environ(*args, **kwargs):
"""Create a new WSGI environ dict based on the values passed. The first
parameter should be the path of the request which defaults to '/'. The
second one can either be an absolute path (in that case the host is
localhost:80) or a full path to the request with scheme, netloc port and
the path to the script.
"""根据传入的值创建一个 WSGI 环境。第一个参数应该是请求的路径,默认为 '/'。
另一个参数或者是一个绝对路径(在这个例子中主机是 localhost:80)或请求的完整
路径,端口和脚本路径。
This accepts the same arguments as the :class:`EnvironBuilder`
constructor.
它和 :class:`EnvironBuilder` 构造函数接受相同的参数。
.. versionchanged:: 0.5
This function is now a thin wrapper over :class:`EnvironBuilder` which
was added in 0.5. The `headers`, `environ_base`, `environ_overrides`
and `charset` parameters were added.
这个函数现在是一个 :class:`EnvironBuilder` 包裹,在 0.5 版本被添加。需要
`headers`, `environ_base`, `environ_overrides` 和 `charset` 参数。
"""
builder = EnvironBuilder(*args, **kwargs)
try:
Expand All @@ -796,21 +792,19 @@ def create_environ(*args, **kwargs):


def run_wsgi_app(app, environ, buffered=False):
"""Return a tuple in the form (app_iter, status, headers) of the
application output. This works best if you pass it an application that
returns an iterator all the time.
"""返回一个应用输出的元组形式 (app_iter, status, headers)。如果你通过应用
返回一个迭代器他将会工作的更好。
Sometimes applications may use the `write()` callable returned
by the `start_response` function. This tries to resolve such edge
cases automatically. But if you don't get the expected output you
should set `buffered` to `True` which enforces buffering.
有时应用可以使用 `start_ewsponse` 返回的 `write()` 回调函数。这将会自动解
决边界情况。如果没有得到预期输出,你应该将 `buffered` 设为 `True` 执行
buffering
If passed an invalid WSGI application the behavior of this function is
undefined. Never pass non-conforming WSGI applications to this function.
如果传入一个错误的应用,这个函数将会是未定义的。不要给这个函数传入一个不标准
WSGI 应用。
:param app: the application to execute.
:param buffered: set to `True` to enforce buffering.
:return: tuple in the form ``(app_iter, status, headers)``
:param app: 要执行的应用。
:param buffered: 设为 `True` 来执行 buffering.
:return: 元组形式 ``(app_iter, status, headers)``
"""
environ = _get_environ(environ)
response = []
Expand Down

0 comments on commit b77c85c

Please sign in to comment.