From 88cafdd3cf621d0a117f0e2e8c924c07dfbf5ef1 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 23 Mar 2013 12:03:45 +0200 Subject: no need to qualify Python interactive sessions Sphinx automatically notices them as Python snippets and gives them syntax highlighting. These snippets are also too short to deserve linenos. --- docs/narr/sessions.rst | 43 +++++++++++++++++-------------------------- pyramid/decorator.py | 18 ++++++++---------- pyramid/util.py | 21 +++++++++------------ 3 files changed, 34 insertions(+), 48 deletions(-) diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index fa4affd8a..c4f4b5f07 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -252,25 +252,19 @@ that were added to the flash queue, and empties the queue. .. method:: pop_flash(queue='') -.. code-block:: python - :linenos: - - >>> request.session.flash('info message') - >>> request.session.pop_flash() - ['info message'] +>>> request.session.flash('info message') +>>> request.session.pop_flash() +['info message'] Calling ``session.pop_flash()`` again like above without a corresponding call to ``session.flash()`` will return an empty list, because the queue has already been popped. -.. code-block:: python - :linenos: - - >>> request.session.flash('info message') - >>> request.session.pop_flash() - ['info message'] - >>> request.session.pop_flash() - [] +>>> request.session.flash('info message') +>>> request.session.pop_flash() +['info message'] +>>> request.session.pop_flash() +[] .. index:: single: session.peek_flash @@ -285,18 +279,15 @@ popped from flash storage. .. method:: peek_flash(queue='') -.. code-block:: python - :linenos: - - >>> request.session.flash('info message') - >>> request.session.peek_flash() - ['info message'] - >>> request.session.peek_flash() - ['info message'] - >>> request.session.pop_flash() - ['info message'] - >>> request.session.peek_flash() - [] +>>> request.session.flash('info message') +>>> request.session.peek_flash() +['info message'] +>>> request.session.peek_flash() +['info message'] +>>> request.session.pop_flash() +['info message'] +>>> request.session.peek_flash() +[] .. index:: single: preventing cross-site request forgery attacks diff --git a/pyramid/decorator.py b/pyramid/decorator.py index 82d2b1280..e5f2996dc 100644 --- a/pyramid/decorator.py +++ b/pyramid/decorator.py @@ -15,16 +15,14 @@ class reify(object): And usage of Foo: - .. code-block:: text - - >>> f = Foo() - >>> v = f.jammy - 'jammy called' - >>> print v - 1 - >>> f.jammy - 1 - >>> # jammy func not called the second time; it replaced itself with 1 + >>> f = Foo() + >>> v = f.jammy + 'jammy called' + >>> print v + 1 + >>> f.jammy + 1 + >>> # jammy func not called the second time; it replaced itself with 1 """ def __init__(self, wrapped): self.wrapped = wrapped diff --git a/pyramid/util.py b/pyramid/util.py index 56049af87..02bd7ba2a 100644 --- a/pyramid/util.py +++ b/pyramid/util.py @@ -234,18 +234,15 @@ def object_description(object): """ Produce a human-consumable text description of ``object``, usually involving a Python dotted name. For example: - .. code-block:: python - - >>> object_description(None) - u'None' - >>> from xml.dom import minidom - >>> object_description(minidom) - u'module xml.dom.minidom' - >>> object_description(minidom.Attr) - u'class xml.dom.minidom.Attr' - >>> object_description(minidom.Attr.appendChild) - u'method appendChild of class xml.dom.minidom.Attr' - >>> + >>> object_description(None) + u'None' + >>> from xml.dom import minidom + >>> object_description(minidom) + u'module xml.dom.minidom' + >>> object_description(minidom.Attr) + u'class xml.dom.minidom.Attr' + >>> object_description(minidom.Attr.appendChild) + u'method appendChild of class xml.dom.minidom.Attr' If this method cannot identify the type of the object, a generic description ala ``object `` will be returned. -- cgit v1.2.3