Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Pylons/pyramid
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Jul 2, 2018
2 parents 50efc32 + 57a896f commit 0c8ca23
Show file tree
Hide file tree
Showing 68 changed files with 448 additions and 249 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,5 @@ jyenv/
pypyenv/
env*/
venv/
.cache/
.python-version
46 changes: 44 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,39 @@ Features
instead of ``pyramid.util.Request``.
See https://github.com/Pylons/pyramid/pull/3129

- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package over the legacy
imports from `cherrypy.wsgiserver`.
- In ``cherrypy_server_runner``, prefer imports from the ``cheroot`` package
over the legacy imports from `cherrypy.wsgiserver`.
See https://github.com/Pylons/pyramid/pull/3235

- Add a context manager ``route_prefix_context`` to the
``pyramid.config.Configurator`` to allow for convenient setting of the
route_prefix for ``include`` and ``add_route`` calls inside the context.
See https://github.com/Pylons/pyramid/pull/3279

- Modify the builtin session implementations to support SameSite options on
cookies and set the default to ``'Lax'``. This affects
``pyramid.session.BaseCookieSessionFactory``,
``pyramid.session.SignedCookieSessionFactory``, and
``pyramid.session.UnencryptedCookieSessionFactoryConfig``.
See https://github.com/Pylons/pyramid/pull/3300

- Added new ``pyramid.httpexceptions.HTTPPermanentRedirect``
exception/response object for a HTTP 308 redirect.
See https://github.com/Pylons/pyramid/pull/3302

Bug Fixes
---------

- Set appropriate ``code`` and ``title`` attributes on the ``HTTPClientError``
and ``HTTPServerError`` exception classes. This prevents inadvertently
returning a 520 error code.
See https://github.com/Pylons/pyramid/pull/3280

- Replace ``webob.acceptparse.MIMEAccept`` from WebOb with
``webob.acceptparse.create_accept_header`` in the HTTP exception handling
code. The old ``MIMEAccept`` has been deprecated. The new methods follow the
RFC's more closely. See https://github.com/Pylons/pyramid/pull/3251

Deprecations
------------

Expand All @@ -39,6 +65,22 @@ Backward Incompatibilities
depending on it directly within your project.
See https://github.com/Pylons/pyramid/pull/3140

- Remove the ``permission`` argument from
``pyramid.config.Configurator.add_route``. This was an argument left over
from a feature removed in Pyramid 1.5 and has had no effect since then.
See https://github.com/Pylons/pyramid/pull/3299

- Modify the builtin session implementations to set ``SameSite='Lax'`` on
cookies. This affects ``pyramid.session.BaseCookieSessionFactory``,
``pyramid.session.SignedCookieSessionFactory``, and
``pyramid.session.UnencryptedCookieSessionFactoryConfig``.
See https://github.com/Pylons/pyramid/pull/3300

Documentation Changes
---------------------

- Bump Sphinx to >= 1.7.4 in setup.py to support ``emphasize-lines`` in PDFs
and to pave the way for xelatex support. See
https://github.com/Pylons/pyramid/pull/3271,
https://github.com/Pylons/pyramid/issues/667, and
https://github.com/Pylons/pyramid/issues/2572
10 changes: 10 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,13 @@ Contributors
- Deneys Maartens, 2017/11/03

- Heron Rossi, 2018/03/08

- Hunter Senft-Grupp, 2018/05/14

- Junhak Lee, 2018/05/14

- Alex Gaynor, 2018/05/24

- Jason Williams, 2018/06/11

- Benjamin Gmurczyk, 2018/06/14
2 changes: 1 addition & 1 deletion HACKING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ or adds the feature. To build and review docs, use the following steps.
Change Log
----------

- Feature additions and bugfixes must be added to the ``CHANGES.txt``
- Feature additions and bugfixes must be added to the ``CHANGES.rst``
file in the prevailing style. Changelog entries should be long and
descriptive, not cryptic. Other developers should be able to know
what your changelog entry means.
10 changes: 9 additions & 1 deletion RELEASING.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,15 @@ Prepare new release branch

- Change setup.py version to the release version number.

- Make sure PyPI long description renders (requires ``readme_renderer``
installed into your Python)::

$ python setup.py check -r -s -m

- Create a release tag.

- Build and publish to PyPI::
- Make sure your Python has ``setuptools-git``, ``twine``, and ``wheel``
installed and release to PyPI::

$ python setup.py sdist bdist_wheel
$ twine upload dist/pyramid-X.X-*
Expand Down Expand Up @@ -133,6 +139,8 @@ Marketing and communications

- Edit `https://en.wikipedia.org/wiki/Pylons_project <https://en.wikipedia.org/wiki/Pylons_project>`_.

