Permalink
Browse files

Merge branch 'master' into feature.instance-properties

  • Loading branch information...
2 parents a54b5e4 + 6b180cb commit 717537cdd6611511f783542034f00cf0099d515e @mmerickel mmerickel committed Aug 16, 2012
Showing with 2,932 additions and 1,280 deletions.
  1. +3 −0 .gitmodules
  2. +19 −0 .travis.yml
  3. +72 −1 CHANGES.txt
  4. +9 −1 CONTRIBUTORS.txt
  5. +33 −17 HACKING.txt
  6. +10 −2 TODO.txt
  7. +0 −1 docs/.gitignore
  8. +4 −2 docs/Makefile
  9. +1 −0 docs/_themes
  10. +3 −0 docs/api/config.rst
  11. +14 −0 docs/api/registry.rst
  12. +0 −2 docs/api/renderers.rst
  13. +7 −9 docs/conf.py
  14. +17 −95 docs/designdefense.rst
  15. +11 −5 docs/glossary.rst
  16. +3 −9 docs/index.rst
  17. +1 −1 docs/narr/advconfig.rst
  18. +9 −6 docs/narr/commandline.rst
  19. +2 −1 docs/narr/firstapp.rst
  20. +131 −3 docs/narr/hooks.rst
  21. +43 −6 docs/narr/introduction.rst
  22. +1 −1 docs/narr/introspector.rst
  23. +4 −3 docs/narr/logging.rst
  24. +7 −7 docs/narr/project.rst
  25. +46 −23 docs/narr/renderers.rst
  26. +6 −7 docs/narr/sessions.rst
  27. +7 −7 docs/narr/startup.rst
  28. +16 −0 docs/narr/templates.rst
  29. +4 −4 docs/narr/urldispatch.rst
  30. +10 −4 docs/tutorials/modwsgi/index.rst
  31. +48 −44 docs/tutorials/wiki/definingviews.rst
  32. +14 −5 docs/tutorials/wiki/design.rst
  33. +4 −3 docs/tutorials/wiki/installation.rst
  34. +1 −1 docs/tutorials/wiki2/authorization.rst
  35. +2 −2 docs/tutorials/wiki2/basiclayout.rst
  36. +51 −41 docs/tutorials/wiki2/definingviews.rst
  37. +13 −4 docs/tutorials/wiki2/design.rst
  38. +5 −5 docs/tutorials/wiki2/installation.rst
  39. +1 −1 docs/tutorials/wiki2/src/authorization/development.ini
  40. +1 −1 docs/tutorials/wiki2/src/authorization/production.ini
  41. +1 −1 docs/tutorials/wiki2/src/basiclayout/development.ini
  42. +1 −1 docs/tutorials/wiki2/src/basiclayout/production.ini
  43. +1 −1 docs/tutorials/wiki2/src/models/development.ini
  44. +1 −1 docs/tutorials/wiki2/src/models/production.ini
  45. +1 −1 docs/tutorials/wiki2/src/tests/development.ini
  46. +1 −1 docs/tutorials/wiki2/src/tests/production.ini
  47. +1 −1 docs/tutorials/wiki2/src/views/development.ini
  48. +1 −1 docs/tutorials/wiki2/src/views/production.ini
  49. +96 −63 pyramid/config/__init__.py
  50. +228 −0 pyramid/config/predicates.py
  51. +94 −15 pyramid/config/routes.py
  52. +20 −0 pyramid/config/security.py
  53. +11 −103 pyramid/config/tweens.py
  54. +231 −228 pyramid/config/util.py
  55. +279 −92 pyramid/config/views.py
  56. +28 −4 pyramid/events.py
  57. +9 −0 pyramid/interfaces.py
  58. +42 −13 pyramid/mako_templating.py
  59. +33 −0 pyramid/registry.py
  60. +90 −61 pyramid/renderers.py
  61. +1 −1 pyramid/scaffolds/alchemy/README.txt_tmpl
  62. +1 −1 pyramid/scaffolds/alchemy/development.ini_tmpl
  63. +1 −1 pyramid/scaffolds/alchemy/production.ini_tmpl
  64. +1 −1 pyramid/scaffolds/alchemy/setup.py_tmpl
  65. +1 −1 pyramid/scaffolds/starter/setup.py_tmpl
  66. +1 −1 pyramid/scaffolds/zodb/setup.py_tmpl
  67. +3 −3 pyramid/scripts/proutes.py
  68. +4 −4 pyramid/scripts/pviews.py
  69. +6 −6 pyramid/static.py
  70. +3 −0 pyramid/testing.py
  71. +3 −0 pyramid/tests/fixtures/components.mak
  72. +3 −0 pyramid/tests/fixtures/hellocompo.mak
  73. +35 −24 pyramid/tests/test_config/test_init.py
  74. +268 −0 pyramid/tests/test_config/test_predicates.py
  75. +1 −1 pyramid/tests/test_config/test_routes.py
  76. +9 −0 pyramid/tests/test_config/test_security.py
  77. +7 −39 pyramid/tests/test_config/test_tweens.py
  78. +338 −38 pyramid/tests/test_config/test_util.py
  79. +115 −11 pyramid/tests/test_config/test_views.py
  80. +51 −47 pyramid/tests/test_events.py
  81. +58 −18 pyramid/tests/test_mako_templating.py
  82. +8 −12 pyramid/tests/test_path.py
  83. +41 −11 pyramid/tests/test_renderers.py
  84. +29 −26 pyramid/tests/test_request.py
  85. +2 −0 pyramid/tests/test_response.py
  86. +12 −2 pyramid/tests/test_scaffolds/test_copydir.py
  87. +2 −2 pyramid/tests/test_scripts/test_pviews.py
  88. +31 −35 pyramid/tests/test_static.py
  89. +3 −0 pyramid/tests/test_testing.py
  90. +21 −6 pyramid/tests/test_url.py
  91. +8 −0 pyramid/tests/test_urldispatch.py
  92. +10 −9 pyramid/tests/test_view.py
  93. +7 −3 pyramid/url.py
  94. +3 −1 pyramid/urldispatch.py
  95. +1 −0 pyramid/util.py
  96. +18 −54 pyramid/view.py
  97. +1 −1 setup.cfg
  98. +14 −9 setup.py
  99. +9 −1 tox.ini
