From a575d1f9d77195d53f55fa8b409bd7c21f3f64de Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 17 Apr 2016 15:38:26 -0700 Subject: update RELEASING.txt to better account for master and previous branches - add term "final" release - explicitify the implicit - --- docs/conf.py | 1 + 1 file changed, 1 insertion(+) (limited to 'docs') diff --git a/docs/conf.py b/docs/conf.py index 786ff3abf..518f7e784 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -138,6 +138,7 @@ if book: # 'whatsnew-1.4': 'index', # 'whatsnew-1.5': 'index', # 'whatsnew-1.6': 'index', +# 'whatsnew-1.7': 'index', # 'tutorials/gae/index': 'index', # 'api/chameleon_text': 'api', # 'api/chameleon_zpt': 'api', -- cgit v1.2.3 From de3d0c784198796285ddc4c80e45b8082ecab9e2 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 18 Apr 2016 10:15:32 -0500 Subject: replace pyramid.require_default_csrf setting with config.set_default_csrf_options --- docs/api/config.rst | 2 ++ docs/narr/extconfig.rst | 1 + docs/narr/introspector.rst | 25 +++++++++++++++ docs/narr/sessions.rst | 76 ++++++++++++++++++++++++---------------------- 4 files changed, 68 insertions(+), 36 deletions(-) (limited to 'docs') diff --git a/docs/api/config.rst b/docs/api/config.rst index e083dbc68..ab3ff0fe1 100644 --- a/docs/api/config.rst +++ b/docs/api/config.rst @@ -35,6 +35,7 @@ .. automethod:: set_authentication_policy .. automethod:: set_authorization_policy + .. automethod:: set_default_csrf_options .. automethod:: set_default_permission .. automethod:: add_permission @@ -65,6 +66,7 @@ .. automethod:: add_traverser .. automethod:: add_tween .. automethod:: add_route_predicate + .. automethod:: add_subscriber_predicate .. automethod:: add_view_predicate .. automethod:: add_view_deriver .. automethod:: set_request_factory diff --git a/docs/narr/extconfig.rst b/docs/narr/extconfig.rst index af7d0a349..babfa0a98 100644 --- a/docs/narr/extconfig.rst +++ b/docs/narr/extconfig.rst @@ -261,6 +261,7 @@ Pre-defined Phases - :meth:`pyramid.config.Configurator.add_view_predicate` - :meth:`pyramid.config.Configurator.add_view_deriver` - :meth:`pyramid.config.Configurator.set_authorization_policy` +- :meth:`pyramid.config.Configurator.set_default_csrf_options` - :meth:`pyramid.config.Configurator.set_default_permission` - :meth:`pyramid.config.Configurator.set_view_mapper` diff --git a/docs/narr/introspector.rst b/docs/narr/introspector.rst index 98315ac9f..c9fecd4f4 100644 --- a/docs/narr/introspector.rst +++ b/docs/narr/introspector.rst @@ -337,6 +337,31 @@ introspectables in categories not described here. The permission name passed to ``set_default_permission``. +``default csrf options`` + + There will be one and only one introspectable in the ``default csrf options`` + category. It represents a call to the + :meth:`pyramid.config.Configurator.set_default_csrf_options` method. It + will have the following data. + + ``require_csrf`` + + The default value for ``require_csrf`` if left unspecified on calls to + :meth:`pyramid.config.Configurator.add_view`. + + ``token`` + + The name of the token searched in ``request.POST`` to find a valid CSRF + token. + + ``header`` + + The name of the request header searched to find a valid CSRF token. + + ``safe_methods`` + + The list of HTTP methods considered safe and exempt from CSRF checks. + ``views`` Each introspectable in the ``views`` category represents a call to diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index 7cf96ac7d..bfc908396 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -396,13 +396,13 @@ named ``X-CSRF-Token``. .. code-block:: python - from pyramid.session import check_csrf_token + from pyramid.session import check_csrf_token - def myview(request): - # Require CSRF Token - check_csrf_token(request) + def myview(request): + # Require CSRF Token + check_csrf_token(request) - # ... + # ... .. _auto_csrf_checking: @@ -414,41 +414,45 @@ Checking CSRF Tokens Automatically :app:`Pyramid` supports automatically checking CSRF tokens on requests with an unsafe method as defined by RFC2616. Any other request may be checked manually. This feature can be turned on globally for an application using the -``pyramid.require_default_csrf`` setting. - -If the ``pyramid.required_default_csrf`` setting is a :term:`truthy string` or -``True`` then the default CSRF token parameter will be ``csrf_token``. If a -different token is desired, it may be passed as the value. Finally, a -:term:`falsey string` or ``False`` will turn off automatic CSRF checking -globally on every request. - -No matter what, CSRF checking may be explicitly enabled or disabled on a -per-view basis using the ``require_csrf`` view option. This option is of the -same format as the ``pyramid.require_default_csrf`` setting, accepting strings -or boolean values. - -If ``require_csrf`` is ``True`` but does not explicitly define a token to -check, then the token name is pulled from whatever was set in the -``pyramid.require_default_csrf`` setting. Finally, if that setting does not -explicitly define a token, then ``csrf_token`` is the token required. This token -name will be required in ``request.POST`` which is the submitted form body. - -It is always possible to pass the token in the ``X-CSRF-Token`` header as well. -There is currently no way to define an alternate name for this header without -performing CSRF checking manually. - -In addition to token based CSRF checks, the automatic CSRF checking will also -check the referrer of the request to ensure that it matches one of the trusted -origins. By default the only trusted origin is the current host, however -additional origins may be configured by setting +:meth:`pyramid.config.Configurator.set_default_csrf_options` directive. +For example: + +.. code-block:: python + + from pyramid.config import Configurator + + config = Configurator() + config.set_default_csrf_options(require_csrf=True) + +CSRF checking may be explicitly enabled or disabled on a per-view basis using +the ``require_csrf`` view option. A value of ``True`` or ``False`` will +override the default set by ``set_default_csrf_options``. For example: + +.. code-block:: python + + @view_config(route_name='hello', require_csrf=False) + def myview(request): + # ... + +When CSRF checking is active, the token and header used to find the +supplied CSRF token will be ``csrf_token`` and ``X-CSRF-Token``, respectively, +unless otherwise overridden by ``set_default_csrf_options``. The token is +checked against the value in ``request.POST`` which is the submitted form body. +If this value is not present, then the header will be checked. + +In addition to token based CSRF checks, if the request is using HTTPS then the +automatic CSRF checking will also check the referrer of the request to ensure +that it matches one of the trusted origins. By default the only trusted origin +is the current host, however additional origins may be configured by setting ``pyramid.csrf_trusted_origins`` to a list of domain names (and ports if they are non standard). If a host in the list of domains starts with a ``.`` then that will allow all subdomains as well as the domain without the ``.``. -If CSRF checks fail then a :class:`pyramid.exceptions.BadCSRFToken` exception -will be raised. This exception may be caught and handled by an -:term:`exception view` but, by default, will result in a ``400 Bad Request`` -response being sent to the client. +If CSRF checks fail then a :class:`pyramid.exceptions.BadCSRFToken` or +:class:`pyramid.exceptions.BadCSRFOrigin` exception will be raised. This +exception may be caught and handled by an :term:`exception view` but, by +default, will result in a ``400 Bad Request`` response being sent to the +client. Checking CSRF Tokens with a View Predicate ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 1cb30e690a7ba97db212e7ec9002fd83f950b0bd Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 23 Apr 2016 02:45:04 -0700 Subject: Fix all the stinky linkie rot via `make linkcheck SPHINXBUILD=$VENV/bin/sphinx-build`, but don't bother with HISTORY.txt or whatsnew-xx --- docs/conventions.rst | 2 +- docs/copyright.rst | 8 +-- docs/designdefense.rst | 43 ++++++++------- docs/glossary.rst | 98 +++++++++++++++++------------------ docs/index.rst | 12 +++-- docs/narr/firstapp.rst | 2 +- docs/narr/i18n.rst | 4 +- docs/narr/install.rst | 4 +- docs/narr/introduction.rst | 12 ++--- docs/narr/logging.rst | 3 +- docs/narr/muchadoabouttraversal.rst | 4 +- docs/narr/project.rst | 40 +++++++------- docs/narr/renderers.rst | 2 +- docs/narr/templates.rst | 2 +- docs/narr/upgrading.rst | 8 +-- docs/narr/urldispatch.rst | 7 +-- docs/narr/webob.rst | 6 +-- docs/tutorials/modwsgi/index.rst | 15 +++--- docs/tutorials/wiki/distributing.rst | 4 +- docs/tutorials/wiki2/distributing.rst | 6 +-- 20 files changed, 143 insertions(+), 139 deletions(-) (limited to 'docs') diff --git a/docs/conventions.rst b/docs/conventions.rst index 4469d0c73..0f5daf106 100644 --- a/docs/conventions.rst +++ b/docs/conventions.rst @@ -35,7 +35,7 @@ References to glossary terms are presented using the following style: URLs are presented using the following style: - `Pylons `_ + `Pylons `_ References to sections and chapters are presented using the following style: diff --git a/docs/copyright.rst b/docs/copyright.rst index 3beaee7f7..9532c15b7 100644 --- a/docs/copyright.rst +++ b/docs/copyright.rst @@ -63,7 +63,7 @@ Contributors: GitHub. Cover Designer: - Hugues Laflamme of `Kemeneur `_. + Hugues Laflamme of Kemeneur. Used with permission: @@ -80,8 +80,8 @@ Print Production ---------------- The print version of this book was produced using the `Sphinx -`_ documentation generation system and the -`LaTeX `_ typesetting system. +`_ documentation generation system and +the `LaTeX `_ typesetting system. Contacting The Publisher ------------------------ @@ -90,7 +90,7 @@ Please send documentation licensing inquiries, translation inquiries, and other business communications to `Agendaless Consulting `_. Please send software and other technical queries to the `Pylons-devel mailing list -`_. +`_. HTML Version and Source Code ---------------------------- diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 5f3295305..3c1046b82 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -131,7 +131,7 @@ obvious. First, what's a "utility"? Well, for the purposes of this discussion, and for the purpose of the code above, it's just not very important. If you really want to know, you can read `this -`_. However, still, readers +`_. However, still, readers of such code need to understand the concept in order to parse it. This is problem number one. @@ -665,7 +665,7 @@ desktop GUI platforms by using similar terminology, and to provide some frame of reference for how various components in the common web framework might hang together. But in the opinion of the author, "MVC" doesn't match the web very well in general. Quoting from the `Model-View-Controller Wikipedia entry -`_: +`_: Though MVC comes in different flavors, control flow is generally as follows: @@ -847,9 +847,9 @@ Challenge +++++++++ :app:`Pyramid` performs automatic authorization checks only at :term:`view` -execution time. Zope 3 wraps context objects with a `security proxy -`_, which causes Zope 3 also -to do security checks during attribute access. I like this, because it means: +execution time. Zope 3 wraps context objects with a security proxy, which +causes Zope 3 also to do security checks during attribute access. I like this, +because it means: #) When I use the security proxy machinery, I can have a view that conditionally displays certain HTML elements (like form fields) or @@ -1006,16 +1006,18 @@ the following: Microframeworks have smaller Hello World programs ------------------------------------------------- -Self-described "microframeworks" exist. `Bottle `_ and -`Flask `_ are two that are becoming popular. `Bobo -`_ doesn't describe itself as a microframework, but -its intended user base is much the same. Many others exist. We've even (only as -a teaching tool, not as any sort of official project) `created one using -Pyramid `_. The videos use BFG, -a precursor to Pyramid, but the resulting code is `available for Pyramid too -`_). Microframeworks are small frameworks -with one common feature: each allows its users to create a fully functional -application that lives in a single Python file. +Self-described "microframeworks" exist. `Bottle +`_ and `Flask +`_ are two that are becoming popular. `Bobo +`_ doesn't describe itself as a +microframework, but its intended user base is much the same. Many others exist. +We've even (only as a teaching tool, not as any sort of official project) +`created one using Pyramid `_. +The videos use BFG, a precursor to Pyramid, but the resulting code is +`available for Pyramid too `_). +Microframeworks are small frameworks with one common feature: each allows its +users to create a fully functional application that lives in a single Python +file. Some developers and microframework authors point out that Pyramid's "hello world" single-file program is longer (by about five lines) than the equivalent @@ -1430,9 +1432,9 @@ object which *is not logically global*: # this is executed if the request method was GET or the # credentials were invalid -The `Pylons 1.X `_ web framework uses a similar -strategy. It calls these things "Stacked Object Proxies", so, for purposes -of this discussion, I'll do so as well. +The `Pylons 1.X `_ +web framework uses a similar strategy. It calls these things "Stacked Object +Proxies", so, for purposes of this discussion, I'll do so as well. Import statements in Python (``import foo``, ``from bar import baz``) are most frequently performed to obtain a reference to an object defined globally @@ -1701,5 +1703,6 @@ Other Challenges ---------------- Other challenges are encouraged to be sent to the `Pylons-devel -`_ maillist. We'll try to address -them by considering a design change, or at very least via exposition here. +`_ maillist. We'll try +to address them by considering a design change, or at very least via exposition +here. diff --git a/docs/glossary.rst b/docs/glossary.rst index 1d97bffe8..9b41b4359 100644 --- a/docs/glossary.rst +++ b/docs/glossary.rst @@ -36,7 +36,7 @@ Glossary Repoze "Repoze" is essentially a "brand" of software developed by `Agendaless - Consulting `_ and a set of contributors. The + Consulting `_ and a set of contributors. The term has no special intrinsic meaning. The project's `website `_ has more information. The software developed "under the brand" is available in a `Subversion repository @@ -51,7 +51,7 @@ Glossary You can use :term:`distribute` under Python 3 instead. distribute - `Distribute `_ is a fork of + `Distribute `_ is a fork of :term:`setuptools` which runs on both Python 2 and Python 3. pkg_resources @@ -321,18 +321,18 @@ Glossary :term:`principal` (or principals) associated with a request. WSGI - `Web Server Gateway Interface `_. This is a - Python standard for connecting web applications to web servers, - similar to the concept of Java Servlets. :app:`Pyramid` requires - that your application be served as a WSGI application. + `Web Server Gateway Interface `_. + This is a Python standard for connecting web applications to web servers, + similar to the concept of Java Servlets. :app:`Pyramid` requires that + your application be served as a WSGI application. middleware *Middleware* is a :term:`WSGI` concept. It is a WSGI component that acts both as a server and an application. Interesting uses for middleware exist, such as caching, content-transport - encoding, and other functions. See `WSGI.org `_ - or `PyPI `_ to find middleware for your - application. + encoding, and other functions. See `WSGI.org + `_ or `PyPI + `_ to find middleware for your application. pipeline The :term:`PasteDeploy` term for a single configuration of a WSGI @@ -346,15 +346,15 @@ Glossary `A web framework based on Zope 3 `_. Django - `A full-featured Python web framework `_. + `A full-featured Python web framework `_. Pylons `A lightweight Python web framework `_ and a predecessor of Pyramid. ZODB - `Zope Object Database `_, a - persistent Python object store. + `Zope Object Database `_, a persistent + Python object store. WebOb `WebOb `_ is a WSGI request/response @@ -376,28 +376,27 @@ Glossary the box in ZPT and text flavors. ZPT - The `Zope Page Template `_ + The `Zope Page Template `_ templating language. METAL - `Macro Expansion for TAL `_, a - part of :term:`ZPT` which makes it possible to share common look - and feel between templates. + `Macro Expansion for TAL + `_, a + part of :term:`ZPT` which makes it possible to share common look and feel + between templates. Genshi - An `XML templating language `_ + An `XML templating language `_ by Christopher Lenz. Jinja2 - A `text templating language `_ by Armin - Ronacher. + A `text templating language `_ by Armin Ronacher. Routes - A `system by Ben Bangert `_ which - parses URLs and compares them against a number of user defined - mappings. The URL pattern matching syntax in :app:`Pyramid` is - inspired by the Routes syntax (which was inspired by Ruby On - Rails pattern syntax). + A `system by Ben Bangert `_ + which parses URLs and compares them against a number of user defined + mappings. The URL pattern matching syntax in :app:`Pyramid` is inspired by + the Routes syntax (which was inspired by Ruby On Rails pattern syntax). route A single pattern matched by the :term:`url dispatch` subsystem, @@ -416,7 +415,7 @@ Glossary Zope Component Architecture The `Zope Component Architecture - `_ (aka ZCA) is a system + `_ (aka ZCA) is a system which allows for application pluggability and complex dispatching based on objects which implement an :term:`interface`. :app:`Pyramid` uses the ZCA "under the hood" to perform view @@ -442,7 +441,7 @@ Glossary subpath. See :ref:`star_subpath` for more information. interface - A `Zope interface `_ + A `Zope interface `_ object. In :app:`Pyramid`, an interface may be attached to a :term:`resource` object or a :term:`request` object in order to identify that the object is "of a type". Interfaces are used @@ -488,13 +487,13 @@ Glossary repoze.catalog An indexing and search facility (fielded and full-text) based on - `zope.index `_. See `the + `zope.index `_. See `the documentation `_ for more information. repoze.who - `Authentication middleware `_ for - :term:`WSGI` applications. It can be used by :app:`Pyramid` to + `Authentication middleware `_ + for :term:`WSGI` applications. It can be used by :app:`Pyramid` to provide authentication information. repoze.workflow @@ -555,7 +554,7 @@ Glossary serialization format. jQuery - A popular `Javascript library `_. + A popular `Javascript library `_. renderer A serializer which converts non-:term:`Response` return values from a @@ -569,10 +568,10 @@ Glossary :ref:`adding_and_overriding_renderers` for more information. mod_wsgi - `mod_wsgi `_ is an Apache - module developed by Graham Dumpleton. It allows :term:`WSGI` - applications (such as applications developed using - :app:`Pyramid`) to be served using the Apache web server. + `mod_wsgi `_ is an Apache + module developed by Graham Dumpleton. It allows :term:`WSGI` applications + (such as applications developed using :app:`Pyramid`) to be served using + the Apache web server. view predicate An argument to a :term:`view configuration` which evaluates to @@ -609,7 +608,7 @@ Glossary .. seealso:: - See also `PEP 318 `_. + See also `PEP 318 `_. configuration declaration An individual method call made to a :term:`configuration directive`, @@ -683,7 +682,7 @@ Glossary thread local A thread-local variable is one which is essentially a global variable in terms of how it is accessed and treated, however, each `thread - `_ used by the + `_ used by the application may have a different value for this same "global" variable. :app:`Pyramid` uses a small number of thread local variables, as described in :ref:`threadlocals_chapter`. @@ -700,8 +699,8 @@ Glossary :ref:`multidict_narr` and :class:`pyramid.interfaces.IMultiDict`. PyPI - `The Python Package Index `_, a - collection of software available for Python. + `The Python Package Index `_, a collection + of software available for Python. Agendaless Consulting A consulting organization formed by Paul Everitt, Tres Seaver, @@ -709,14 +708,14 @@ Glossary .. seealso:: - See also `Agendaless Consulting `_. + See also `Agendaless Consulting `_. Jython A `Python implementation `_ written for the Java Virtual Machine. Python - The `programming language `_ in which + The `programming language `_ in which :app:`Pyramid` is written. CPython @@ -736,7 +735,7 @@ Glossary subsystems used by :app:`Pyramid`. Google App Engine - `Google App Engine `_ (aka + `Google App Engine `_ (aka "GAE") is a Python application hosting service offered by Google. :app:`Pyramid` runs on GAE. @@ -913,7 +912,7 @@ Glossary can be used as global application values. WebTest - `WebTest `_ is a package which can help + `WebTest `_ is a package which can help you write functional tests for your WSGI application. view mapper @@ -936,20 +935,19 @@ Glossary ZCML `Zope Configuration Markup Language - `_, an XML dialect + `_, an XML dialect used by Zope and :term:`pyramid_zcml` for configuration tasks. pyramid_handlers An add-on package which allows :app:`Pyramid` users to create classes that are analogues of Pylons 1 "controllers". See - http://docs.pylonsproject.org/projects/pyramid_handlers/dev/ . + http://docs.pylonsproject.org/projects/pyramid_handlers/en/latest/. pyramid_jinja2 :term:`Jinja2` templating system bindings for Pyramid, documented at - http://docs.pylonsproject.org/projects/pyramid_jinja2/dev/ . This - package also includes a scaffold named - ``pyramid_jinja2_starter``, which creates an application package based - on the Jinja2 templating system. + http://docs.pylonsproject.org/projects/pyramid_jinja2/en/latest/. This + package also includes a scaffold named ``pyramid_jinja2_starter``, which + creates an application package based on the Jinja2 templating system. Akhet `Akhet `_ is a @@ -965,7 +963,7 @@ Glossary distutils The standard system for packaging and distributing Python packages. See - http://docs.python.org/distutils/index.html for more information. + https://docs.python.org/2/distutils/index.html for more information. :term:`setuptools` is actually an *extension* of the Distutils. exception response @@ -1008,7 +1006,7 @@ Glossary used in production applications, because the logger can be configured to log to a file, to UNIX syslog, to the Windows Event Log, or even to email. See its `documentation - `_. + `_. console script A script written to the ``bin`` (on UNIX, or ``Scripts`` on Windows) diff --git a/docs/index.rst b/docs/index.rst index aecc26d2e..ad667684c 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -5,7 +5,7 @@ The Pyramid Web Framework ========================= :app:`Pyramid` is a small, fast, down-to-earth Python web framework. It is -developed as part of the `Pylons Project `_. +developed as part of the `Pylons Project `_. It is licensed under a `BSD-like license `_. Here is one of the simplest :app:`Pyramid` applications you can make: @@ -70,15 +70,17 @@ platforms. Support and Development ======================= -The `Pylons Project web site `_ is the main online -source of :app:`Pyramid` support and development information. +The `Pylons Project web site `_ is the main +online source of :app:`Pyramid` support and development information. To report bugs, use the `issue tracker `_. If you've got questions that aren't answered by this documentation, contact the -`Pylons-discuss maillist `_ or -join the `#pyramid IRC channel `_. +`Pylons-discuss maillist +`_ or join the +`#pyramid IRC channel +`_. Browse and check out tagged and trunk versions of :app:`Pyramid` via the `Pyramid GitHub repository `_. To check out diff --git a/docs/narr/firstapp.rst b/docs/narr/firstapp.rst index 6a952dec9..a8491eabd 100644 --- a/docs/narr/firstapp.rst +++ b/docs/narr/firstapp.rst @@ -197,7 +197,7 @@ method returns a :term:`WSGI` application object that can be used by any WSGI server to present an application to a requestor. :term:`WSGI` is a protocol that allows servers to talk to Python applications. We don't discuss :term:`WSGI` in any depth within this book, but you can learn more about it by -visiting `wsgi.org `_. +reading its `documentation `_. The :app:`Pyramid` application object, in particular, is an instance of a class representing a :app:`Pyramid` :term:`router`. It has a reference to the diff --git a/docs/narr/i18n.rst b/docs/narr/i18n.rst index 014f314ad..131832aae 100644 --- a/docs/narr/i18n.rst +++ b/docs/narr/i18n.rst @@ -343,7 +343,7 @@ This will create a new message catalog ``.po`` file in ``myapplication/locale/es/LC_MESSAGES/myapplication.po``. Once the file is there, it can be worked on by a human translator. One tool -which may help with this is `Poedit `_. +which may help with this is `Poedit `_. Note that :app:`Pyramid` itself ignores the existence of all ``.po`` files. For a running application to have translations available, a ``.mo`` file must @@ -647,7 +647,7 @@ before being rendered: The features represented by attributes of the ``i18n`` namespace of Chameleon will also consult the :app:`Pyramid` translations. See -http://chameleon.readthedocs.org/en/latest/reference.html#id50. +http://chameleon.readthedocs.org/en/latest/reference.html#translation-i18n. .. note:: diff --git a/docs/narr/install.rst b/docs/narr/install.rst index 3e5523262..7d96f4074 100644 --- a/docs/narr/install.rst +++ b/docs/narr/install.rst @@ -90,7 +90,7 @@ If You Don't Yet Have a Python Interpreter (Windows) If your Windows system doesn't have a Python interpreter, you'll need to install it by downloading a Python 3.x-series interpreter executable from -`python.org's download section `_ (the files +`python.org's download section `_ (the files labeled "Windows Installer"). Once you've downloaded it, double click on the executable and accept the defaults during the installation process. You may also need to download and install the Python for Windows extensions. @@ -99,7 +99,7 @@ also need to download and install the Python for Windows extensions. Windows ` for full details. .. seealso:: Download and install the `Python for Windows extensions - `_. Carefully read + `_. Carefully read the README.txt file at the end of the list of builds, and follow its directions. Make sure you get the proper 32- or 64-bit build and Python version. diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst index 24c9f6b93..d92916503 100644 --- a/docs/narr/introduction.rst +++ b/docs/narr/introduction.rst @@ -221,7 +221,7 @@ send email, let you use the Jinja2 templating system, let you use XML-RPC or JSON-RPC, let you integrate with jQuery Mobile, etc. Examples: -http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-add-on-documentation +http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-add-ons Class-based and function-based views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -881,7 +881,7 @@ new-user-friendly. Example: Visit irc\://freenode.net#pyramid (the ``#pyramid`` channel on irc.freenode.net in an IRC client) or the pylons-discuss maillist at -http://groups.google.com/group/pylons-discuss/. +https://groups.google.com/forum/#!forum/pylons-discuss. Documentation ~~~~~~~~~~~~~ @@ -903,7 +903,7 @@ What Is The Pylons Project? :app:`Pyramid` is a member of the collection of software published under the Pylons Project. Pylons software is written by a loose-knit community of -contributors. The `Pylons Project website `_ +contributors. The `Pylons Project website `_ includes details about how :app:`Pyramid` relates to the Pylons Project. .. index:: @@ -967,9 +967,9 @@ nor discouraging the decision. Other Python web frameworks advertise themselves as members of a class of web frameworks named `model-view-controller -`_ frameworks. Insofar as -this term has been claimed to represent a class of web frameworks, -:app:`Pyramid` also generally fits into this class. +`_ +frameworks. Insofar as this term has been claimed to represent a class of web +frameworks, :app:`Pyramid` also generally fits into this class. .. sidebar:: You Say :app:`Pyramid` is MVC, but Where's the Controller? diff --git a/docs/narr/logging.rst b/docs/narr/logging.rst index 9c6e8a319..c7b4b9d6f 100644 --- a/docs/narr/logging.rst +++ b/docs/narr/logging.rst @@ -292,7 +292,8 @@ Logging Exceptions To log or email exceptions generated by your :app:`Pyramid` application, use the :term:`pyramid_exclog` package. Details about its configuration are in its -`documentation `_. +`documentation +`_. .. index:: single: TransLogger diff --git a/docs/narr/muchadoabouttraversal.rst b/docs/narr/muchadoabouttraversal.rst index 3e00a295a..02cd8ee3a 100644 --- a/docs/narr/muchadoabouttraversal.rst +++ b/docs/narr/muchadoabouttraversal.rst @@ -8,9 +8,7 @@ Much Ado About Traversal .. note:: - This chapter was adapted, with permission, from a blog post by `Rob Miller - `_, originally published at - http://blog.nonsequitarian.org/2010/much-ado-about-traversal/. + This chapter was adapted, with permission, from a blog post by Rob Miller. Traversal is an alternative to :term:`URL dispatch` which allows :app:`Pyramid` applications to map URLs to code. diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 81fc9acf4..56247ee33 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -584,7 +584,7 @@ only (``127.0.0.1``). The sections after ``# logging configuration`` represent Python's standard library :mod:`logging` module configuration for your application. These sections are passed to the `logging module's config file configuration engine -`_ when the +`_ when the ``pserve`` or ``pshell`` commands are executed. The default configuration sends application logging output to the standard error output of your terminal. For more information about logging configuration, see :ref:`logging_chapter`. @@ -628,8 +628,8 @@ setup.py sdist``. Due to the information contained in the default ``MANIFEST.in``, an sdist of your Pyramid project will include ``.txt`` files, ``.ini`` files, ``.rst`` files, graphics files, and template files, as well as ``.py`` files. See -http://docs.python.org/distutils/sourcedist.html#the-manifest-in-template for -more information about the syntax and usage of ``MANIFEST.in``. +https://docs.python.org/2/distutils/sourcedist.html#the-manifest-in-template +for more information about the syntax and usage of ``MANIFEST.in``. Without the presence of a ``MANIFEST.in`` file or without checking your source code into a version control repository, ``setup.py sdist`` places only *Python @@ -647,8 +647,8 @@ files with extensions other than the files named in the project's ``MANIFEST.in`` and you don't make use of a setuptools-compatible version control system, you'll need to edit the ``MANIFEST.in`` file and include the statements necessary to include your new files. See -http://docs.python.org/distutils/sourcedist.html#principle for more information -about how to do this. +https://docs.python.org/2/distutils/sourcedist.html#principle for more +information about how to do this. You can also delete ``MANIFEST.in`` from your project and rely on a setuptools feature which simply causes all files checked into a version control system to @@ -697,21 +697,21 @@ Your application's name can be any string; it is specified in the ``name`` field. The version number is specified in the ``version`` value. A short description is provided in the ``description`` field. The ``long_description`` is conventionally the content of the ``README`` and ``CHANGES`` files appended -together. The ``classifiers`` field is a list of `Trove -`_ classifiers -describing your application. ``author`` and ``author_email`` are text fields -which probably don't need any description. ``url`` is a field that should -point at your application project's URL (if any). ``packages=find_packages()`` -causes all packages within the project to be found when packaging the -application. ``include_package_data`` will include non-Python files when the -application is packaged if those files are checked into version control. -``zip_safe=False`` indicates that this package is not safe to use as a zipped -egg; instead it will always unpack as a directory, which is more convenient. -``install_requires`` indicate that this package depends on the ``pyramid`` -package. ``extras_require`` is a Python dictionary that defines what is -required to be installed for running tests. We examined ``entry_points`` in our -discussion of the ``development.ini`` file; this file defines the ``main`` -entry point that represents our project's application. +together. The ``classifiers`` field is a list of `Trove classifiers +`_ describing your +application. ``author`` and ``author_email`` are text fields which probably +don't need any description. ``url`` is a field that should point at your +application project's URL (if any). ``packages=find_packages()`` causes all +packages within the project to be found when packaging the application. +``include_package_data`` will include non-Python files when the application is +packaged if those files are checked into version control. ``zip_safe=False`` +indicates that this package is not safe to use as a zipped egg; instead it will +always unpack as a directory, which is more convenient. ``install_requires`` +indicates that this package depends on the ``pyramid`` package. +``extras_require`` is a Python dictionary that defines what is required to be +installed for running tests. We examined ``entry_points`` in our discussion of +the ``development.ini`` file; this file defines the ``main`` entry point that +represents our project's application. Usually you only need to think about the contents of the ``setup.py`` file when distributing your application to other people, when adding Python package diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst index 50e85813a..e06c78028 100644 --- a/docs/narr/renderers.rst +++ b/docs/narr/renderers.rst @@ -317,7 +317,7 @@ JSONP Renderer .. versionadded:: 1.1 :class:`pyramid.renderers.JSONP` is a `JSONP -`_ renderer factory helper which implements +`_ renderer factory helper which implements a hybrid JSON/JSONP renderer. JSONP is useful for making cross-domain AJAX requests. diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index 9e3a31845..6b3b5fcce 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -448,7 +448,7 @@ templating languages including the following: .. _pyramid_chameleon: http://docs.pylonsproject.org/projects/pyramid-chameleon/en/latest/ -.. _Jinja2: http://jinja.pocoo.org/docs/ +.. _Jinja2: http://jinja.pocoo.org/docs/dev/ .. _pyramid_jinja2: http://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/ diff --git a/docs/narr/upgrading.rst b/docs/narr/upgrading.rst index fcdce4f8d..21b696775 100644 --- a/docs/narr/upgrading.rst +++ b/docs/narr/upgrading.rst @@ -128,7 +128,8 @@ you can see DeprecationWarnings printed to the console when the tests run. The ``-Wd`` argument tells Python to print deprecation warnings to the console. See `the Python -W flag documentation -`_ for more information. +`_ for more +information. As your tests run, deprecation warnings will be printed to the console explaining the deprecation and providing instructions about how to prevent the @@ -215,9 +216,10 @@ around in your application interactively to try to generate them, and remediate as explained in :ref:`testing_under_new_release`. See `the PYTHONWARNINGS environment variable documentation -`_ or `the +`_ or `the Python -W flag documentation -`_ for more information. +`_ for more +information. Upgrading to the very latest Pyramid release -------------------------------------------- diff --git a/docs/narr/urldispatch.rst b/docs/narr/urldispatch.rst index c13558008..2472ace31 100644 --- a/docs/narr/urldispatch.rst +++ b/docs/narr/urldispatch.rst @@ -271,8 +271,9 @@ pattern like this: But this will either cause an error at startup time or it won't match properly. You'll want to use a Unicode value as the pattern instead rather than raw bytestring escapes. You can use a high-order Unicode value as the pattern by -using `Python source file encoding `_ -plus the "real" character in the Unicode pattern in the source, like so: +using `Python source file encoding +`_ plus the "real" character in the +Unicode pattern in the source, like so: .. code-block:: text @@ -1194,7 +1195,7 @@ If a predicate is a class, just add ``__text__`` property in a standard manner. __text__ = 'my custom class predicate' If a predicate is a method, you'll need to assign it after method declaration -(see `PEP 232 `_). +(see `PEP 232 `_). .. code-block:: python :linenos: diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst index cfcf532bc..ce1586834 100644 --- a/docs/narr/webob.rst +++ b/docs/narr/webob.rst @@ -27,8 +27,8 @@ functionality to the standard WebOb request, which is documented in the :ref:`request_module` API documentation. WebOb provides objects for HTTP requests and responses. Specifically it does -this by wrapping the `WSGI `_ request environment and response -status, header list, and app_iter (body) values. +this by wrapping the `WSGI `_ request +environment and response status, header list, and app_iter (body) values. WebOb request and response objects provide many conveniences for parsing WSGI requests and forming WSGI responses. WebOb is a nice way to represent "raw" @@ -46,7 +46,7 @@ Request ~~~~~~~ The request object is a wrapper around the `WSGI environ dictionary -`_. This +`_. This dictionary contains keys for each header, keys that describe the request (including the path and query string), a file-like object for the request body, and a variety of custom keys. You can always access the environ with diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 3cc182d13..7f5aac0a0 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -18,7 +18,7 @@ specific path information for commands and files. ``mod_wsgi``. If you have experience with :app:`Pyramid` and ``mod_wsgi`` on Windows systems, please help us document this experience by submitting documentation to the `Pylons-devel maillist - `_. + `_. #. The tutorial assumes you have Apache already installed on your system. If you do not, install Apache 2.X for your platform in @@ -29,7 +29,7 @@ specific path information for commands and files. #. Once you have Apache installed, install ``mod_wsgi``. Use the (excellent) `installation instructions - `_ + `_ for your platform into your system's Apache installation. #. Create a :term:`virtual environment` which we'll use to install our @@ -119,9 +119,8 @@ specific path information for commands and files. #. Visit ``http://localhost/myapp`` in a browser. You should see the sample application rendered in your browser. -:term:`mod_wsgi` has many knobs and a great variety of deployment -modes. This is just one representation of how you might use it to -serve up a :app:`Pyramid` application. See the `mod_wsgi -configuration documentation -`_ for -more in-depth configuration information. +:term:`mod_wsgi` has many knobs and a great variety of deployment modes. This +is just one representation of how you might use it to serve up a :app:`Pyramid` +application. See the `mod_wsgi configuration documentation +`_ +for more in-depth configuration information. diff --git a/docs/tutorials/wiki/distributing.rst b/docs/tutorials/wiki/distributing.rst index c3037f396..386b880e6 100644 --- a/docs/tutorials/wiki/distributing.rst +++ b/docs/tutorials/wiki/distributing.rst @@ -36,6 +36,6 @@ Note that this command creates a tarball in the "dist" subdirectory named ``tutorial-0.0.tar.gz``. You can send this file to your friends to show them your cool new application. They should be able to install it by pointing the ``pip install .`` command directly at it. Or you can upload it to `PyPI -`_ and share it with the rest of the world, where it -can be downloaded via ``pip install`` remotely like any other package people +`_ and share it with the rest of the world, where +it can be downloaded via ``pip install`` remotely like any other package people download from PyPI. diff --git a/docs/tutorials/wiki2/distributing.rst b/docs/tutorials/wiki2/distributing.rst index f264448b0..f38a733f4 100644 --- a/docs/tutorials/wiki2/distributing.rst +++ b/docs/tutorials/wiki2/distributing.rst @@ -35,6 +35,6 @@ Note that this command creates a tarball in the "dist" subdirectory named ``tutorial-0.0.tar.gz``. You can send this file to your friends to show them your cool new application. They should be able to install it by pointing the ``easy_install`` command directly at it. Or you can upload it to `PyPI -`_ and share it with the rest of the world, where it -can be downloaded via ``easy_install`` remotely like any other package people -download from PyPI. +`_ and share it with the rest of the world, where +it can be downloaded via ``easy_install`` remotely like any other package +people download from PyPI. -- cgit v1.2.3 From ac4d2ca3f47260c8029b51b23ed78908415b4a22 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 24 Apr 2016 02:52:09 -0700 Subject: Use parsed-literal for installing versions of Pyramid. This should future proof docs. --- docs/tutorials/modwsgi/index.rst | 6 +++--- docs/tutorials/wiki/installation.rst | 9 +++++---- docs/tutorials/wiki2/installation.rst | 8 ++++---- 3 files changed, 12 insertions(+), 11 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/modwsgi/index.rst b/docs/tutorials/modwsgi/index.rst index 7f5aac0a0..c66786b11 100644 --- a/docs/tutorials/modwsgi/index.rst +++ b/docs/tutorials/modwsgi/index.rst @@ -44,11 +44,11 @@ specific path information for commands and files. #. Install :app:`Pyramid` into the newly created virtual environment: - .. code-block:: text + .. parsed-literal:: $ cd ~/modwsgi/env - $ $VENV/bin/pip install pyramid - + $ $VENV/bin/pip install "pyramid==\ |release|\ " + #. Create and install your :app:`Pyramid` application. For the purposes of this tutorial, we'll just be using the ``pyramid_starter`` application as a baseline application. Substitute your existing :app:`Pyramid` diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index dbf995595..d9c3bec1e 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -97,16 +97,17 @@ Install Pyramid into the virtual Python environment On UNIX ^^^^^^^ -.. code-block:: bash +.. parsed-literal:: - $ $VENV/bin/pip install pyramid + $ $VENV/bin/pip install "pyramid==\ |release|\ " On Windows ^^^^^^^^^^ -.. code-block:: doscon +.. parsed-literal:: + + c:\\> %VENV%\\Scripts\\pip install "pyramid==\ |release|\ " - c:\> %VENV%\Scripts\pip install pyramid Change directory to your virtual Python environment --------------------------------------------------- diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index f4676345e..e45b13315 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -97,16 +97,16 @@ Install Pyramid into the virtual Python environment On UNIX ^^^^^^^ -.. code-block:: bash +.. parsed-literal:: - $ $VENV/bin/pip install pyramid + $ $VENV/bin/pip install "pyramid==\ |release|\ " On Windows ^^^^^^^^^^ -.. code-block:: doscon +.. parsed-literal:: - c:\> %VENV%\Scripts\pip install pyramid + c:\\> %VENV%\\Scripts\\pip install "pyramid==\ |release|\ " Install SQLite3 and its development packages -- cgit v1.2.3 From 7461299e7489458ed9e9996fde33b095eb7e729a Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 24 Apr 2016 13:23:05 -0700 Subject: update bad link --- docs/narr/sessions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index bfc908396..7e961f5e8 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -305,7 +305,7 @@ Preventing Cross-Site Request Forgery Attacks --------------------------------------------- `Cross-site request forgery -`_ attacks are a +`_ attacks are a phenomenon whereby a user who is logged in to your website might inadvertantly load a URL because it is linked from, or embedded in, an attacker's website. If the URL is one that may modify or delete data, the consequences can be dire. -- cgit v1.2.3 From b5fcc452c364284648aae4c0ce061b3bac711cd0 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 24 Apr 2016 15:42:34 -0700 Subject: Allow Sphinx doctests to run and pass with `make doctest SPHINXBUILD=$VENV/bin/sphinx-build`. - TODO: two tests in `docs/narr/hooks.rst` --- docs/Makefile | 22 +++++++++++++++------- docs/narr/sessions.rst | 45 ++++++++++++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 24 deletions(-) (limited to 'docs') diff --git a/docs/Makefile b/docs/Makefile index 546deb30a..411ff35df 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -12,16 +12,20 @@ PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . -.PHONY: help clean html web pickle htmlhelp latex changes linkcheck +.PHONY: help clean html text web pickle htmlhelp latex latexpdf changes linkcheck epub doctest help: @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " pickle to make pickle files (usable by e.g. sphinx-web)" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " changes to make an overview over all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" + @echo " html to make standalone HTML files" + @echo " text to make text files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " epub to make an epub" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* @@ -90,3 +94,7 @@ epub: @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff --git a/docs/narr/sessions.rst b/docs/narr/sessions.rst index 7e961f5e8..a1319e45f 100644 --- a/docs/narr/sessions.rst +++ b/docs/narr/sessions.rst @@ -260,19 +260,28 @@ added to the flash queue, and empties the queue. .. method:: pop_flash(queue='') ->>> request.session.flash('info message') ->>> request.session.pop_flash() -['info message'] +.. testsetup:: + + from pyramid import testing + request = testing.DummyRequest() + +.. doctest:: + + >>> 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. ->>> request.session.flash('info message') ->>> request.session.pop_flash() -['info message'] ->>> request.session.pop_flash() -[] +.. doctest:: + + >>> request.session.flash('info message') + >>> request.session.pop_flash() + ['info message'] + >>> request.session.pop_flash() + [] .. index:: single: session.peek_flash @@ -287,15 +296,17 @@ flash storage. .. method:: peek_flash(queue='') ->>> 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() -[] +.. doctest:: + + >>> 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 -- cgit v1.2.3 From a470ff601182fed93446b8bfe4bc8707a8455949 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 24 Apr 2016 20:39:37 -0700 Subject: add sphinx doctests for hooks.rst --- docs/narr/hooks.rst | 62 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 58 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index b776f99e8..150eca944 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -300,13 +300,38 @@ added as a property and its result is cached per-request by setting ``reify=True``. This way, we eliminate the overhead of running the function multiple times. +.. testsetup:: group1 + + from pyramid.config import Configurator + + + def total(request, *args): + return sum(args) + + + def prop(request): + print("getting the property") + return "the property" + + + + config = Configurator() + config.add_request_method(total) + config.add_request_method(prop, reify=True) + config.commit() + + from pyramid.scripting import prepare + request = prepare(registry=config.registry)["request"] + +.. doctest:: group1 + >>> request.total(1, 2, 3) 6 >>> request.prop getting the property - the property + 'the property' >>> request.prop - the property + 'the property' To not cache the result of ``request.prop``, set ``property=True`` instead of ``reify=True``. @@ -338,13 +363,42 @@ Here is an example of passing a class to ``Configurator.add_request_method``: We attach and cache an object named ``extra`` to the ``request`` object. +.. testsetup:: group2 + + from pyramid.config import Configurator + from pyramid.decorator import reify + + class ExtraStuff(object): + + def __init__(self, request): + self.request = request + + def total(self, *args): + return sum(args) + + # use @property if you don't want to cache the result + @reify + def prop(self): + print("getting the property") + return "the property" + + config = Configurator() + config.add_request_method(ExtraStuff, 'extra', reify=True) + config.commit() + + from pyramid.scripting import prepare + request = prepare(registry=config.registry)["request"] + +.. doctest:: group2 + >>> request.extra.total(1, 2, 3) 6 >>> request.extra.prop getting the property - the property + 'the property' >>> request.extra.prop - the property + 'the property' + .. index:: single: response factory -- cgit v1.2.3 From f2bc0e39cabb2f234ea622b2ebdd0b8eac5cea32 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 25 Apr 2016 21:12:32 -0500 Subject: fix explanation of require_csrf --- docs/narr/hooks.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst index 150eca944..49ef29d3f 100644 --- a/docs/narr/hooks.rst +++ b/docs/narr/hooks.rst @@ -1647,8 +1647,9 @@ the user-defined :term:`view callable`: ``csrf_view`` Used to check the CSRF token provided in the request. This element is a - no-op if both the ``require_csrf`` view option and the - ``pyramid.require_default_csrf`` setting are disabled. + no-op if ``require_csrf`` view option is not ``True``. Note there will + always be a ``require_csrf`` option if a default value was assigned via + :meth:`pyramid.config.Configurator.set_default_csrf_options`. ``owrapped_view`` -- cgit v1.2.3 From f7d515de86ad1ceab1b330cf1d95257b712b2659 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 27 Apr 2016 21:01:28 -0500 Subject: fix bugs in design defense code examples fixes #2287 --- docs/designdefense.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 3c1046b82..70dbbe720 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -1297,12 +1297,12 @@ Consider the following simple `Groundhog from groundhog import Groundhog app = Groundhog('myapp', 'seekrit') - app.route('/admin') + @app.route('/admin') def admin(): return 'admin page' - app.route('/:action') - def action(): + @app.route('/:action') + def do_action(action): if action == 'add': return 'add' if action == 'delete': @@ -1322,15 +1322,15 @@ order of the function definitions in the file? from groundhog import Groundhog app = Groundhog('myapp', 'seekrit') - app.route('/:action') - def action(): + @app.route('/:action') + def do_action(action): if action == 'add': return 'add' if action == 'delete': return 'delete' return app.abort(404) - app.route('/admin') + @app.route('/admin') def admin(): return 'admin page' -- cgit v1.2.3 From 68ba583735aedc6762131af2cf93cf0fdd470fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20F=C3=A9rotin?= Date: Fri, 6 May 2016 19:45:32 +0200 Subject: doc: Update documentation for using ``py.test [--cov]`` for newly created project with scaffolds. --- docs/narr/project.rst | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 56247ee33..8849e9ee7 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -209,25 +209,29 @@ On UNIX: .. code-block:: bash - $ $VENV/bin/py.test myproject/tests.py -q + $ $VENV/bin/py.test -q On Windows: .. code-block:: doscon - > %VENV%\Scripts\py.test myproject\tests.py -q + > %VENV%\Scripts\py.test -q Here's sample output from a test run on UNIX: .. code-block:: bash - $ $VENV/bin/py.test myproject/tests.py -q + $ $VENV/bin/py.test -q .. 2 passed in 0.47 seconds The tests themselves are found in the ``tests.py`` module in your ``pcreate`` generated project. Within a project generated by the ``starter`` scaffold, -only two sample tests exist. +only two sample tests exist. Previous command is identical to: + +.. code-block:: bash + + $ $VENV/bin/py.test myproject/tests.py -q .. note:: @@ -235,6 +239,14 @@ only two sample tests exist. to a stream of dots. If you don't pass ``-q``, you'll see verbose test result output (which normally isn't very useful). +Alternatively, if you'd like to see test coverage, pass the ``--cov`` option +to ``py.test``: + +.. code-block:: bash + + $ $VENV/bin/py.test -q --cov + + .. index:: single: running an application single: pserve -- cgit v1.2.3 From 9591e95fd8c8d3e0359851f093eb060b7f9b56b7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 6 May 2016 11:02:28 -0700 Subject: Update wiki tutorials with py.test remarks - better synch up wiki tutorials installation instructions - improve .rst syntax and add more .rst links --- docs/tutorials/wiki/installation.rst | 53 +++++++++++++++++++++++++++++------ docs/tutorials/wiki2/installation.rst | 31 +++++++++++--------- 2 files changed, 62 insertions(+), 22 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index d9c3bec1e..251d79606 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -129,6 +129,7 @@ On Windows c:\> cd pyramidtut + .. _making_a_project: Making a project @@ -209,7 +210,7 @@ packages. Success executing this command will show a line like the following: zc.lockfile-1.1.0 zdaemon-4.1.0 zodbpickle-0.6.0 zodburi-2.0 -.. _install-testing-requirements_zodb: +.. _install-testing-requirements-zodb: Install testing requirements ---------------------------- @@ -252,7 +253,9 @@ Run the tests ------------- After you've installed the project in development mode as well as the testing -requirements, you may run the tests for the project. +requirements, you may run the tests for the project. The following commands +provide options to py.test that specify the module for which its tests shall be +run, and to run py.test in quiet mode. On UNIX ^^^^^^^ @@ -275,6 +278,16 @@ For a successful test run, you should see output that ends like this: . 1 passed in 0.24 seconds +.. note:: + py.test follows :ref:`conventions for Python test discovery + `. This explains why we cannot run just ``py.test`` + without specifying the module to test after generating a project from a + scaffold. + + py.test is a :ref:`mature full-featured Python testing tool + `. See py.test's documentation for :ref:`pytest:usage` or + invoke ``py.test -h`` to see its full set of options. + Expose test coverage information -------------------------------- @@ -358,9 +371,9 @@ If successful, you will see something like this on your console: .. code-block:: text - Starting subprocess with file monitor - Starting server in PID 95736. - serving on http://127.0.0.1:6543 + Starting subprocess with file monitor + Starting server in PID 82349. + serving on http://127.0.0.1:6543 This means the server is ready to accept requests. @@ -387,9 +400,31 @@ assumptions: - You are willing to use :term:`traversal` to map URLs to code. +- You want to use pyramid_zodbconn_, pyramid_tm_, and the transaction_ packages + to manage connections and transactions with :term:`ZODB`. + +- You want to use pyramid_chameleon_ to render your templates. Different + templating engines can be used, but we had to choose one to make this + tutorial. See :ref:`available_template_system_bindings` for some options. + .. note:: - :app:`Pyramid` supports any persistent storage mechanism (e.g., a SQL - database or filesystem files). It also supports an additional - mechanism to map URLs to code (:term:`URL dispatch`). However, for the - purposes of this tutorial, we'll only be using traversal and ZODB. + :app:`Pyramid` supports any persistent storage mechanism (e.g., an SQL + database or filesystem files). It also supports an additional mechanism to + map URLs to code (:term:`URL dispatch`). However, for the purposes of this + tutorial, we'll only be using :term:`traversal` and :term:`ZODB`. + +.. _pyramid_chameleon: + http://docs.pylonsproject.org/projects/pyramid-chameleon/en/latest/ + +.. _pyramid_tm: + http://docs.pylonsproject.org/projects/pyramid-tm/en/latest/ + +.. _pyramid_zodbconn: + http://docs.pylonsproject.org/projects/pyramid-zodbconn/en/latest/ + +.. _transaction: + http://zodb.readthedocs.org/en/latest/transactions.html + +.. _pyramid_chameleon: + http://docs.pylonsproject.org/projects/pyramid-chameleon/en/latest/ diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index e45b13315..4919c8fa5 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -270,7 +270,9 @@ Run the tests ------------- After you've installed the project in development mode as well as the testing -requirements, you may run the tests for the project. +requirements, you may run the tests for the project. The following commands +provide options to py.test that specify the module for which its tests shall be +run, and to run py.test in quiet mode. On UNIX ^^^^^^^ @@ -293,6 +295,16 @@ For a successful test run, you should see output that ends like this: .. 2 passed in 0.44 seconds +.. note:: + py.test follows :ref:`conventions for Python test discovery + `. This explains why we cannot run just ``py.test`` + without specifying the module to test after generating a project from a + scaffold. + + py.test is a :ref:`mature full-featured Python testing tool + `. See py.test's documentation for :ref:`pytest:usage` or + invoke ``py.test -h`` to see its full set of options. + Expose test coverage information -------------------------------- @@ -451,7 +463,9 @@ On Windows Your OS firewall, if any, may pop up a dialog asking for authorization to allow python to accept incoming network connections. -If successful, you will see something like this on your console:: +If successful, you will see something like this on your console: + +.. code-block:: text Starting subprocess with file monitor Starting server in PID 82349. @@ -463,7 +477,7 @@ This means the server is ready to accept requests. Visit the application in a browser ---------------------------------- -In a browser, visit http://localhost:6543/. You will see the generated +In a browser, visit http://localhost:6543/. You will see the generated application's default page. One thing you'll notice is the "debug toolbar" icon on right hand side of the @@ -494,7 +508,7 @@ assumptions: :app:`Pyramid` supports any persistent storage mechanism (e.g., object database or filesystem files). It also supports an additional mechanism to map URLs to code (:term:`traversal`). However, for the purposes of this - tutorial, we'll only be using URL dispatch and SQLAlchemy. + tutorial, we'll only be using :term:`URL dispatch` and :term:`SQLAlchemy`. .. _pyramid_jinja2: http://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/ @@ -510,12 +524,3 @@ assumptions: .. _pyramid_jinja2: http://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/ - -.. _pyramid_tm: - http://docs.pylonsproject.org/projects/pyramid-tm/en/latest/ - -.. _zope.sqlalchemy: - https://pypi.python.org/pypi/zope.sqlalchemy - -.. _transaction: - http://zodb.readthedocs.org/en/latest/transactions.html -- cgit v1.2.3 From f69beca1c0ea61d6d1d03b85a92aaecbe1ede837 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 6 May 2016 11:05:35 -0700 Subject: remove duplicate links --- docs/tutorials/wiki2/installation.rst | 3 --- 1 file changed, 3 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 4919c8fa5..6f46c5539 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -521,6 +521,3 @@ assumptions: .. _transaction: http://zodb.readthedocs.org/en/latest/transactions.html - -.. _pyramid_jinja2: - http://docs.pylonsproject.org/projects/pyramid-jinja2/en/latest/ -- cgit v1.2.3 From 02161cc32a1a2fe0c4fbae94e605610e63e0d545 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Fri, 6 May 2016 11:14:31 -0700 Subject: remove duplicate links --- docs/tutorials/wiki/installation.rst | 3 --- 1 file changed, 3 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index 251d79606..ee87dcaf9 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -425,6 +425,3 @@ assumptions: .. _transaction: http://zodb.readthedocs.org/en/latest/transactions.html - -.. _pyramid_chameleon: - http://docs.pylonsproject.org/projects/pyramid-chameleon/en/latest/ -- cgit v1.2.3 From e09369f02f61f2443f393bcd29fa84e970268b53 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 00:54:55 -0700 Subject: wordsmith py.test and coverage configuration --- docs/narr/project.rst | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index 8849e9ee7..a25394151 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -227,11 +227,7 @@ Here's sample output from a test run on UNIX: The tests themselves are found in the ``tests.py`` module in your ``pcreate`` generated project. Within a project generated by the ``starter`` scaffold, -only two sample tests exist. Previous command is identical to: - -.. code-block:: bash - - $ $VENV/bin/py.test myproject/tests.py -q +only two sample tests exist. .. note:: @@ -244,7 +240,19 @@ to ``py.test``: .. code-block:: bash - $ $VENV/bin/py.test -q --cov + $ $VENV/bin/py.test --cov -q + +Scaffolds include configuration defaults for ``py.test`` and test coverage. +These configuration files are ``pytest.ini`` and ``.coveragerc``, located at +the root of your package. Without these defaults, we would need to specify the +path to the module on which we want to run tests and coverage. + +.. code-block:: bash + + $ $VENV/bin/py.test --cov=myproject myproject/tests.py -q + +.. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke + ``py.test -h`` to see its full set of options. .. index:: -- cgit v1.2.3 From 5e3eebda0ef61e46128fa7c6eed94c3b2d72c476 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:32:09 -0700 Subject: update wiki2 with py.test and coverage defaults --- docs/tutorials/wiki2/installation.rst | 54 +++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 15 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 6f46c5539..815164138 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -279,14 +279,14 @@ On UNIX .. code-block:: bash - $ $VENV/bin/py.test tutorial/tests.py -q + $ $VENV/bin/py.test -q On Windows ^^^^^^^^^^ .. code-block:: doscon - c:\pyramidtut\tutorial> %VENV%\Scripts\py.test tutorial\tests.py -q + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test -q For a successful test run, you should see output that ends like this: @@ -295,16 +295,6 @@ For a successful test run, you should see output that ends like this: .. 2 passed in 0.44 seconds -.. note:: - py.test follows :ref:`conventions for Python test discovery - `. This explains why we cannot run just ``py.test`` - without specifying the module to test after generating a project from a - scaffold. - - py.test is a :ref:`mature full-featured Python testing tool - `. See py.test's documentation for :ref:`pytest:usage` or - invoke ``py.test -h`` to see its full set of options. - Expose test coverage information -------------------------------- @@ -322,15 +312,15 @@ On UNIX .. code-block:: bash - $ $VENV/bin/py.test --cov=tutorial --cov-report=term-missing tutorial/tests.py + $ $VENV/bin/py.test --cov --cov-report=term-missing On Windows ^^^^^^^^^^ .. code-block:: doscon - c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov=tutorial \ - --cov-report=term-missing tutorial\tests.py + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov \ + --cov-report=term-missing If successful, you will see output something like this: @@ -365,6 +355,40 @@ If successful, you will see output something like this: Our package doesn't quite have 100% test coverage. +.. _test_and_coverage_scaffold_defaults: + +Test and coverage scaffold defaults +----------------------------------- + +Scaffolds include configuration defaults for ``py.test`` and test coverage. +These configuration files are ``pytest.ini`` and ``.coveragerc``, located at +the root of your package. Without these defaults, we would need to specify the +path to the module on which we want to run tests and coverage. + +On UNIX +^^^^^^^ + +.. code-block:: bash + + $ $VENV/bin/py.test --cov=tutorial tutorial/tests.py -q + +On Windows +^^^^^^^^^^ + +.. code-block:: doscon + + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov=tutorial \ + --cov-report=term-missing tutorial\tests.py -q + +py.test follows :ref:`conventions for Python test discovery +`, and the configuration defaults from the scaffold +tell ``py.test`` where to find the module on which we want to run tests and +coverage. + +.. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke + ``py.test -h`` to see its full set of options. + + .. _initialize_db_wiki2: Initializing the database -- cgit v1.2.3 From 779b316ec36ad4920bbe2fd6c6e0aaa5c021e029 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:34:37 -0700 Subject: update wiki1 with py.test and coverage defaults --- docs/tutorials/wiki/installation.rst | 54 +++++++++++++++++++++++++---------- docs/tutorials/wiki2/installation.rst | 2 +- 2 files changed, 40 insertions(+), 16 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/installation.rst b/docs/tutorials/wiki/installation.rst index ee87dcaf9..6172b122b 100644 --- a/docs/tutorials/wiki/installation.rst +++ b/docs/tutorials/wiki/installation.rst @@ -262,14 +262,14 @@ On UNIX .. code-block:: bash - $ $VENV/bin/py.test tutorial/tests.py -q + $ $VENV/bin/py.test -q On Windows ^^^^^^^^^^ .. code-block:: doscon - c:\pyramidtut\tutorial> %VENV%\Scripts\py.test tutorial\tests.py -q + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test -q For a successful test run, you should see output that ends like this: @@ -278,16 +278,6 @@ For a successful test run, you should see output that ends like this: . 1 passed in 0.24 seconds -.. note:: - py.test follows :ref:`conventions for Python test discovery - `. This explains why we cannot run just ``py.test`` - without specifying the module to test after generating a project from a - scaffold. - - py.test is a :ref:`mature full-featured Python testing tool - `. See py.test's documentation for :ref:`pytest:usage` or - invoke ``py.test -h`` to see its full set of options. - Expose test coverage information -------------------------------- @@ -305,15 +295,15 @@ On UNIX .. code-block:: bash - $ $VENV/bin/py.test --cov=tutorial --cov-report=term-missing tutorial/tests.py + $ $VENV/bin/py.test --cov --cov-report=term-missing On Windows ^^^^^^^^^^ .. code-block:: doscon - c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov=tutorial \ - --cov-report=term-missing tutorial\tests.py + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov \ + --cov-report=term-missing If successful, you will see output something like this: @@ -341,6 +331,40 @@ If successful, you will see output something like this: Our package doesn't quite have 100% test coverage. +.. _test_and_coverage_scaffold_defaults_zodb: + +Test and coverage scaffold defaults +----------------------------------- + +Scaffolds include configuration defaults for ``py.test`` and test coverage. +These configuration files are ``pytest.ini`` and ``.coveragerc``, located at +the root of your package. Without these defaults, we would need to specify the +path to the module on which we want to run tests and coverage. + +On UNIX +^^^^^^^ + +.. code-block:: bash + + $ $VENV/bin/py.test --cov=tutorial tutorial/tests.py -q + +On Windows +^^^^^^^^^^ + +.. code-block:: doscon + + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test --cov=tutorial \ + --cov-report=term-missing tutorial\tests.py -q + +py.test follows :ref:`conventions for Python test discovery +`, and the configuration defaults from the scaffold +tell ``py.test`` where to find the module on which we want to run tests and +coverage. + +.. seealso:: See py.test's documentation for :ref:`pytest:usage` or invoke + ``py.test -h`` to see its full set of options. + + .. _wiki-start-the-application: Start the application diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 815164138..2b8ce5dfa 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -355,7 +355,7 @@ If successful, you will see output something like this: Our package doesn't quite have 100% test coverage. -.. _test_and_coverage_scaffold_defaults: +.. _test_and_coverage_scaffold_defaults_sql: Test and coverage scaffold defaults ----------------------------------- -- cgit v1.2.3 From 683d7517f33329ef6bd0a0d1f8a5a9470c0e0bf1 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:39:57 -0700 Subject: update quick tour with py.test and coverage defaults --- docs/quick_tour.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/quick_tour.rst b/docs/quick_tour.rst index 78af6fd40..b170e5d98 100644 --- a/docs/quick_tour.rst +++ b/docs/quick_tour.rst @@ -699,7 +699,7 @@ We changed ``setup.py`` which means we need to rerun ``$VENV/bin/pip install -e .. code-block:: bash - $ $VENV/bin/py.test --cov=hello_world --cov-report=term-missing hello_world/tests.py + $ $VENV/bin/py.test --cov --cov-report=term-missing This yields the following output. -- cgit v1.2.3 From ea252c3df9cab326a5a5e9a7bdcafae637bd0d47 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:53:23 -0700 Subject: update narr/project.rst with py.test and coverage defaults --- docs/narr/project.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/narr/project.rst b/docs/narr/project.rst index a25394151..1ce12a938 100644 --- a/docs/narr/project.rst +++ b/docs/narr/project.rst @@ -929,10 +929,10 @@ The ``tests.py`` module includes unit tests for your application. :linenos: This sample ``tests.py`` file has one unit test and one functional test defined -within it. These tests are executed when you run ``py.test myproject/tests.py --q``. You may add more tests here as you build your application. You are not -required to write tests to use :app:`Pyramid`. This file is simply provided for -convenience and example. +within it. These tests are executed when you run ``py.test -q``. You may add +more tests here as you build your application. You are not required to write +tests to use :app:`Pyramid`. This file is simply provided for convenience and +example. See :ref:`testing_chapter` for more information about writing :app:`Pyramid` unit tests. -- cgit v1.2.3 From b0eb612ca540d5d69841902424cd09b92b80e13b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:53:43 -0700 Subject: update conventions.rst with py.test and coverage defaults --- docs/conventions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/conventions.rst b/docs/conventions.rst index 0f5daf106..43853882c 100644 --- a/docs/conventions.rst +++ b/docs/conventions.rst @@ -55,7 +55,7 @@ character, e.g.: .. code-block:: bash - $ $VENV/bin/py.test tutorial/tests.py -q + $ $VENV/bin/py.test -q (See :term:`venv` for the meaning of ``$VENV``) @@ -64,7 +64,7 @@ drive letter and/or a directory name, e.g.: .. code-block:: doscon - c:\examples> %VENV%\Scripts\py.test tutorial\tests.py -q + c:\examples> %VENV%\Scripts\py.test -q (See :term:`venv` for the meaning of ``%VENV%``) @@ -73,7 +73,7 @@ example block commands are prefixed only with a ``>`` character, e.g.: .. code-block:: doscon - > %VENV%\Scripts\py.test tutorial\tests.py -q + > %VENV%\Scripts\py.test -q When a command that should be typed on one line is too long to fit on a page, the backslash ``\`` is used to indicate that the following printed line should -- cgit v1.2.3 From edab48b35d1175bf20416fa570ba32506605e662 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 01:58:03 -0700 Subject: update tutorials/wiki/tests.rst with py.test and coverage defaults --- docs/tutorials/wiki/tests.rst | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index 788ec595b..aa4cb3597 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -52,20 +52,21 @@ Running the tests ================= We can run these tests by using ``py.test`` similarly to how we did in -:ref:`running_tests`. Our testing dependencies have already been satisfied, -courtesy of the scaffold, so we can jump right to running tests. +:ref:`running_tests`. Courtest of the scaffold, our testing dependencies have +already been satisfied and ``py.test`` and coverage has already been +configured, so we can jump right to running tests. On UNIX: .. code-block:: text - $ $VENV/bin/py.test tutorial/tests.py -q + $ $VENV/bin/py.test -q On Windows: .. code-block:: text - c:\pyramidtut\tutorial> %VENV%\Scripts\py.test tutorial/tests.py -q + c:\pyramidtut\tutorial> %VENV%\Scripts\py.test -q The expected result should look like the following: -- cgit v1.2.3 From 1ce7fe71a238a2a735d49597232bc1fc240f5eeb Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 7 May 2016 02:03:38 -0700 Subject: fix typo --- docs/designdefense.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 70dbbe720..51c3c5bd8 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -608,7 +608,7 @@ pyramid/scaffolds/ 133KB -pyramid/ (except for ``pyramd/tests`` and ``pyramid/scaffolds``) +pyramid/ (except for ``pyramid/tests`` and ``pyramid/scaffolds``) 812KB -- cgit v1.2.3 From 283ad4c8125061cc3166bf1af925a38920478c9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20F=C3=A9rotin?= Date: Sun, 8 May 2016 17:12:42 +0200 Subject: docs: Fix typos. --- docs/tutorials/wiki/tests.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki/tests.rst b/docs/tutorials/wiki/tests.rst index aa4cb3597..85a023cc9 100644 --- a/docs/tutorials/wiki/tests.rst +++ b/docs/tutorials/wiki/tests.rst @@ -52,8 +52,8 @@ Running the tests ================= We can run these tests by using ``py.test`` similarly to how we did in -:ref:`running_tests`. Courtest of the scaffold, our testing dependencies have -already been satisfied and ``py.test`` and coverage has already been +:ref:`running_tests`. Courtesy of the scaffold, our testing dependencies have +already been satisfied and ``py.test`` and coverage have already been configured, so we can jump right to running tests. On UNIX: -- cgit v1.2.3 From 2b50258d4f7771b4a52a0170733186b3fc4e9b7b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 8 May 2016 12:27:24 -0700 Subject: pylons != pyramid --- docs/designdefense.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/designdefense.rst b/docs/designdefense.rst index 51c3c5bd8..e759c0e2a 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -1432,7 +1432,8 @@ object which *is not logically global*: # this is executed if the request method was GET or the # credentials were invalid -The `Pylons 1.X `_ +The `Pylons 1.X +`_ web framework uses a similar strategy. It calls these things "Stacked Object Proxies", so, for purposes of this discussion, I'll do so as well. -- cgit v1.2.3 From a1aa71ac60fbaac4fc0fbc3d4846fb9f33d2ad07 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 8 May 2016 12:35:16 -0700 Subject: - use cleaner URL for IRC --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index ad667684c..452666dc8 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -80,7 +80,7 @@ If you've got questions that aren't answered by this documentation, contact the `Pylons-discuss maillist `_ or join the `#pyramid IRC channel -`_. +`_. Browse and check out tagged and trunk versions of :app:`Pyramid` via the `Pyramid GitHub repository `_. To check out -- cgit v1.2.3 From c6729daea00b438bcf01c15c0e98f4a8024bf3c7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 8 May 2016 12:41:08 -0700 Subject: use new trypyramid.com page. whee! --- docs/narr/introduction.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst index d92916503..de6ac408b 100644 --- a/docs/narr/introduction.rst +++ b/docs/narr/introduction.rst @@ -221,7 +221,7 @@ send email, let you use the Jinja2 templating system, let you use XML-RPC or JSON-RPC, let you integrate with jQuery Mobile, etc. Examples: -http://docs.pylonsproject.org/en/latest/docs/pyramid.html#pyramid-add-ons +https://trypyramid.com/resources-extending-pyramid.html Class-based and function-based views ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.2.3 From 5c89d4d4e95d0f95668d9b823159057bf5c7b289 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Tue, 10 May 2016 03:13:58 -0500 Subject: expose the IRequestFactory interface --- docs/api/interfaces.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'docs') diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index 272820a91..521d65d2b 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -59,6 +59,9 @@ Other Interfaces .. autointerface:: IRenderer :members: + .. autointerface:: IRequestFactory + :members: + .. autointerface:: IResponseFactory :members: -- cgit v1.2.3 From 3a32502ee74b1a966e9e122b9d76551ec2cd7e80 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 14 May 2016 22:47:01 -0700 Subject: fix punctuation --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index 452666dc8..f337174b1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -167,7 +167,7 @@ Comprehensive reference material for every public API exposed by ``p*`` Scripts Documentation ============================ -``p*`` scripts included with :app:`Pyramid`:. +``p*`` scripts included with :app:`Pyramid`. .. toctree:: :maxdepth: 1 -- cgit v1.2.3 From e998458448688c11c983e72e92a200056ee1739b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 14 May 2016 23:56:32 -0700 Subject: make version perpetual --- docs/copyright.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/copyright.rst b/docs/copyright.rst index 9532c15b7..30ae40603 100644 --- a/docs/copyright.rst +++ b/docs/copyright.rst @@ -1,7 +1,7 @@ Copyright, Trademarks, and Attributions ======================================= -*The Pyramid Web Framework, Version 1.1* +"The Pyramid Web Framework, Version |version|" by Chris McDonough @@ -101,4 +101,3 @@ http://docs.pylonsproject.org/projects/pyramid/en/latest/ The source code for the examples used in this book are available within the :app:`Pyramid` software distribution, always available via https://github.com/Pylons/pyramid - -- cgit v1.2.3 From 8eb4e184c05ac1822a0ce1986bde1ad4410a9322 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sat, 14 May 2016 23:58:11 -0700 Subject: fix IRC link and page count --- docs/designdefense.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/designdefense.rst b/docs/designdefense.rst index e759c0e2a..dbdb53b8d 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -1653,10 +1653,11 @@ If you can understand this hello world program, you can use Pyramid: server = make_server('0.0.0.0', 8080, app) server.serve_forever() -Pyramid has ~ 700 pages of documentation (printed), covering topics from the -very basic to the most advanced. *Nothing* is left undocumented, quite +Pyramid has about 800 pages of documentation (printed), covering topics from +the very basic to the most advanced. *Nothing* is left undocumented, quite literally. It also has an *awesome*, very helpful community. Visit the -#pyramid IRC channel on freenode.net (irc://freenode.net#pyramid) and see. +`#pyramid IRC channel on freenode.net +`_ and see. Hate Zope +++++++++ -- cgit v1.2.3 From da1c240b3c589340f28a20366d02239f1314f965 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 May 2016 03:00:43 -0700 Subject: revise latexindex.rst - add designdefense, quick_tour, quick_tutorial, p* scripts, change history --- docs/latexindex.rst | 59 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 45 insertions(+), 14 deletions(-) (limited to 'docs') diff --git a/docs/latexindex.rst b/docs/latexindex.rst index c4afff212..05199d313 100644 --- a/docs/latexindex.rst +++ b/docs/latexindex.rst @@ -14,12 +14,27 @@ Front Matter .. toctree:: :maxdepth: 1 - copyright.rst - conventions.rst - authorintro.rst + copyright + conventions + authorintro + designdefense .. mainmatter:: +.. _tutorials: + +Tutorials +@@@@@@@@@ + +.. toctree:: + :maxdepth: 1 + + quick_tour + quick_tutorial/index + tutorials/wiki2/index + tutorials/wiki/index + tutorials/modwsgi/index + .. _narrative_documentation: Narrative Documentation @@ -68,31 +83,47 @@ Narrative Documentation narr/threadlocals narr/zca -.. _tutorials: - -Tutorials -@@@@@@@@@ +API Documentation +@@@@@@@@@@@@@@@@@ .. toctree:: :maxdepth: 1 + :glob: - tutorials/wiki2/index.rst - tutorials/wiki/index.rst - tutorials/modwsgi/index.rst + api/index + api/* -.. _api_documentation: -API Documentation -@@@@@@@@@@@@@@@@@ +``p*`` Scripts Documentation +@@@@@@@@@@@@@@@@@@@@@@@@@@@@ .. toctree:: :maxdepth: 1 :glob: - api/* + pscripts/index + pscripts/* + .. backmatter:: +Change History +@@@@@@@@@@@@@@ + +.. toctree:: + :maxdepth: 1 + + whatsnew-1.7 + whatsnew-1.6 + whatsnew-1.5 + whatsnew-1.4 + whatsnew-1.3 + whatsnew-1.2 + whatsnew-1.1 + whatsnew-1.0 + changes + + Glossary and Index @@@@@@@@@@@@@@@@@@ -- cgit v1.2.3 From b8dd44f39d4372abfff503904cda94f2030128d7 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 May 2016 03:01:16 -0700 Subject: fix page count --- docs/designdefense.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/designdefense.rst b/docs/designdefense.rst index dbdb53b8d..f42582e47 100644 --- a/docs/designdefense.rst +++ b/docs/designdefense.rst @@ -1653,7 +1653,7 @@ If you can understand this hello world program, you can use Pyramid: server = make_server('0.0.0.0', 8080, app) server.serve_forever() -Pyramid has about 800 pages of documentation (printed), covering topics from +Pyramid has over 1200 pages of documentation (printed), covering topics from the very basic to the most advanced. *Nothing* is left undocumented, quite literally. It also has an *awesome*, very helpful community. Visit the `#pyramid IRC channel on freenode.net -- cgit v1.2.3 From f3a884f2ef39f7768c82be5dfca759852f1e443a Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 May 2016 03:02:26 -0700 Subject: use characters that don't break the latexpdf builder. See #2572 --- docs/quick_tutorial/requirements.rst | 18 +++++++++--------- docs/quick_tutorial/tutorial_approach.rst | 16 ++++++++-------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'docs') diff --git a/docs/quick_tutorial/requirements.rst b/docs/quick_tutorial/requirements.rst index 1f2b4da97..62dd570fc 100644 --- a/docs/quick_tutorial/requirements.rst +++ b/docs/quick_tutorial/requirements.rst @@ -79,15 +79,15 @@ will reside as we proceed through the tutorial: .. code-block:: text - └── ~ - └── projects - └── quick_tutorial - ├── env - └── step_one - ├── intro - │ ├── __init__.py - │ └── app.py - └── setup.py + `── ~ + `── projects + `── quick_tutorial + │── env + `── step_one + │── intro + │ │── __init__.py + │ `── app.py + `── setup.py For Linux, the commands to do so are as follows: diff --git a/docs/quick_tutorial/tutorial_approach.rst b/docs/quick_tutorial/tutorial_approach.rst index 6d534fe13..49a6bfd85 100644 --- a/docs/quick_tutorial/tutorial_approach.rst +++ b/docs/quick_tutorial/tutorial_approach.rst @@ -32,14 +32,14 @@ below: .. code-block:: text quick_tutorial - ├── env - └── request_response - ├── tutorial - │ ├── __init__.py - │ ├── tests.py - │ └── views.py - ├── development.ini - └── setup.py + │── env + `── request_response + `── tutorial + │ │── __init__.py + │ │── tests.py + │ `── views.py + │── development.ini + `── setup.py Each of the first-level directories (e.g., ``request_response``) is a *Python project* (except as noted for the ``hello_world`` step). The ``tutorial`` -- cgit v1.2.3 From d66e2080906ec41a84d63f19765c10bf018e256b Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 May 2016 03:03:07 -0700 Subject: reorganize authorintro sections to align with latexindex --- docs/authorintro.rst | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/authorintro.rst b/docs/authorintro.rst index ebc6bcff8..6e96fad9a 100644 --- a/docs/authorintro.rst +++ b/docs/authorintro.rst @@ -54,7 +54,14 @@ technologies. Book Content ============ -This book is divided into three major parts: +This book is divided into four major parts: + +:ref:`tutorials` + + Each tutorial builds a sample application or implements a set of + concepts with a sample; it then describes the application or + concepts in terms of the sample. You should read the tutorials if + you want a guided tour of :app:`Pyramid`. :ref:`narrative_documentation` @@ -66,19 +73,16 @@ This book is divided into three major parts: out-of-order, or when you need only a reminder about a particular topic while you're developing an application. -:ref:`tutorials` - - Each tutorial builds a sample application or implements a set of - concepts with a sample; it then describes the application or - concepts in terms of the sample. You should read the tutorials if - you want a guided tour of :app:`Pyramid`. - :ref:`api_documentation` Comprehensive reference material for every public API exposed by :app:`Pyramid`. The API documentation is organized alphabetically by module name. +:ref:`pscripts_documentation` + + ``p*`` scripts included with :app:`Pyramid`. + .. index:: single: repoze.zope2 single: Zope 3 -- cgit v1.2.3 From 9337737a9ce2403c724cdd4d3ce8a7f0e5e85e47 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 15 May 2016 03:03:37 -0700 Subject: fix headings and suffices --- docs/api/index.rst | 2 +- docs/index.rst | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/api/index.rst b/docs/api/index.rst index cb38aa0b2..4b912e2bd 100644 --- a/docs/api/index.rst +++ b/docs/api/index.rst @@ -1,4 +1,4 @@ -.. _html_api_documentation: +.. _api_documentation: API Documentation ================= diff --git a/docs/index.rst b/docs/index.rst index f337174b1..cb63832c1 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -18,7 +18,7 @@ After you install :app:`Pyramid` and run this application, when you visit this application works. -.. _html_getting_started: +.. _getting_started: Getting Started =============== @@ -60,9 +60,9 @@ platforms. .. toctree:: :maxdepth: 1 - tutorials/wiki2/index.rst - tutorials/wiki/index.rst - tutorials/modwsgi/index.rst + tutorials/wiki2/index + tutorials/wiki/index + tutorials/modwsgi/index .. _support-and-development: -- cgit v1.2.3 From 5b73bd4fce3f00fef581940ca6ca972576c03094 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 15 May 2016 23:11:29 -0500 Subject: password_hash is unicode, needs to be encoded --- docs/tutorials/wiki2/src/authentication/tutorial/models/user.py | 2 +- docs/tutorials/wiki2/src/models/tutorial/models/user.py | 2 +- docs/tutorials/wiki2/src/tests/tutorial/models/user.py | 2 +- docs/tutorials/wiki2/src/views/tutorial/models/user.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py b/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py index 6bd3315d6..6fb32a1b2 100644 --- a/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py +++ b/docs/tutorials/wiki2/src/authentication/tutorial/models/user.py @@ -23,7 +23,7 @@ class User(Base): def check_password(self, pw): if self.password_hash is not None: - expected_hash = self.password_hash + expected_hash = self.password_hash.encode('utf8') actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash) return expected_hash == actual_hash return False diff --git a/docs/tutorials/wiki2/src/models/tutorial/models/user.py b/docs/tutorials/wiki2/src/models/tutorial/models/user.py index 6bd3315d6..6fb32a1b2 100644 --- a/docs/tutorials/wiki2/src/models/tutorial/models/user.py +++ b/docs/tutorials/wiki2/src/models/tutorial/models/user.py @@ -23,7 +23,7 @@ class User(Base): def check_password(self, pw): if self.password_hash is not None: - expected_hash = self.password_hash + expected_hash = self.password_hash.encode('utf8') actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash) return expected_hash == actual_hash return False diff --git a/docs/tutorials/wiki2/src/tests/tutorial/models/user.py b/docs/tutorials/wiki2/src/tests/tutorial/models/user.py index 6bd3315d6..6fb32a1b2 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/models/user.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/models/user.py @@ -23,7 +23,7 @@ class User(Base): def check_password(self, pw): if self.password_hash is not None: - expected_hash = self.password_hash + expected_hash = self.password_hash.encode('utf8') actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash) return expected_hash == actual_hash return False diff --git a/docs/tutorials/wiki2/src/views/tutorial/models/user.py b/docs/tutorials/wiki2/src/views/tutorial/models/user.py index 6bd3315d6..6fb32a1b2 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/models/user.py +++ b/docs/tutorials/wiki2/src/views/tutorial/models/user.py @@ -23,7 +23,7 @@ class User(Base): def check_password(self, pw): if self.password_hash is not None: - expected_hash = self.password_hash + expected_hash = self.password_hash.encode('utf8') actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash) return expected_hash == actual_hash return False -- cgit v1.2.3 From ab03198772afedf9a03dc3a0c689720de97f1acb Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 16 May 2016 00:32:00 -0700 Subject: remove reference to Twitter Bootstrap styling. Closes #2570. --- docs/quick_tutorial/forms.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/quick_tutorial/forms.rst b/docs/quick_tutorial/forms.rst index 6b29833bd..66e77491d 100644 --- a/docs/quick_tutorial/forms.rst +++ b/docs/quick_tutorial/forms.rst @@ -1,7 +1,7 @@ .. _qtut_forms: ==================================== -18: Forms and Validation With Deform +18: Forms and Validation with Deform ==================================== Schema-driven, autogenerated forms with validation. @@ -19,9 +19,6 @@ Instead there are a variety of form libraries that are easy to use in Pyramid. Deform for our forms. This also gives us :ref:`Colander ` for schemas and validation. -Deform uses styling from Twitter Bootstrap and advanced widgets from popular -JavaScript projects. - Objectives ========== -- cgit v1.2.3 From dcb5d6922b8939963ed1995bc04fe096b9b0d6ae Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 16 May 2016 00:53:00 -0700 Subject: Change link from pylonsproject.org to trypyramid.com --- docs/index.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index cb63832c1..d4476a952 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -70,8 +70,9 @@ platforms. Support and Development ======================= -The `Pylons Project web site `_ is the main -online source of :app:`Pyramid` support and development information. +The `Pyramid website `_ is the main +entry point to :app:`Pyramid` web framework resources for support and +development information. To report bugs, use the `issue tracker `_. -- cgit v1.2.3 From 88030f98e792c4f9723faba80de0a79784238725 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 16 May 2016 01:02:49 -0700 Subject: remove stray / --- docs/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/index.rst b/docs/index.rst index d4476a952..02c35866a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -70,7 +70,7 @@ platforms. Support and Development ======================= -The `Pyramid website `_ is the main +The `Pyramid website `_ is the main entry point to :app:`Pyramid` web framework resources for support and development information. -- cgit v1.2.3 From f038c7d477f98713d48eed9f74822f2b2d7028cd Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 19 May 2016 23:06:49 -0500 Subject: update master's history with the changelog from 1.7 --- docs/whatsnew-1.7.rst | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'docs') diff --git a/docs/whatsnew-1.7.rst b/docs/whatsnew-1.7.rst index fd144a24a..398b12f01 100644 --- a/docs/whatsnew-1.7.rst +++ b/docs/whatsnew-1.7.rst @@ -32,6 +32,11 @@ Backwards Incompatibilities csrf token in the query string of a request. Only headers and request bodies are supported. See https://github.com/Pylons/pyramid/pull/2500 +- A global permission set via + :meth:`pyramid.config.Configurator.set_default_permission` will no longer + affect exception views. A permission must be set explicitly on the view for + it to be enforced. See https://github.com/Pylons/pyramid/pull/2534 + Feature Additions ----------------- @@ -42,14 +47,6 @@ Feature Additions other stages of the pipeline such as the raw response from a view or prior to security checks. See https://github.com/Pylons/pyramid/pull/2021 -- Added a new setting, ``pyramid.require_default_csrf`` which may be used - to turn on CSRF checks globally for every request in the application. - This should be considered a good default for websites built on Pyramid. - It is possible to opt-out of CSRF checks on a per-view basis by setting - ``require_csrf=False`` on those views. - See :ref:`auto_csrf_checking` and - https://github.com/Pylons/pyramid/pull/2413 - - Added a ``require_csrf`` view option which will enforce CSRF checks on requests with an unsafe method as defined by RFC2616. If the CSRF check fails a ``BadCSRFToken`` exception will be raised and may be caught by exception @@ -60,6 +57,17 @@ Feature Additions https://github.com/Pylons/pyramid/pull/2413 and https://github.com/Pylons/pyramid/pull/2500 +- Added a new method, + :meth:`pyramid.config.Configurator.set_csrf_default_options`, + for configuring CSRF checks used by the ``require_csrf=True`` view option. + This method can be used to turn on CSRF checks globally for every view + in the application. This should be considered a good default for websites + built on Pyramid. It is possible to opt-out of CSRF checks on a per-view + basis by setting ``require_csrf=False`` on those views. + See :ref:`auto_csrf_checking` and + https://github.com/Pylons/pyramid/pull/2413 and + https://github.com/Pylons/pyramid/pull/2518 + - Added an additional CSRF validation that checks the origin/referrer of a request and makes sure it matches the current ``request.domain``. This particular check is only active when accessing a site over HTTPS as otherwise @@ -96,6 +104,11 @@ Feature Additions ``EXCVIEW`` tween where you may need more control over the request. See https://github.com/Pylons/pyramid/pull/2393 +- A global permission set via + :meth:`pyramid.config.Configurator.set_default_permission` will no longer + affect exception views. A permission must be set explicitly on the view for + it to be enforced. See https://github.com/Pylons/pyramid/pull/2534 + - Allow a leading ``=`` on the key of the request param predicate. For example, ``'=abc=1'`` is equivalent down to ``request.params['=abc'] == '1'``. @@ -111,6 +124,11 @@ Feature Additions :func:`pyramid.paster.setup_logging`. See https://github.com/Pylons/pyramid/pull/2399 +- The :attr:`pyramid.tweens.EXCVIEW` tween will now re-raise the original + exception if no exception view could be found to handle it. This allows + the exception to be handled upstream by another tween or middelware. + See https://github.com/Pylons/pyramid/pull/2567 + Deprecations ------------ -- cgit v1.2.3 From 4918628b83319749f73e843ef01a0b9060f5956e Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Thu, 19 May 2016 23:37:38 -0500 Subject: oops, encode the password in the authorization tutorial as well --- docs/tutorials/wiki2/src/authorization/tutorial/models/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py b/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py index 6bd3315d6..6fb32a1b2 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/models/user.py @@ -23,7 +23,7 @@ class User(Base): def check_password(self, pw): if self.password_hash is not None: - expected_hash = self.password_hash + expected_hash = self.password_hash.encode('utf8') actual_hash = bcrypt.hashpw(pw.encode('utf8'), expected_hash) return expected_hash == actual_hash return False -- cgit v1.2.3 From a004ca4068b60fa79552b71da2d953e47463a536 Mon Sep 17 00:00:00 2001 From: viniciusban Date: Fri, 20 May 2016 15:32:26 -0300 Subject: Change column `Page.data` to `Text` --- docs/tutorials/wiki2/src/authentication/tutorial/models/page.py | 2 +- docs/tutorials/wiki2/src/authorization/tutorial/models/page.py | 2 +- docs/tutorials/wiki2/src/models/tutorial/models/page.py | 2 +- docs/tutorials/wiki2/src/tests/tutorial/models/page.py | 2 +- docs/tutorials/wiki2/src/views/tutorial/models/page.py | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/src/authentication/tutorial/models/page.py b/docs/tutorials/wiki2/src/authentication/tutorial/models/page.py index 4dd5b5721..74ff1faf8 100644 --- a/docs/tutorials/wiki2/src/authentication/tutorial/models/page.py +++ b/docs/tutorials/wiki2/src/authentication/tutorial/models/page.py @@ -14,7 +14,7 @@ class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False, unique=True) - data = Column(Integer, nullable=False) + data = Column(Text, nullable=False) creator_id = Column(ForeignKey('users.id'), nullable=False) creator = relationship('User', backref='created_pages') diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/models/page.py b/docs/tutorials/wiki2/src/authorization/tutorial/models/page.py index 4dd5b5721..74ff1faf8 100644 --- a/docs/tutorials/wiki2/src/authorization/tutorial/models/page.py +++ b/docs/tutorials/wiki2/src/authorization/tutorial/models/page.py @@ -14,7 +14,7 @@ class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False, unique=True) - data = Column(Integer, nullable=False) + data = Column(Text, nullable=False) creator_id = Column(ForeignKey('users.id'), nullable=False) creator = relationship('User', backref='created_pages') diff --git a/docs/tutorials/wiki2/src/models/tutorial/models/page.py b/docs/tutorials/wiki2/src/models/tutorial/models/page.py index 4dd5b5721..74ff1faf8 100644 --- a/docs/tutorials/wiki2/src/models/tutorial/models/page.py +++ b/docs/tutorials/wiki2/src/models/tutorial/models/page.py @@ -14,7 +14,7 @@ class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False, unique=True) - data = Column(Integer, nullable=False) + data = Column(Text, nullable=False) creator_id = Column(ForeignKey('users.id'), nullable=False) creator = relationship('User', backref='created_pages') diff --git a/docs/tutorials/wiki2/src/tests/tutorial/models/page.py b/docs/tutorials/wiki2/src/tests/tutorial/models/page.py index 4dd5b5721..74ff1faf8 100644 --- a/docs/tutorials/wiki2/src/tests/tutorial/models/page.py +++ b/docs/tutorials/wiki2/src/tests/tutorial/models/page.py @@ -14,7 +14,7 @@ class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False, unique=True) - data = Column(Integer, nullable=False) + data = Column(Text, nullable=False) creator_id = Column(ForeignKey('users.id'), nullable=False) creator = relationship('User', backref='created_pages') diff --git a/docs/tutorials/wiki2/src/views/tutorial/models/page.py b/docs/tutorials/wiki2/src/views/tutorial/models/page.py index 4dd5b5721..74ff1faf8 100644 --- a/docs/tutorials/wiki2/src/views/tutorial/models/page.py +++ b/docs/tutorials/wiki2/src/views/tutorial/models/page.py @@ -14,7 +14,7 @@ class Page(Base): __tablename__ = 'pages' id = Column(Integer, primary_key=True) name = Column(Text, nullable=False, unique=True) - data = Column(Integer, nullable=False) + data = Column(Text, nullable=False) creator_id = Column(ForeignKey('users.id'), nullable=False) creator = relationship('User', backref='created_pages') -- cgit v1.2.3 From 224b9878a11046297d1a64092a240e80e8129f04 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 22 May 2016 03:51:35 -0700 Subject: Change type to Text from Integer. See #2591 --- docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py | 2 +- docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py | 2 +- docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py b/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py index eb645bfe6..cdb748fc7 100644 --- a/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py +++ b/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Integer) + value = Column(Text) # End Sphinx Include diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py index d65a01a42..1d2abaf25 100644 --- a/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py +++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Integer) + value = Column(Text) Index('my_index', MyModel.name, unique=True, mysql_length=255) diff --git a/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py b/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py index d65a01a42..1d2abaf25 100644 --- a/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py +++ b/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Integer) + value = Column(Text) Index('my_index', MyModel.name, unique=True, mysql_length=255) -- cgit v1.2.3 From 45835ac934fc8e74cbb31308196442ab144ac043 Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Sun, 22 May 2016 04:21:36 -0700 Subject: change type integer to type text, and update output of db init script - update output of running pytest coverage --- docs/tutorials/wiki2/definingmodels.rst | 70 ++++++++++++++++----------------- docs/tutorials/wiki2/installation.rst | 50 +++++++++++------------ 2 files changed, 59 insertions(+), 61 deletions(-) (limited to 'docs') diff --git a/docs/tutorials/wiki2/definingmodels.rst b/docs/tutorials/wiki2/definingmodels.rst index 6520613ea..9f7b82d1d 100644 --- a/docs/tutorials/wiki2/definingmodels.rst +++ b/docs/tutorials/wiki2/definingmodels.rst @@ -191,49 +191,49 @@ Success will look something like this: .. code-block:: bash - 2016-04-09 02:49:51,711 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 - 2016-04-09 02:49:51,711 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () - 2016-04-09 02:49:51,712 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 - 2016-04-09 02:49:51,712 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () - 2016-04-09 02:49:51,713 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("pages") - 2016-04-09 02:49:51,714 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 02:49:51,714 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("users") - 2016-04-09 02:49:51,714 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 02:49:51,715 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] + 2016-05-22 04:12:09,226 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 + 2016-05-22 04:12:09,226 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () + 2016-05-22 04:12:09,226 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 + 2016-05-22 04:12:09,227 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () + 2016-05-22 04:12:09,227 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("users") + 2016-05-22 04:12:09,227 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:12:09,228 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("pages") + 2016-05-22 04:12:09,228 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:12:09,229 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE TABLE users ( - id INTEGER NOT NULL, - name TEXT NOT NULL, - role TEXT NOT NULL, - password_hash TEXT, - CONSTRAINT pk_users PRIMARY KEY (id), - CONSTRAINT uq_users_name UNIQUE (name) + id INTEGER NOT NULL, + name TEXT NOT NULL, + role TEXT NOT NULL, + password_hash TEXT, + CONSTRAINT pk_users PRIMARY KEY (id), + CONSTRAINT uq_users_name UNIQUE (name) ) - 2016-04-09 02:49:51,715 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 02:49:51,716 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT - 2016-04-09 02:49:51,716 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] + 2016-05-22 04:12:09,229 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:12:09,230 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:12:09,230 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE TABLE pages ( - id INTEGER NOT NULL, - name TEXT NOT NULL, - data INTEGER NOT NULL, - creator_id INTEGER NOT NULL, - CONSTRAINT pk_pages PRIMARY KEY (id), - CONSTRAINT uq_pages_name UNIQUE (name), - CONSTRAINT fk_pages_creator_id_users FOREIGN KEY(creator_id) REFERENCES users (id) + id INTEGER NOT NULL, + name TEXT NOT NULL, + data TEXT NOT NULL, + creator_id INTEGER NOT NULL, + CONSTRAINT pk_pages PRIMARY KEY (id), + CONSTRAINT uq_pages_name UNIQUE (name), + CONSTRAINT fk_pages_creator_id_users FOREIGN KEY(creator_id) REFERENCES users (id) ) - 2016-04-09 02:49:51,716 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 02:49:51,717 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT - 2016-04-09 02:49:52,256 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit) - 2016-04-09 02:49:52,257 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO users (name, role, password_hash) VALUES (?, ?, ?) - 2016-04-09 02:49:52,257 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('editor', 'editor', b'$2b$12$APUPJvI/kKxrbQPyQehkR.ggoOM6fFYCZ07SFCkWGltl1wJsKB98y') - 2016-04-09 02:49:52,258 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO users (name, role, password_hash) VALUES (?, ?, ?) - 2016-04-09 02:49:52,258 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('basic', 'basic', b'$2b$12$GeFnypuQpZyxZLH.sN0akOrPdZMcQjqVTCim67u6f89lOFH/0ddc6') - 2016-04-09 02:49:52,259 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO pages (name, data, creator_id) VALUES (?, ?, ?) - 2016-04-09 02:49:52,259 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('FrontPage', 'This is the front page', 1) - 2016-04-09 02:49:52,259 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:12:09,231 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:12:09,231 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:12:09,782 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit) + 2016-05-22 04:12:09,783 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO users (name, role, password_hash) VALUES (?, ?, ?) + 2016-05-22 04:12:09,784 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('editor', 'editor', b'$2b$12$K/WLVKRl5fMAb6UM58ueTetXlE3rlc5cRK5zFPimK598scXBR/xWC') + 2016-05-22 04:12:09,784 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO users (name, role, password_hash) VALUES (?, ?, ?) + 2016-05-22 04:12:09,784 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('basic', 'basic', b'$2b$12$JfwLyCJGv3t.RTSmIrh3B.FKXRT9FevkAqafWdK5oq7Hl4mgAQORe') + 2016-05-22 04:12:09,785 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO pages (name, data, creator_id) VALUES (?, ?, ?) + 2016-05-22 04:12:09,785 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('FrontPage', 'This is the front page', 1) + 2016-05-22 04:12:09,786 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT View the application in a browser diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 2b8ce5dfa..0ecb6e27b 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -340,16 +340,14 @@ If successful, you will see output something like this: tutorial/models/__init__.py 22 0 100% tutorial/models/meta.py 5 0 100% tutorial/models/mymodel.py 8 0 100% - tutorial/routes.py 3 3 0% 1-3 + tutorial/routes.py 3 2 33% 2-3 tutorial/scripts/__init__.py 0 0 100% - tutorial/scripts/initializedb.py 26 26 0% 1-45 - tutorial/tests.py 39 0 100% + tutorial/scripts/initializedb.py 26 16 38% 22-25, 29-45 tutorial/views/__init__.py 0 0 100% tutorial/views/default.py 12 0 100% - tutorial/views/notfound.py 4 4 0% 1-7 + tutorial/views/notfound.py 4 2 50% 6-7 ---------------------------------------------------------------- - TOTAL 127 39 69% - + TOTAL 88 26 70% ===================== 2 passed in 0.57 seconds ====================== Our package doesn't quite have 100% test coverage. @@ -432,30 +430,30 @@ The output to your console should be something like this: .. code-block:: bash - 2016-04-09 00:53:37,801 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 - 2016-04-09 00:53:37,801 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () - 2016-04-09 00:53:37,802 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 - 2016-04-09 00:53:37,802 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () - 2016-04-09 00:53:37,802 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("models") - 2016-04-09 00:53:37,803 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 00:53:37,803 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] + 2016-05-22 04:03:28,888 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test plain returns' AS VARCHAR(60)) AS anon_1 + 2016-05-22 04:03:28,888 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () + 2016-05-22 04:03:28,888 INFO [sqlalchemy.engine.base.Engine:1192][MainThread] SELECT CAST('test unicode returns' AS VARCHAR(60)) AS anon_1 + 2016-05-22 04:03:28,889 INFO [sqlalchemy.engine.base.Engine:1193][MainThread] () + 2016-05-22 04:03:28,890 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] PRAGMA table_info("models") + 2016-05-22 04:03:28,890 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:03:28,892 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE TABLE models ( - id INTEGER NOT NULL, - name TEXT, - value INTEGER, - CONSTRAINT pk_models PRIMARY KEY (id) + id INTEGER NOT NULL, + name TEXT, + value TEXT, + CONSTRAINT pk_models PRIMARY KEY (id) ) - 2016-04-09 00:53:37,803 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 00:53:37,804 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT - 2016-04-09 00:53:37,805 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE UNIQUE INDEX my_index ON models (name) - 2016-04-09 00:53:37,805 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () - 2016-04-09 00:53:37,806 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT - 2016-04-09 00:53:37,807 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit) - 2016-04-09 00:53:37,808 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO models (name, value) VALUES (?, ?) - 2016-04-09 00:53:37,808 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('one', 1) - 2016-04-09 00:53:37,809 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:03:28,892 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:03:28,893 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:03:28,893 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] CREATE UNIQUE INDEX my_index ON models (name) + 2016-05-22 04:03:28,893 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] () + 2016-05-22 04:03:28,894 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT + 2016-05-22 04:03:28,896 INFO [sqlalchemy.engine.base.Engine:646][MainThread] BEGIN (implicit) + 2016-05-22 04:03:28,897 INFO [sqlalchemy.engine.base.Engine:1097][MainThread] INSERT INTO models (name, value) VALUES (?, ?) + 2016-05-22 04:03:28,897 INFO [sqlalchemy.engine.base.Engine:1100][MainThread] ('one', 1) + 2016-05-22 04:03:28,898 INFO [sqlalchemy.engine.base.Engine:686][MainThread] COMMIT Success! You should now have a ``tutorial.sqlite`` file in your current working directory. This is an SQLite database with a single table defined in it -- cgit v1.2.3 From f7236f8300cf38e7930a93f16a05e9ea132bad0f Mon Sep 17 00:00:00 2001 From: Steve Piercy Date: Mon, 23 May 2016 13:24:22 -0700 Subject: Merge pull request #2601 from stevepiercy/1.7-branch revert column type change in alchemy scaffold and related docs --- docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py | 2 +- docs/tutorials/wiki2/installation.rst | 2 +- docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py | 2 +- docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py b/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py index cdb748fc7..eb645bfe6 100644 --- a/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py +++ b/docs/quick_tour/sqla_demo/sqla_demo/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Text) + value = Column(Integer) # End Sphinx Include diff --git a/docs/tutorials/wiki2/installation.rst b/docs/tutorials/wiki2/installation.rst index 0ecb6e27b..a214b1306 100644 --- a/docs/tutorials/wiki2/installation.rst +++ b/docs/tutorials/wiki2/installation.rst @@ -440,7 +440,7 @@ The output to your console should be something like this: CREATE TABLE models ( id INTEGER NOT NULL, name TEXT, - value TEXT, + value INTEGER, CONSTRAINT pk_models PRIMARY KEY (id) ) diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py index 1d2abaf25..d65a01a42 100644 --- a/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py +++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Text) + value = Column(Integer) Index('my_index', MyModel.name, unique=True, mysql_length=255) diff --git a/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py b/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py index 1d2abaf25..d65a01a42 100644 --- a/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py +++ b/docs/tutorials/wiki2/src/installation/tutorial/models/mymodel.py @@ -12,7 +12,7 @@ class MyModel(Base): __tablename__ = 'models' id = Column(Integer, primary_key=True) name = Column(Text) - value = Column(Text) + value = Column(Integer) Index('my_index', MyModel.name, unique=True, mysql_length=255) -- cgit v1.2.3