Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed extra indentation from some examples (:linenos: should be ind…

…ented with the same indentation as the rest of the code block)
  • Loading branch information...
commit 392a6c7df93b67d6889680133fda0f744970d61f 1 parent 94b754a
@ztane ztane authored
View
2  docs/designdefense.rst
@@ -1078,7 +1078,7 @@ The contents of ``app2.py``:
The contents of ``config.py``:
.. code-block:: python
- :linenos:
+ :linenos:
L = []
View
6 docs/narr/events.rst
@@ -172,7 +172,7 @@ track of the information that subscribers will need. Here are some
example custom event classes:
.. code-block:: python
- :linenos:
+ :linenos:
class DocCreated(object):
def __init__(self, doc, request):
@@ -196,7 +196,7 @@ also use custom events with :ref:`subscriber predicates
event with a decorator:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.events import subscriber
from .events import DocCreated
@@ -215,7 +215,7 @@ To fire your custom events use the
accessed as ``request.registry.notify``. For example:
.. code-block:: python
- :linenos:
+ :linenos:
from .events import DocCreated
View
2  docs/narr/extending.rst
@@ -234,7 +234,7 @@ For example, if the original application has the following
``configure_views`` configuration method:
.. code-block:: python
- :linenos:
+ :linenos:
def configure_views(config):
config.add_view('theoriginalapp.views.theview', name='theview')
View
20 docs/narr/hooks.rst
@@ -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:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.events import subscriber
from pyramid.events import BeforeRender
@@ -998,7 +998,7 @@ downstream Pyramid application.
You can write the tween factory as a simple closure-returning function:
.. code-block:: python
- :linenos:
+ :linenos:
def simple_tween_factory(handler, registry):
# one-time configuration code goes here
@@ -1020,7 +1020,7 @@ Alternatively, the tween factory can be a class with the ``__call__`` magic
method:
.. code-block:: python
- :linenos:
+ :linenos:
class simple_tween_factory(object):
def __init__(handler, registry):
@@ -1049,7 +1049,7 @@ Here's a complete example of a tween that logs the time spent processing each
request:
.. code-block:: python
- :linenos:
+ :linenos:
# in a module named myapp.tweens
@@ -1101,7 +1101,7 @@ Here's an example of registering a tween factory as an "implicit" tween in a
Pyramid application:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.config import Configurator
config = Configurator()
@@ -1135,7 +1135,7 @@ chain (the tween generated by the very last tween factory added) as its
request handler function. For example:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.config import Configurator
@@ -1379,7 +1379,7 @@ route predicate factory is most often a class with a constructor
method. For example:
.. code-block:: python
- :linenos:
+ :linenos:
class ContentTypePredicate(object):
def __init__(self, val, config):
@@ -1442,7 +1442,7 @@ with a subscriber that subscribes to the :class:`pyramid.events.NewRequest`
event type.
.. code-block:: python
- :linenos:
+ :linenos:
class RequestPathStartsWith(object):
def __init__(self, val, config):
@@ -1471,7 +1471,7 @@ previously registered ``request_path_startswith`` predicate in a call to
:meth:`~pyramid.config.Configurator.add_subscriber`:
.. code-block:: python
- :linenos:
+ :linenos:
# define a subscriber in your code
@@ -1487,7 +1487,7 @@ Here's the same subscriber/predicate/event-type combination used via
:class:`~pyramid.events.subscriber`.
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.events import subscriber
View
2  docs/narr/hybrid.rst
@@ -63,7 +63,7 @@ An application that uses only traversal will have view configuration
declarations that look like this:
.. code-block:: python
- :linenos:
+ :linenos:
# config is an instance of pyramid.config.Configurator
View
8 docs/narr/i18n.rst
@@ -309,7 +309,7 @@ In particular, add the ``Babel`` and ``lingua`` distributions to the
application's ``setup.py`` file:
.. code-block:: python
- :linenos:
+ :linenos:
setup(name="mypackage",
# ...
@@ -370,7 +370,7 @@ file of a ``pcreate`` -generated :app:`Pyramid` application has stanzas in it
that look something like the following:
.. code-block:: ini
- :linenos:
+ :linenos:
[compile_catalog]
directory = myproject/locale
@@ -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:
.. code-block:: ini
- :linenos:
+ :linenos:
[compile_catalog]
directory = myproject/locale
@@ -1041,7 +1041,7 @@ if no locale can be determined.
Here's an implementation of a simple locale negotiator:
.. code-block:: python
- :linenos:
+ :linenos:
def my_locale_negotiator(request):
locale_name = request.params.get('my_locale')
View
6 docs/narr/introduction.rst
@@ -336,7 +336,7 @@ For example, instead of returning a ``Response`` object from a
``render_to_response`` call:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.renderers import render_to_response
@@ -347,7 +347,7 @@ For example, instead of returning a ``Response`` object from a
You can return a Python dictionary:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.view import view_config
@@ -827,7 +827,7 @@ Here's an example of using Pyramid's introspector from within a view
callable:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.view import view_config
from pyramid.response import Response
View
4 docs/narr/introspector.rst
@@ -24,7 +24,7 @@ Here's an example of using Pyramid's introspector from within a view
callable:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.view import view_config
from pyramid.response import Response
@@ -100,7 +100,7 @@ its ``__getitem__``, ``get``, ``keys``, ``values``, or ``items`` methods.
For example:
.. code-block:: python
- :linenos:
+ :linenos:
route_intr = introspector.get('routes', 'edit_user')
pattern = route_intr['pattern']
View
2  docs/narr/logging.rst
@@ -179,7 +179,7 @@ file, simply create a logger object using the ``__name__`` builtin and call
methods on it.
.. code-block:: python
- :linenos:
+ :linenos:
import logging
log = logging.getLogger(__name__)
View
2  docs/narr/resources.rst
@@ -83,7 +83,7 @@ works against resource instances.
Here's a sample resource tree, represented by a variable named ``root``:
.. code-block:: python
- :linenos:
+ :linenos:
class Resource(dict):
pass
View
2  docs/narr/scaffolding.rst
@@ -112,7 +112,7 @@ want to have extension scaffolds that can work across Pyramid 1.0.X, 1.1.X,
defining your scaffold template:
.. code-block:: python
- :linenos:
+ :linenos:
try: # pyramid 1.0.X
# "pyramid.paster.paste_script..." doesn't exist past 1.0.X
View
4 docs/narr/upgrading.rst
@@ -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:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.view import view_config
@@ -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:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.view import view_config
View
10 docs/narr/urldispatch.rst
@@ -492,7 +492,7 @@ The simplest route declaration which configures a route match to *directly*
result in a particular view callable being invoked:
.. code-block:: python
- :linenos:
+ :linenos:
config.add_route('idea', 'site/{id}')
config.add_view('mypackage.views.site_view', route_name='idea')
@@ -901,7 +901,7 @@ Details of the route matching decision for a particular request to the
which you started the application from. For example:
.. code-block:: text
- :linenos:
+ :linenos:
$ PYRAMID_DEBUG_ROUTEMATCH=true $VENV/bin/pserve development.ini
Starting server in PID 13586.
@@ -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:
.. code-block:: python
- :linenos:
+ :linenos:
def integers(*segment_names):
def predicate(info, request):
@@ -1086,7 +1086,7 @@ To avoid the try/except uncertainty, the route pattern can contain regular
expressions specifying requirements for that marker. For instance:
.. code-block:: python
- :linenos:
+ :linenos:
def integers(*segment_names):
def predicate(info, request):
@@ -1128,7 +1128,7 @@ name. The ``pattern`` attribute is the route pattern. An example of using
the route in a set of route predicates:
.. code-block:: python
- :linenos:
+ :linenos:
def twenty_ten(info, request):
if info['route'].name in ('ymd', 'ym', 'y'):
View
4 docs/narr/vhosting.rst
@@ -109,7 +109,7 @@ An example of an Apache ``mod_proxy`` configuration that will host the
is below:
.. code-block:: apache
- :linenos:
+ :linenos:
NameVirtualHost *:80
@@ -130,7 +130,7 @@ For a :app:`Pyramid` application running under :term:`mod_wsgi`,
the same can be achieved using ``SetEnv``:
.. code-block:: apache
- :linenos:
+ :linenos:
<Location />
SetEnv HTTP_X_VHM_ROOT /cms
View
2  docs/narr/views.rst
@@ -536,7 +536,7 @@ The following types work as view callables in this style:
e.g.:
.. code-block:: python
- :linenos:
+ :linenos:
from pyramid.response import Response
View
4 docs/tutorials/wiki/authorization.rst
@@ -149,8 +149,8 @@ to the ``@view_config`` decorator for ``add_page()`` and
``edit_page()``, for example:
.. code-block:: python
- :linenos:
- :emphasize-lines: 3
+ :linenos:
+ :emphasize-lines: 3
@view_config(name='add_page', context='.models.Wiki',
renderer='templates/edit.pt',
Please sign in to comment.
Something went wrong with that request. Please try again.