Skip to content

Commit

Permalink
- Document parameter mode for the compile_restricted function…
Browse files Browse the repository at this point in the history
…s (fixes

  #157)
  • Loading branch information
dataflake committed Jul 12, 2020
1 parent a3d5a38 commit 1b9b4e8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changes
5.1a0 (unreleased)
------------------

- Document parameter ``mode`` for the ``compile_restricted`` functions
(`#157 <https://github.com/zopefoundation/RestrictedPython/issues/157>`_)

- Fix documentation for ``compile_restricted_function``
(`#158 <https://github.com/zopefoundation/RestrictedPython/issues/158>`_)

Expand Down
6 changes: 5 additions & 1 deletion docs/usage/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ API overview

:param source: (required). the source code that should be compiled
:param filename: (optional). defaults to ``'<unknown>'``
:param mode: (optional). defaults to ``'exec'``
:param mode: (optional). Use ``'exec'``, ``'eval'``, ``'single'`` or ``'function'``. defaults to ``'exec'``
:param flags: (optional). defaults to ``0``
:param dont_inherit: (optional). defaults to ``False``
:param policy: (optional). defaults to ``RestrictingNodeTransformer``
Expand All @@ -27,6 +27,7 @@ API overview
:module: RestrictedPython

Compiles source code into interpretable byte code with ``mode='exec'``.
Use mode ``'exec'`` if the source contains a sequence of statements.
The meaning and defaults of the parameters are the same as in
``compile_restricted``.

Expand All @@ -36,6 +37,7 @@ API overview
:module: RestrictedPython

Compiles source code into interpretable byte code with ``mode='eval'``.
Use mode ``'eval'`` if the source contains a single expression.
The meaning and defaults of the parameters are the same as in
``compile_restricted``.

Expand All @@ -45,6 +47,7 @@ API overview
:module: RestrictedPython

Compiles source code into interpretable byte code with ``mode='eval'``.
Use mode ``'single'`` if the source contains a single interactive statement.
The meaning and defaults of the parameters are the same as in
``compile_restricted``.

Expand All @@ -54,6 +57,7 @@ API overview
:module: RestrictedPython

Compiles source code into interpretable byte code with ``mode='function'``.
Use mode ``'function'`` for full functions.

:param p: (required). a string representing the function parameters
:param body: (required). the function body
Expand Down

0 comments on commit 1b9b4e8

Please sign in to comment.