Skip to content

Commit

Permalink
Removed extra indentation from some examples (:linenos: should be ind…
Browse files Browse the repository at this point in the history
…ented with the same indentation as the rest of the code block)
  • Loading branch information
ztane committed Nov 16, 2013
1 parent 94b754a commit 392a6c7
Show file tree
Hide file tree
Showing 16 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion docs/designdefense.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ The contents of ``app2.py``:
The contents of ``config.py``: The contents of ``config.py``:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
L = [] L = []
Expand Down
6 changes: 3 additions & 3 deletions docs/narr/events.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ track of the information that subscribers will need. Here are some
example custom event classes: example custom event classes:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
class DocCreated(object): class DocCreated(object):
def __init__(self, doc, request): def __init__(self, doc, request):
Expand All @@ -196,7 +196,7 @@ also use custom events with :ref:`subscriber predicates
event with a decorator: event with a decorator:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.events import subscriber from pyramid.events import subscriber
from .events import DocCreated from .events import DocCreated
Expand All @@ -215,7 +215,7 @@ To fire your custom events use the
accessed as ``request.registry.notify``. For example: accessed as ``request.registry.notify``. For example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from .events import DocCreated from .events import DocCreated
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/extending.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ For example, if the original application has the following
``configure_views`` configuration method: ``configure_views`` configuration method:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def configure_views(config): def configure_views(config):
config.add_view('theoriginalapp.views.theview', name='theview') config.add_view('theoriginalapp.views.theview', name='theview')
Expand Down
20 changes: 10 additions & 10 deletions docs/narr/hooks.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ and modify the set of :term:`renderer globals` before they are passed to a
that can be used for this purpose. For example: that can be used for this purpose. For example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.events import subscriber from pyramid.events import subscriber
from pyramid.events import BeforeRender from pyramid.events import BeforeRender
Expand Down Expand Up @@ -998,7 +998,7 @@ downstream Pyramid application.
You can write the tween factory as a simple closure-returning function: You can write the tween factory as a simple closure-returning function:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def simple_tween_factory(handler, registry): def simple_tween_factory(handler, registry):
# one-time configuration code goes here # one-time configuration code goes here
Expand All @@ -1020,7 +1020,7 @@ Alternatively, the tween factory can be a class with the ``__call__`` magic
method: method:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
class simple_tween_factory(object): class simple_tween_factory(object):
def __init__(handler, registry): def __init__(handler, registry):
Expand Down Expand Up @@ -1049,7 +1049,7 @@ Here's a complete example of a tween that logs the time spent processing each
request: request:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
# in a module named myapp.tweens # in a module named myapp.tweens
Expand Down Expand Up @@ -1101,7 +1101,7 @@ Here's an example of registering a tween factory as an "implicit" tween in a
Pyramid application: Pyramid application:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.config import Configurator from pyramid.config import Configurator
config = Configurator() config = Configurator()
Expand Down Expand Up @@ -1135,7 +1135,7 @@ chain (the tween generated by the very last tween factory added) as its
request handler function. For example: request handler function. For example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.config import Configurator from pyramid.config import Configurator
Expand Down Expand Up @@ -1379,7 +1379,7 @@ route predicate factory is most often a class with a constructor
method. For example: method. For example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
class ContentTypePredicate(object): class ContentTypePredicate(object):
def __init__(self, val, config): def __init__(self, val, config):
Expand Down Expand Up @@ -1442,7 +1442,7 @@ with a subscriber that subscribes to the :class:`pyramid.events.NewRequest`
event type. event type.


.. code-block:: python .. code-block:: python
:linenos: :linenos:
class RequestPathStartsWith(object): class RequestPathStartsWith(object):
def __init__(self, val, config): def __init__(self, val, config):
Expand Down Expand Up @@ -1471,7 +1471,7 @@ previously registered ``request_path_startswith`` predicate in a call to
:meth:`~pyramid.config.Configurator.add_subscriber`: :meth:`~pyramid.config.Configurator.add_subscriber`:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
# define a subscriber in your code # define a subscriber in your code
Expand All @@ -1487,7 +1487,7 @@ Here's the same subscriber/predicate/event-type combination used via
:class:`~pyramid.events.subscriber`. :class:`~pyramid.events.subscriber`.


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.events import subscriber from pyramid.events import subscriber
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/hybrid.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ An application that uses only traversal will have view configuration
declarations that look like this: declarations that look like this:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
# config is an instance of pyramid.config.Configurator # config is an instance of pyramid.config.Configurator
Expand Down
8 changes: 4 additions & 4 deletions docs/narr/i18n.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ In particular, add the ``Babel`` and ``lingua`` distributions to the
application's ``setup.py`` file: application's ``setup.py`` file:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
setup(name="mypackage", setup(name="mypackage",
# ... # ...
Expand Down Expand Up @@ -370,7 +370,7 @@ file of a ``pcreate`` -generated :app:`Pyramid` application has stanzas in it
that look something like the following: that look something like the following:


.. code-block:: ini .. code-block:: ini
:linenos: :linenos:
[compile_catalog] [compile_catalog]
directory = myproject/locale directory = myproject/locale
Expand Down Expand Up @@ -398,7 +398,7 @@ that you'd like the domain of your translations to be ``mydomain``
instead, change the ``setup.cfg`` file stanzas to look like so: instead, change the ``setup.cfg`` file stanzas to look like so:


.. code-block:: ini .. code-block:: ini
:linenos: :linenos:
[compile_catalog] [compile_catalog]
directory = myproject/locale directory = myproject/locale
Expand Down Expand Up @@ -1041,7 +1041,7 @@ if no locale can be determined.
Here's an implementation of a simple locale negotiator: Here's an implementation of a simple locale negotiator:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def my_locale_negotiator(request): def my_locale_negotiator(request):
locale_name = request.params.get('my_locale') locale_name = request.params.get('my_locale')
Expand Down
6 changes: 3 additions & 3 deletions docs/narr/introduction.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ For example, instead of returning a ``Response`` object from a
``render_to_response`` call: ``render_to_response`` call:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.renderers import render_to_response from pyramid.renderers import render_to_response
Expand All @@ -347,7 +347,7 @@ For example, instead of returning a ``Response`` object from a
You can return a Python dictionary: You can return a Python dictionary:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.view import view_config from pyramid.view import view_config
Expand Down Expand Up @@ -827,7 +827,7 @@ Here's an example of using Pyramid's introspector from within a view
callable: callable:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.view import view_config from pyramid.view import view_config
from pyramid.response import Response from pyramid.response import Response
Expand Down
4 changes: 2 additions & 2 deletions docs/narr/introspector.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here's an example of using Pyramid's introspector from within a view
callable: callable:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.view import view_config from pyramid.view import view_config
from pyramid.response import Response from pyramid.response import Response
Expand Down Expand Up @@ -100,7 +100,7 @@ its ``__getitem__``, ``get``, ``keys``, ``values``, or ``items`` methods.
For example: For example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
route_intr = introspector.get('routes', 'edit_user') route_intr = introspector.get('routes', 'edit_user')
pattern = route_intr['pattern'] pattern = route_intr['pattern']
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/logging.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ file, simply create a logger object using the ``__name__`` builtin and call
methods on it. methods on it.


.. code-block:: python .. code-block:: python
:linenos: :linenos:
import logging import logging
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/resources.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ works against resource instances.
Here's a sample resource tree, represented by a variable named ``root``: Here's a sample resource tree, represented by a variable named ``root``:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
class Resource(dict): class Resource(dict):
pass pass
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/scaffolding.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ want to have extension scaffolds that can work across Pyramid 1.0.X, 1.1.X,
defining your scaffold template: defining your scaffold template:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
try: # pyramid 1.0.X try: # pyramid 1.0.X
# "pyramid.paster.paste_script..." doesn't exist past 1.0.X # "pyramid.paster.paste_script..." doesn't exist past 1.0.X
Expand Down
4 changes: 2 additions & 2 deletions docs/narr/upgrading.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ In the above case, it's line #3 in the ``myproj.views`` module (``from
pyramid.view import static``) that is causing the problem: pyramid.view import static``) that is causing the problem:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.view import view_config from pyramid.view import view_config
Expand All @@ -148,7 +148,7 @@ The deprecation warning tells me how to fix it, so I can change the code to
do things the newer way: do things the newer way:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.view import view_config from pyramid.view import view_config
Expand Down
10 changes: 5 additions & 5 deletions docs/narr/urldispatch.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ The simplest route declaration which configures a route match to *directly*
result in a particular view callable being invoked: result in a particular view callable being invoked:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
config.add_route('idea', 'site/{id}') config.add_route('idea', 'site/{id}')
config.add_view('mypackage.views.site_view', route_name='idea') config.add_view('mypackage.views.site_view', route_name='idea')
Expand Down Expand Up @@ -901,7 +901,7 @@ Details of the route matching decision for a particular request to the
which you started the application from. For example: which you started the application from. For example:


.. code-block:: text .. code-block:: text
:linenos: :linenos:
$ PYRAMID_DEBUG_ROUTEMATCH=true $VENV/bin/pserve development.ini $ PYRAMID_DEBUG_ROUTEMATCH=true $VENV/bin/pserve development.ini
Starting server in PID 13586. Starting server in PID 13586.
Expand Down Expand Up @@ -1060,7 +1060,7 @@ A custom route predicate may also *modify* the ``match`` dictionary. For
instance, a predicate might do some type conversion of values: instance, a predicate might do some type conversion of values:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def integers(*segment_names): def integers(*segment_names):
def predicate(info, request): def predicate(info, request):
Expand All @@ -1086,7 +1086,7 @@ To avoid the try/except uncertainty, the route pattern can contain regular
expressions specifying requirements for that marker. For instance: expressions specifying requirements for that marker. For instance:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def integers(*segment_names): def integers(*segment_names):
def predicate(info, request): def predicate(info, request):
Expand Down Expand Up @@ -1128,7 +1128,7 @@ name. The ``pattern`` attribute is the route pattern. An example of using
the route in a set of route predicates: the route in a set of route predicates:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
def twenty_ten(info, request): def twenty_ten(info, request):
if info['route'].name in ('ymd', 'ym', 'y'): if info['route'].name in ('ymd', 'ym', 'y'):
Expand Down
4 changes: 2 additions & 2 deletions docs/narr/vhosting.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ An example of an Apache ``mod_proxy`` configuration that will host the
is below: is below:


.. code-block:: apache .. code-block:: apache
:linenos: :linenos:
NameVirtualHost *:80 NameVirtualHost *:80
Expand All @@ -130,7 +130,7 @@ For a :app:`Pyramid` application running under :term:`mod_wsgi`,
the same can be achieved using ``SetEnv``: the same can be achieved using ``SetEnv``:


.. code-block:: apache .. code-block:: apache
:linenos: :linenos:
<Location /> <Location />
SetEnv HTTP_X_VHM_ROOT /cms SetEnv HTTP_X_VHM_ROOT /cms
Expand Down
2 changes: 1 addition & 1 deletion docs/narr/views.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ The following types work as view callables in this style:
e.g.: e.g.:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
from pyramid.response import Response from pyramid.response import Response
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/wiki/authorization.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ to the ``@view_config`` decorator for ``add_page()`` and
``edit_page()``, for example: ``edit_page()``, for example:


.. code-block:: python .. code-block:: python
:linenos: :linenos:
:emphasize-lines: 3 :emphasize-lines: 3
@view_config(name='add_page', context='.models.Wiki', @view_config(name='add_page', context='.models.Wiki',
renderer='templates/edit.pt', renderer='templates/edit.pt',
Expand Down

0 comments on commit 392a6c7

Please sign in to comment.