- Edit `https://en.wikipedia.org/wiki/Comparison_of_web_frameworks <https://en.wikipedia.org/wiki/Comparison_of_web_frameworks>`_.

- Announce to Twitter.

```
Expand Down
11 changes: 9 additions & 2 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ 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 text web pickle htmlhelp latex latexpdf changes linkcheck epub doctest
.PHONY: help clean html text web pickle htmlhelp latex latexpdf xelatexpdf changes linkcheck epub doctest

help:
@echo "Please use \`make <target>' where <target> is one of"
Expand All @@ -22,6 +22,7 @@ help:
@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 " xelatexpdf to make LaTeX files and run them through xelatex"
@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"
Expand All @@ -30,6 +31,12 @@ help:
clean:
-rm -rf $(BUILDDIR)/*

xelatexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through xelatex..."
$(MAKE) PDFLATEX=xelatex -C $(BUILDDIR)/latex all-pdf
@echo "xelatex finished; the PDF files are in $(BUILDDIR)/latex."

html:
mkdir -p $(BUILDDIR)/html $(BUILDDIR)/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
Expand Down Expand Up @@ -68,7 +75,7 @@ latex:
cp _static/latex-note.png $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make latexpdf' to build a PDF file from them."
@echo "Run \`make xelatexpdf' to build a PDF file from them."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
Expand Down
2 changes: 2 additions & 0 deletions docs/api/httpexceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

.. autoexception:: HTTPTemporaryRedirect

.. autoexception:: HTTPPermanentRedirect

.. autoexception:: HTTPBadRequest

.. autoexception:: HTTPUnauthorized
Expand Down
76 changes: 27 additions & 49 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def nothing(*arg):
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinxcontrib.autoprogram',
# enable pylons_sphinx_latesturl when this branch is no longer "latest"
Expand Down Expand Up @@ -124,9 +123,6 @@ def nothing(*arg):
# unit titles (such as .. function::).
add_module_names = False

# Add support for todo items
todo_include_todos = True

# The name of the Pygments (syntax highlighting) style to use.
#pygments_style = book and 'bw' or 'tango'
if book:
Expand Down Expand Up @@ -175,8 +171,6 @@ def nothing(*arg):

# Do not use smart quotes.
smartquotes = False
# Remove next line when RTD goes to Sphinx==1.6.6
html_use_smartypants = False

# Output file base name for HTML help builder.
htmlhelp_basename = 'pyramid'
Expand All @@ -190,7 +184,10 @@ def nothing(*arg):
# The font size ('10pt', '11pt' or '12pt').
latex_font_size = '10pt'

latex_additional_files = ['_static/latex-note.png', '_static/latex-warning.png']
latex_additional_files = [
'_static/latex-note.png',
'_static/latex-warning.png',
]

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class [howto/manual]).
Expand Down Expand Up @@ -220,6 +217,17 @@ def nothing(*arg):
_PREAMBLE = r"""
\usepackage[]{geometry}
\geometry{bindingoffset=0.45in,textheight=7.25in,hdivide={0.5in,*,0.75in},vdivide={1in,7.25in,1in},papersize={7.5in,9.25in}}
%XeLaTeX packages
\usepackage{xltxtra}
\usepackage{fontspec} %Font package
\usepackage{xunicode}
%Select fonts
\setmainfont[Mapping=tex-text]{nimbusserif}
\setsansfont[Mapping=tex-text]{nimbussans}
\setmonofont{nimbusmono}
\hypersetup{
colorlinks=true,
linkcolor=black,
Expand Down Expand Up @@ -276,28 +284,22 @@ def nothing(*arg):
\definecolor{VerbatimColor}{rgb}{1,1,1}
\definecolor{VerbatimBorderColor}{rgb}{1,1,1}
\makeatletter
\renewcommand{\py@noticestart@warning}{\py@heavybox}
\renewcommand{\py@noticeend@warning}{\py@endheavybox}
\renewcommand{\py@noticestart@note}{\py@heavybox}
\renewcommand{\py@noticeend@note}{\py@endheavybox}
\makeatother
% icons in note and warning boxes
\usepackage{ifthen}
% Keep a copy of the original notice environment
\let\origbeginnotice\notice
\let\origendnotice\endnotice
% Redefine the notice environment so we can add our own code to it
\renewenvironment{notice}[2]{%
\origbeginnotice{#1}{}% equivalent to original \begin{notice}{#1}{#2}
% Keep a copy of the original sphinxadmonition environment
\let\origbeginadmon\sphinxadmonition
\let\origendadmon\endsphinxadmonition
% Redefine the sphinxadmonition environment so we can add our own code to it
\renewenvironment{sphinxadmonition}[2]{%
\origbeginadmon{#1}{}% equivalent to original \begin{sphinxadmonition}{#1}{#2}
% load graphics
\ifthenelse{\equal{#1}{warning}}{\includegraphics{latex-warning.png}}{}
\ifthenelse{\equal{#1}{note}}{\includegraphics{latex-note.png}}{}
% etc.
}{%
\origendnotice% equivalent to original \end{notice}
}{%
\origendadmon % equivalent to original \end{sphinxadmonition}
}
% try to prevent code-block boxes from splitting across pages
Expand All @@ -318,7 +320,6 @@ def nothing(*arg):

latex_elements = {
'preamble': _PREAMBLE,
'wrapperclass': 'book',
'date': '',
'releasename': 'Version',
'title': r'The Pyramid Web Framework',
Expand All @@ -342,44 +343,21 @@ def frontmatter(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return [nodes.raw(
'',
r"""
\frontmatter
% prevent part/chapter/section numbering
\setcounter{secnumdepth}{-2}
% suppress headers
\pagestyle{plain}
% reset page counter
\setcounter{page}{1}
% suppress first toc pagenum
\addtocontents{toc}{\protect\thispagestyle{empty}}
""",
format='latex')]


def mainmatter(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return [nodes.raw(
'',
r"""
\mainmatter
% allow part/chapter/section numbering
\setcounter{secnumdepth}{2}
% get headers back
\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}
\fancyfoot[C]{\thepage}
\fancyhead[RO]{\rightmark}
\fancyhead[LE]{\leftmark}
""",
format='latex')]


def backmatter(name, arguments, options, content, lineno,
content_offset, block_text, state, state_machine):
return [nodes.raw('', '\\backmatter\n\\setcounter{secnumdepth}{-1}\n',
format='latex')]
return [nodes.raw(
'',
format='latex')]


def app_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
Expand Down
2 changes: 1 addition & 1 deletion docs/make_book
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
make clean latex SPHINXBUILD=../env/bin/sphinx-build BOOK=1
make clean xelatexpdf SPHINXBUILD=../env/bin/sphinx-build BOOK=1
cd _build/latex && make all-pdf

2 changes: 1 addition & 1 deletion docs/make_pdf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
make clean latex SPHINXBUILD=../env/bin/sphinx-build
make clean xelatexpdf SPHINXBUILD=../env/bin/sphinx-build
cd _build/latex && make all-pdf

2 changes: 1 addition & 1 deletion docs/narr/myproject/myproject/templates/layout.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Custom styles for this scaffold -->
<link href="{{request.static_url('myproject:static/theme.css')}}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
<script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
Expand Down
18 changes: 18 additions & 0 deletions docs/narr/urldispatch.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,24 @@ may be added in the future. For example:
config = Configurator()
config.include(users_include, route_prefix='/users')
A convenience context manager exists to set the route prefix for any
:meth:`pyramid.config.Configurator.add_route` or
:meth:`pyramid.config.Configurator.include` calls within the context.

.. code-block:: python
:linenos:
from pyramid.config import Configurator
def timing_include(config):
config.add_route('timing.show_times', '/times')
def main(global_config, **settings)
config = Configurator()
with config.route_prefix_context('/timing'):
config.include(timing_include)
config.add_route('timing.average', '/average')
.. index::
single: route predicates (custom)

Expand Down
1 change: 1 addition & 0 deletions docs/quick_tour.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ for those who want to evaluate Pyramid, whether you are new to Python web
frameworks, or a pro in a hurry. For more detailed treatment of each topic,
give the :ref:`quick_tutorial` a try.

If you would prefer to cut and paste the example code in this tour you may browse the source code located in the `Pyramid repository in the directory "docs/quick_tour" <https://github.com/Pylons/pyramid/>`. If you have downloaded the source code, you will find the tour in the same location.

Installation
============
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Custom styles for this scaffold -->
<link href="{{request.static_url('hello_world:static/theme.css')}}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
<script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Custom styles for this scaffold -->
<link href="{{request.static_url('hello_world:static/theme.css')}}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
<script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Custom styles for this scaffold -->
<link href="{{request.static_url('hello_world:static/theme.css')}}" rel="stylesheet">

<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- HTML5 shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js" integrity="sha384-0s5Pv64cNZJieYFkXYOTId2HMA2Lfb6q2nAcx2n0RTLUnCAoTTsS0nKEO27XyKcY" crossorigin="anonymous"></script>
<script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js" integrity="sha384-ZoaMbDF+4LeFxg6WdScQ9nnR1QC2MIRxA1O9KWEXQwns1G8UNyIEZIQidzb0T1fo" crossorigin="anonymous"></script>
Expand Down
Loading

0 comments on commit 0c8ca23

Please sign in to comment.