View
@@ -0,0 +1,3 @@
+[submodule "docs/_themes"]
+ path = docs/_themes
+ url = git://github.com/Pylons/pylons_sphinx_theme.git
View
@@ -0,0 +1,19 @@
+language: python
+
+python:
+ - 2.6
+ - 2.7
+ - pypy
+ - 3.2
+
+# Why does travis-ci's PyPy blow up? Pyramid's tests
+# run fine under tox.
+matrix:
+ allow_failures:
+ - python: pypy
+
+script: python setup.py test
+
+notifications:
+ email:
+ - pyramid-checkins@lists.repoze.org
View
@@ -9,23 +9,94 @@ Bug Fixes
return the empty list. This was incorrect, it should have unconditionally
returned ``[Everyone]``, and now does.
+- Explicit url dispatch regexes can now contain colons.
+ https://github.com/Pylons/pyramid/issues/629
+
+- On at least one 64-bit Ubuntu system under Python 3.2, using the
+ ``view_config`` decorator caused a ``RuntimeError: dictionary changed size
+ during iteration`` exception. It no longer does. See
+ https://github.com/Pylons/pyramid/issues/635 for more information.
+
+- In Mako Templates lookup, check if the uri is already adjusted and bring
+ it back to an asset spec. Normally occurs with inherited templates or
+ included components.
+ https://github.com/Pylons/pyramid/issues/606
+ https://github.com/Pylons/pyramid/issues/607
Features
--------
+- Third-party custom view and route predicates can now be added for use by
+ view authors via ``pyramid.config.Configurator.add_view_predicate`` and
+ ``pyramid.config.Configurator.add_route_predicate``. So, for example,
+ doing this::
+
+ config.add_view_predicate('abc', my.package.ABCPredicate)
+
+ Might allow a view author to do this in an application that configured that
+ predicate::
+
+ @view_config(abc=1)
+
+ See "Adding A Third Party View or Route Predicate" in the Hooks chapter for
+ more information.
+
+ Note that changes made to support the above feature now means that only
+ actions registered using the same "order" can conflict with one another.
+ It used to be the case that actions registered at different orders could
+ potentially conflict, but to my knowledge nothing ever depended on this
+ behavior (it was a bit silly).
+
- Custom objects can be made easily JSON-serializable in Pyramid by defining
a ``__json__`` method on the object's class. This method should return
values natively serializable by ``json.dumps`` (such as ints, lists,
dictionaries, strings, and so forth).
+- The JSON renderer now allows for the definition of custom type adapters to
+ convert unknown objects to JSON serializations.
+
- As of this release, the ``request_method`` predicate, when used, will also
imply that ``HEAD`` is implied when you use ``GET``. For example, using
``@view_config(request_method='GET')`` is equivalent to using
- ``@view_config(request_method='HEAD')``. Using
+ ``@view_config(request_method=('GET', 'HEAD'))``. Using
``@view_config(request_method=('GET', 'POST')`` is equivalent to using
``@view_config(request_method=('GET', 'HEAD', 'POST')``. This is because
HEAD is a variant of GET that omits the body, and WebOb has special support
to return an empty body when a HEAD is used.
- ``config.set_request_property`` now causes less code to be executed at
request construction time.
+
+- Don't add a ``?`` to URLs generated by request.resource_url if the
+ ``query`` argument is provided but empty.
+
+- Don't add a ``?`` to URLs generated by request.route_url if the
+ ``_query`` argument is provided but empty.
+
+- The static view machinery now raises (rather than returns) ``HTTPNotFound``
+ and ``HTTPMovedPermanently`` exceptions, so these can be caught by the
+ NotFound view (and other exception views).
+
+- The mako renderer now accepts a def name and returns the template def
+ result for the view being called. The uri format using an asset spec is
+ package:path/to/template#defname.mako. The old way of returning a tuple
+ from the view is supported for backward compatibility, ('defname', {}).
+
+- When there is a predicate mismatch exception (seen when no view matches for
+ a given request due to predicates not working), the exception now contains
+ a textual description of the predicate which didn't match.
+
+- An ``add_permission`` directive method was added to the Configurator. This
+ directive registers a free-standing permission introspectable into the
+ Pyramid introspection system. Frameworks built atop Pyramid can thus use
+ the the ``permissions`` introspectable category data to build a
+ comprehensive list of permissions supported by a running system. Before
+ this method was added, permissions were already registered in this
+ introspectable category as a side effect of naming them in an ``add_view``
+ call, this method just makes it possible to arrange for a permission to be
+ put into the ``permissions`` introspectable category without naming it
+ along with an associated view. Here's an example of usage of
+ ``add_permission``::
+
+ config = Configurator()
+ config.add_permission('view')
View
@@ -127,7 +127,7 @@ Contributors
- Wichert Akkerman, 2011/01/19
-- Christopher Lambacehr, 2011/02/12
+- Christopher Lambacher, 2011/02/12
- Malthe Borch, 2011/02/28
@@ -170,3 +170,11 @@ Contributors
- Steve Piercy, 2012/03/27
- Wayne Witzel III, 2012/03/27
+
+- Marin Rukavina, 2012/05/03
+
+- Marc Abramowitz, 2012/06/13
+
+- Jeff Cook, 2012/06/16
+
+- Roman Kozlovskyi, 2012/08/11
View
@@ -30,11 +30,13 @@ checkout.
$ env/bin/easy_install setuptools-git
- Install Pyramid from the checkout into the virtualenv using ``setup.py
- develop`` (running ``setup.py develop`` *must* be done while the current
- working directory is the ``pyramid`` checkout directory)::
+ dev``. ``setup.py dev`` is an alias for "setup.py develop" which also
+ installs testing requirements such as nose and coverage. Running
+ ``setup.py dev`` *must* be done while the current working directory is the
+ ``pyramid`` checkout directory::
$ cd pyramid
- $ ../env/bin/python setup.py develop
+ $ ../env/bin/python setup.py dev
- At that point, you should be able to create new Pyramid projects by using
``pcreate``::
@@ -85,6 +87,9 @@ Coding Style
2 newlines between classes. But 80-column lines, in particular, are
mandatory.
+- Please do not remove trailing whitespace. Configure your editor to reduce
+ diff noise.
+
Running Tests
--------------
@@ -110,26 +115,37 @@ Test Coverage
- The codebase *must* have 100% test statement coverage after each commit.
You can test coverage via ``tox -e coverage``, or alternately by installing
- ``nose`` and ``coverage`` into your virtualenv, and running ``setup.py
- nosetests --with-coverage``.
+ ``nose`` and ``coverage`` into your virtualenv (easiest via ``setup.py
+ dev``) , and running ``setup.py nosetests --with-coverage``.
+
+Documentation Coverage and Building HTML Documentation
+------------------------------------------------------
-Documentation Coverage
-----------------------
+If you fix a bug, and the bug requires an API or behavior modification, all
+documentation in this package which references that API or behavior must
+change to reflect the bug fix, ideally in the same commit that fixes the bug
+or adds the feature.
-- If you fix a bug, and the bug requires an API or behavior
- modification, all documentation in this package which references
- that API or behavior must change to reflect the bug fix, ideally in
- the same commit that fixes the bug or adds the feature.
+To build and review docs (where ``$yourvenv`` refers to the virtualenv you're
+using to develop Pyramid):
-- To build and review docs:
+1. Run ``$yourvenv/bin/python setup.py dev docs``. This will cause Sphinx
+ and all development requirements to be installed in your virtualenv.
- 1. Install ``tests_require`` dependencies from Pyramid's setup.py into your
- virtualenv.
+2. Update all git submodules from the top-level of your Pyramid checkout, like
+ so:
+ git submodule update --init --recursive
+ This will checkout theme subrepositories and prevent error conditions when
+ HTML docs are generated.
- 2. From the ``docs`` directory of the Pyramid checkout run ``make html
- SPHINXBUILD=/path/to/your/virtualenv/bin/sphinx-build``.
+3. cd to the ``docs`` directory within your Pyramid checkout and execute
+ ``make clean html SPHINXBUILD=$yourvenv/bin/sphinx-build``. The
+ ``SPHINXBUILD=...`` hair is there in order to tell it to use the
+ virtualenv Python, which will have both Sphinx and Pyramid (for API
+ documentation generation) installed.
- 3. Open the _build/html/index.html file to see the resulting rendering.
+4. Open the ``docs/_build/html/index.html`` file to see the resulting HTML
+ rendering.
Change Log
----------
View
@@ -4,6 +4,13 @@ Pyramid TODOs
Nice-to-Have
------------
+- config.set_registry_attr (with conflict detection).
+
+- _fix_registry should dictify the registry being fixed.
+
+- Provide the presumed renderer name to the called view as an attribute of
+ the request.
+
- Have action methods return their discriminators.
- Add docs about upgrading between Pyramid versions (e.g. how to see
@@ -64,8 +71,6 @@ Nice-to-Have
app1" and "domain app1.localhost = app1"), ProxyPreserveHost and the nginx
equivalent, preserving HTTPS URLs.
-- _fix_registry should dictify the registry being fixed.
-
- Make "localizer" a property of request (instead of requiring
"get_localizer(request)"?
@@ -123,6 +128,9 @@ Future
- 1.5: Remove ``pyramid.requests.DeprecatedRequestMethodsMixin``.
+- 1.5: Maybe? deprecate set_request_property in favor of pointing people at
+ set_request_method.
+
- 1.6: Remove IContextURL and TraversalContextURL.
Probably Bad Ideas
View
@@ -1,4 +1,3 @@
-_themes
_build
View
@@ -25,7 +25,7 @@ help:
clean:
-rm -rf _build/*
-html:
+html: _themes
mkdir -p _build/html _build/doctrees
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) _build/html
@echo
@@ -47,7 +47,7 @@ pickle:
web: pickle
-htmlhelp:
+htmlhelp: _themes
mkdir -p _build/htmlhelp _build/doctrees
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
@echo
@@ -84,3 +84,5 @@ epub:
@echo
@echo "Build finished. The epub file is in _build/epub."
+_themes:
+ git submodule update --init
Submodule _themes added at f59f7b
View
@@ -36,6 +36,7 @@
.. automethod:: set_authentication_policy
.. automethod:: set_authorization_policy
.. automethod:: set_default_permission
+ .. automethod:: add_permission
:methodcategory:`Setting Request Properties`
@@ -66,6 +67,8 @@
.. automethod:: add_response_adapter
.. automethod:: add_traverser
.. automethod:: add_tween
+ .. automethod:: add_route_predicate
+ .. automethod:: add_view_predicate
.. automethod:: set_request_factory
.. automethod:: set_root_factory
.. automethod:: set_session_factory
View
@@ -38,3 +38,17 @@
This class is new as of :app:`Pyramid` 1.3.
+.. autoclass:: Deferred
+
+ This class is new as of :app:`Pyramid` 1.4.
+
+.. autofunction:: undefer
+
+ This function is new as of :app:`Pyramid` 1.4.
+
+.. autoclass:: predvalseq
+
+ This class is new as of :app:`Pyramid` 1.4.
+
+
+
View
@@ -15,8 +15,6 @@
.. autoclass:: JSONP
-.. autoclass:: ObjectJSONEncoder
-
.. attribute:: null_renderer
An object that can be used in advanced integration cases as input to the
View
@@ -48,6 +48,7 @@ def nothing(*arg):
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'repoze.sphinx.autointerface',
+ 'sphinx.ext.viewcode',
# 'sphinx.ext.intersphinx'
]
@@ -132,18 +133,15 @@ def nothing(*arg):
from subprocess import call, Popen, PIPE
p = Popen('which git', shell=True, stdout=PIPE)
- git = p.stdout.read().strip()
+
cwd = os.getcwd()
_themes = os.path.join(cwd, '_themes')
-
- if not os.path.isdir(_themes):
- call([git, 'clone', 'git://github.com/Pylons/pylons_sphinx_theme.git',
- '_themes'])
+ p = Popen('which git', shell=True, stdout=PIPE)
+ git = p.stdout.read().strip()
+ if not os.listdir(_themes):
+ call([git, 'submodule', '--init'])
else:
- os.chdir(_themes)
- call([git, 'checkout', 'master'])
- call([git, 'pull'])
- os.chdir(cwd)
+ call([git, 'submodule', 'update'])
sys.path.append(os.path.abspath('_themes'))
Oops, something went wrong.

0 comments on commit 717537c

Please sign in to comment.