summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CHANGES.txt53
-rw-r--r--README.rst4
-rw-r--r--TODO.txt74
-rw-r--r--docs/conventions.rst2
-rw-r--r--docs/copyright.rst2
-rw-r--r--docs/designdefense.rst211
-rw-r--r--docs/index.rst6
-rw-r--r--docs/narr/MyProject/myproject/templates/mytemplate.pt172
-rw-r--r--docs/narr/MyProject/myproject/tests.py6
-rw-r--r--docs/narr/declarative.rst14
-rw-r--r--docs/narr/hooks.rst2
-rw-r--r--docs/narr/install.rst2
-rw-r--r--docs/narr/introduction.rst2
-rw-r--r--docs/narr/muchadoabouttraversal.rst87
-rw-r--r--docs/narr/project.rst11
-rw-r--r--docs/narr/renderers.rst51
-rw-r--r--docs/narr/resources.rst2
-rw-r--r--docs/narr/templates.rst4
-rw-r--r--docs/narr/testing.rst101
-rw-r--r--docs/narr/viewconfig.rst29
-rw-r--r--docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki/src/basiclayout/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki/src/models/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki2/src/authorization/tutorial/tests.py22
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki2/src/basiclayout/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki2/src/models/tutorial/tests.py6
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt19
-rw-r--r--docs/tutorials/wiki2/src/views/tutorial/tests.py20
-rw-r--r--pyramid/config.py37
-rw-r--r--pyramid/interfaces.py2
-rw-r--r--pyramid/paster_templates/alchemy/+package+/templates/model.pt_tmpl19
-rw-r--r--pyramid/paster_templates/alchemy/+package+/templates/root.pt_tmpl19
-rw-r--r--pyramid/paster_templates/pylons_basic/+package+/templates/mytemplate.mako_tmpl19
-rw-r--r--pyramid/paster_templates/pylons_basic/+package+/tests.py_tmpl7
-rw-r--r--pyramid/paster_templates/pylons_minimal/+package+/templates/mytemplate.mako_tmpl19
-rw-r--r--pyramid/paster_templates/pylons_minimal/+package+/tests.py_tmpl7
-rw-r--r--pyramid/paster_templates/pylons_sqla/+package+/templates/mytemplate.mako_tmpl19
-rw-r--r--pyramid/paster_templates/pylons_sqla/+package+/tests.py_tmpl8
-rw-r--r--pyramid/paster_templates/routesalchemy/+package+/templates/mytemplate.pt_tmpl19
-rw-r--r--pyramid/paster_templates/routesalchemy/+package+/tests.py_tmpl5
-rw-r--r--pyramid/paster_templates/starter/+package+/templates/mytemplate.pt_tmpl19
-rw-r--r--pyramid/paster_templates/starter/+package+/tests.py_tmpl6
-rw-r--r--pyramid/paster_templates/starter_zcml/+package+/templates/mytemplate.pt_tmpl19
-rw-r--r--pyramid/paster_templates/starter_zcml/+package+/tests.py_tmpl6
-rw-r--r--pyramid/paster_templates/zodb/+package+/templates/mytemplate.pt_tmpl19
-rw-r--r--pyramid/paster_templates/zodb/+package+/tests.py_tmpl6
-rw-r--r--pyramid/testing.py22
-rw-r--r--pyramid/tests/test_urldispatch.py11
-rw-r--r--pyramid/traversal.py33
-rw-r--r--pyramid/url.py13
-rw-r--r--pyramid/urldispatch.py3
-rw-r--r--setup.py4
59 files changed, 790 insertions, 605 deletions
diff --git a/.gitignore b/.gitignore
index 562abec68..110da816f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
*$py.class
*.pt.py
*.txt.py
+*~
.coverage
tutorial.db
env26/
diff --git a/CHANGES.txt b/CHANGES.txt
index b24b3d779..fc1a53dd7 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,56 @@
+Next release
+============
+
+Bug Fixes
+---------
+
+- URL Dispatch properly handles a '.*' or '*' appearing in a regex match
+ when used inside brackets. Resolve Issue #90.
+
+Features
+--------
+
+- ``pyramid.testing.setUp`` and ``pyramid.testing.tearDown`` have been
+ undeprecated. They are now the canonical setup and teardown APIs for test
+ configuration, replacing "direct" creation of a Configurator. This is a
+ change designed to provide a facade that will protect against any future
+ Configurator deprecations.
+
+- Add ``charset`` attribute to ``pyramid.testing.DummyRequest``
+ (unconditionally ``UTF-8``).
+
+Paster Templates
+----------------
+
+- All paster templates now use ``pyramid.testing.setUp`` and
+ ``pyramid.testing.tearDown`` rather than creating a Configurator "by hand"
+ within their ``tests.py`` module, as per decision in features above.
+
+Documentation
+-------------
+
+- The wiki and wiki2 tutorials now use ``pyramid.testing.setUp`` and
+ ``pyramid.testing.tearDown`` rather than creating a Configurator "by hand",
+ as per decision in features above.
+
+- The "Testing" narrative chapter now explains ``pyramid.testing.setUp`` and
+ ``pyramid.testing.tearDown`` instead of Configurator creation and
+ ``Configurator.begin()`` and ``Configurator.end()``.
+
+- Document the ``request.override_renderer`` attribute within the narrative
+ "Renderers" chapter in a section named "Overriding A Renderer at Runtime".
+
+Deprecations
+------------
+
+- Deprecation warnings related to import of the following API functions were
+ added: ``pyramid.traversal.find_model``, ``pyramid.traversal.model_path``,
+ ``pyramid.traversal.model_path_tuple``, ``pyramid.url.model_url``. The
+ instructions emitted by the deprecation warnings instruct the developer to
+ change these method spellings to their ``resource`` equivalents. This is a
+ consequence of the mass concept rename of "model" to "resource" performed
+ in 1.0a7.
+
1.0a9 (2011-01-08)
==================
diff --git a/README.rst b/README.rst
index 220dcbe73..acacd2422 100644
--- a/README.rst
+++ b/README.rst
@@ -5,7 +5,7 @@ Pyramid is a small, fast, down-to-earth, open source Python web development
framework. It makes real-world web application development and deployment
more fun, more predictable, and more productive.
-Pyramid is a `Pylons <http://docs.pylonshq.com/>`_ project, and underlies the
+Pyramid is a `Pylons <http://docs.pylonsproject.org/>`_ project, and underlies the
newest web frameworks produced by the Pylons community.
Pyramid was previously known as `repoze.bfg <http://bfg.repoze.org>`_.
@@ -13,7 +13,7 @@ Pyramid was previously known as `repoze.bfg <http://bfg.repoze.org>`_.
Support and Documentation
-------------------------
-See the `Pylons Project website <http://docs.pylonshq.com/>`_ to view
+See the `Pylons Project website <http://docs.pylonsproject.org/>`_ to view
documentation, report bugs, and obtain support.
License
diff --git a/TODO.txt b/TODO.txt
index 81c571682..d055a8bd8 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -6,31 +6,67 @@ Must-Have (before 1.0)
- Write a "Whats New" (delta from BFG 1.3)
-- Consider deprecations for ``model`` and ``resource`` APIs.
+- API docs for ``pyramid.views.action``. (also, @action decorator uses
+ ``name`` for the method name; consider whether this will be confused with
+ ``name`` of ``view_config`` which means something else)
-- Re-make testing.setUp() and testing.tearDown() the canonical APIs for test
- configuration.
-
-- API docs for ``pyramid.views.action``.
+- Add docs for ``__action_decorator__`` attr of handler.
- Use a commit veto when configuring repoze.tm2 in paster templates for
non-1X, 2X, or 3X responses.
-- Consider passing two callables to CallbackAuthenticationPolicy: one for
- validating/obtaining the userid, the other for returning groups.
+- Figure out how to slim the herd of paster templates. Related:
+ https://github.com/Pylons/pyramid/issues#issue/40,
+ https://github.com/Pylons/pyramid/issues#issue/42,
+ https://github.com/Pylons/pyramid/issues#issue/44,
+ https://github.com/Pylons/pyramid/issues#issue/94
+, https://github.com/Pylons/pyramid/issues#issue/95
-- Add docs for ``__action_decorator__`` attr of handler.
+- Explain how to use i18n localization in Mako and Jinja2.
+
+- Turn Forbidden status code into a 403 (it's currently a 401, which is for
+ bw compat, but is misleading).
+
+- Fix too-long template lines in tutorials for PDF renderings.
+
+- Bug in URL dispatch pattern matching:
+ https://github.com/Pylons/pyramid/issues#issue/90
+
+- Allow ``pyramid.security.remember`` to accept a list of tokens for use when
+ there's an ``auth_tkt`` authentication policy:
+ https://github.com/Pylons/pyramid/issues#issue/81 and
+ https://github.com/Pylons/pyramid/issues#issue/78
+
+- Add docs for ``route_path`` and ``route_url``, etc to Request API docs (see
+ also https://github.com/Pylons/pyramid/issues#issue/19).
-- Document the ``request.override_renderer`` attribute.
+- Deprecate ``@bfg_view``.
+
+- Reversing (context, request) in function view callable arglist produces
+ incomprehensible traceback::
+
+ def aview(request, context):
+ return {}
+
+ if __name__ == '__main__':
+ from pyramid.config import Configurator
+ from paste.httpserver import serve
+ c = Configurator()
+ c.add_view(aview, renderer='__main__:foo.pt')
+ serve(c.make_wsgi_app())
+
+ File "/home/chrism/projects/pyramid/pyramid/config.py", line 2981, in map_nonclass
+ ronly = requestonly(view, self.attr)
+ File "/home/chrism/projects/pyramid/pyramid/config.py", line 3071, in requestonly
+ if len(args) - len(defaults) == 1:
+ zope.configuration.config.ConfigurationExecutionError: <type 'exceptions.TypeError'>: object of type 'NoneType' has no len() in:
+ ('reversed.py', 14, '<module>', "c.add_view(aview, renderer='__main__:foo.pt')")
Should-Have
-----------
-- Add a session attribute to DummyRequest.
-
-- Convert paster template and tutorial HTML templates to use
- ``request.static_url('{{package}}:static/foo.css')`` rather than
- ``${request.application_url}/static/foo.css``.
+- Consider adding a default exception view for HTTPException and attendant
+ ``redirect`` and ``abort`` functions ala Pylons.
- Add notes about renderer response attrs to request docs.
@@ -50,6 +86,12 @@ Should-Have
- Provide a response_set_cookie method on the request for rendered responses
that can be used as input to response.set_cookie?
+- Make it possible to get at ACLDenied data from Forbidden response in
+ exceptionview.
+
+- ``config.meta`` or ``config.extend`` classmethod which adds a new method
+ ("directive") to the Configurator class.
+
Nice-to-Have
------------
@@ -115,3 +157,7 @@ Nice-to-Have
- Add functionality that mocks the behavior of ``repoze.browserid``.
+- Consider implementing the API outlined in
+ http://plope.com/pyramid_auth_design_api_postmortem, phasing out the
+ current auth-n-auth abstractions in a backwards compatible way.
+
diff --git a/docs/conventions.rst b/docs/conventions.rst
index 71c40e104..9e8510e4d 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 <http://pylonshq.com>`_
+ `Pylons <http://pylonsproject.org>`_
References to sections and chapters are presented using the following
style:
diff --git a/docs/copyright.rst b/docs/copyright.rst
index 9ef093d0c..aa4efc6cb 100644
--- a/docs/copyright.rst
+++ b/docs/copyright.rst
@@ -88,7 +88,7 @@ HTML Version and Source Code
----------------------------
An HTML version of this book is freely available via
-http://docs.pylonshq.com
+http://docs.pylonsproject.org
The source code for the examples used in this book are available
within the :app:`Pyramid` software distribution, always available
diff --git a/docs/designdefense.rst b/docs/designdefense.rst
index df14fb440..594d42b9e 100644
--- a/docs/designdefense.rst
+++ b/docs/designdefense.rst
@@ -541,14 +541,18 @@ Pyramid Does Traversal, And I Don't Like Traversal
In :app:`Pyramid`, :term:`traversal` is the act of resolving a URL path to a
:term:`resource` object in a resource tree. Some people are uncomfortable
-with this notion, and believe it is wrong.
-
-This is understandable. The people who believe it is wrong almost invariably
-have all of their data in a relational database. Relational databases aren't
+with this notion, and believe it is wrong. Thankfully, if you use
+:app:`Pyramid`, and you don't want to model your application in terms of a
+resource tree, you needn't use it at all. Instead, use :term:`URL dispatch`
+to map URL paths to views.
+
+The idea that some folks believe traversal is unilaterally "wrong" is
+understandable. The people who believe it is wrong almost invariably have
+all of their data in a relational database. Relational databases aren't
naturally hierarchical, so "traversing" one like a tree is not possible.
-Folks who deem traversal unilaterally "wrong" are neglecting to take into
-account that many persistence mechanisms *are* hierarchical. Examples
+However, folks who deem traversal unilaterally wrong are neglecting to take
+into account that many persistence mechanisms *are* hierarchical. Examples
include a filesystem, an LDAP database, a :term:`ZODB` (or another type of
graph) database, an XML document, and the Python module namespace. It is
often convenient to model the frontend to a hierarchical data store as a
@@ -566,28 +570,32 @@ resource tree is an excellent way to model this, even if the backend is a
relational database. In this situation, the resource tree a just a site
structure.
-But the point is ultimately moot. If you use :app:`Pyramid`, and you don't
-want to model your application in terms of a resource tree, you needn't use
-it at all. Instead, use :term:`URL dispatch` to map URL paths to views.
+Traversal also offers better composability of applications than URL dispatch,
+because it doesn't rely on a fixed ordering of URL matching. You can compose
+a set of disparate functionality (and add to it later) around a mapping of
+view to resource more predictably than trying to get "the right" ordering of
+URL pattern matching.
+
+But the point is ultimately moot. If you don't want to use traversal, you
+needn't. Use URL dispatch instead.
Pyramid Does URL Dispatch, And I Don't Like URL Dispatch
--------------------------------------------------------
-In :app:`Pyramid`, :term:`url dispatch` is the act of resolving a
-URL path to a :term:`view` callable by performing pattern matching
-against some set of ordered route definitions. The route definitions
-are examined in order: the first pattern which matches is used to
-associate the URL with a view callable.
-
-Some people are uncomfortable with this notion, and believe it is
-wrong. These are usually people who are steeped deeply in
-:term:`Zope`. Zope does not provide any mechanism except
-:term:`traversal` to map code to URLs. This is mainly because Zope
-effectively requires use of :term:`ZODB`, which is a hierarchical
-object store. Zope also supports relational databases, but typically
-the code that calls into the database lives somewhere in the ZODB
-object graph (or at least is a :term:`view` related to a node in the
-object graph), and traversal is required to reach this code.
+In :app:`Pyramid`, :term:`url dispatch` is the act of resolving a URL path to
+a :term:`view` callable by performing pattern matching against some set of
+ordered route definitions. The route definitions are examined in order: the
+first pattern which matches is used to associate the URL with a view
+callable.
+
+Some people are uncomfortable with this notion, and believe it is wrong.
+These are usually people who are steeped deeply in :term:`Zope`. Zope does
+not provide any mechanism except :term:`traversal` to map code to URLs. This
+is mainly because Zope effectively requires use of :term:`ZODB`, which is a
+hierarchical object store. Zope also supports relational databases, but
+typically the code that calls into the database lives somewhere in the ZODB
+object graph (or at least is a :term:`view` related to a node in the object
+graph), and traversal is required to reach this code.
I'll argue that URL dispatch is ultimately useful, even if you want to use
traversal as well. You can actually *combine* URL dispatch and traversal in
@@ -604,20 +612,19 @@ present them with the default object view. There are other tricks you can
pull in these hybrid configurations if you're clever (and maybe masochistic)
too.
-Also, if you are a URL dispatch hater, if you should ever be asked to
-write an application that must use some legacy relational database
-structure, you might find that using URL dispatch comes in handy for
-one-off associations between views and URL paths. Sometimes it's just
-pointless to add a node to the object graph that effectively
-represents the entry point for some bit of code. You can just use a
-route and be done with it. If a route matches, a view associated with
-the route will be called; if no route matches, :app:`Pyramid` falls
-back to using traversal.
-
-But the point is ultimately moot. If you use :app:`Pyramid`, and
-you really don't want to use URL dispatch, you needn't use it at all.
-Instead, use :term:`traversal` exclusively to map URL paths to views,
-just like you do in :term:`Zope`.
+Also, if you are a URL dispatch hater, if you should ever be asked to write
+an application that must use some legacy relational database structure, you
+might find that using URL dispatch comes in handy for one-off associations
+between views and URL paths. Sometimes it's just pointless to add a node to
+the object graph that effectively represents the entry point for some bit of
+code. You can just use a route and be done with it. If a route matches, a
+view associated with the route will be called; if no route matches,
+:app:`Pyramid` falls back to using traversal.
+
+But the point is ultimately moot. If you use :app:`Pyramid`, and you really
+don't want to use URL dispatch, you needn't use it at all. Instead, use
+:term:`traversal` exclusively to map URL paths to views, just like you do in
+:term:`Zope`.
Pyramid Views Do Not Accept Arbitrary Keyword Arguments
-------------------------------------------------------
@@ -649,40 +656,24 @@ arguments to any method of a resource object found via traversal:
def aview(self, a, b, c=None):
return '%s %s %c' % (a, b, c)
-When this method is called as the result of being the published
-callable, the Zope request object's GET and POST namespaces are
-searched for keys which match the names of the positional and keyword
-arguments in the request, and the method is called (if possible) with
-its argument list filled with values mentioned therein. TurboGears
-and Pylons 1.X operate similarly.
-
-:app:`Pyramid` has neither of these features. :mod:`pyramid`
-view callables always accept only ``context`` and ``request`` (or just
-``request``), and no other arguments. The rationale: this argument
-specification matching done aggressively can be costly, and
-:app:`Pyramid` has performance as one of its main goals, so we've
-decided to make people obtain information by interrogating the request
-object for it in the view body instead of providing magic to do
-unpacking into the view argument list. The feature itself also just
-seems a bit like a gimmick. Getting the arguments you want explicitly
-from the request via getitem is not really very hard; it's certainly
-never a bottleneck for the author when he writes web apps.
-
-It is possible to replicate the Zope-like behavior in a view callable
-decorator, however, should you badly want something like it back. No
-such decorator currently exists. If you'd like to create one, Google
-for "zope mapply" and adapt the function you'll find to a decorator
-that pulls the argument mapping information out of the
-``request.params`` dictionary.
-
-A similar feature could be implemented to provide the Django-like
-behavior as a decorator by wrapping the view with a decorator that
-looks in ``request.matchdict``.
-
-It's possible at some point that :app:`Pyramid` will grow some form
-of argument matching feature (it would be simple to make it an
-always-on optional feature that has no cost unless you actually use
-it) for, but currently it has none.
+When this method is called as the result of being the published callable, the
+Zope request object's GET and POST namespaces are searched for keys which
+match the names of the positional and keyword arguments in the request, and
+the method is called (if possible) with its argument list filled with values
+mentioned therein. TurboGears and Pylons 1.X operate similarly.
+
+Out of the box, :app:`Pyramid` is configured to have none of these features.
+By default, :mod:`pyramid` view callables always accept only ``reqest`` and
+no other arguments. The rationale: this argument specification matching done
+aggressively can be costly, and :app:`Pyramid` has performance as one of its
+main goals, so we've decided to make people, by default, obtain information
+by interrogating the request object within the view callable body instead of
+providing magic to do unpacking into the view argument list.
+
+However, as of :app:`Pyramid` 1.0a9, user code can influence the way view
+callables are expected to be called, making it possible to compose a system
+out of view callables which are called with arbitrary arguments. See
+:ref:`using_a_view_mapper`.
Pyramid Provides Too Few "Rails"
--------------------------------
@@ -700,32 +691,54 @@ built using :app:`Pyramid` as a base. See also :ref:`apps_are_extensible`.
Pyramid Provides Too Many "Rails"
---------------------------------
-:app:`Pyramid` provides some features that other web frameworks do
-not. Most notably it has machinery which resolves a URL first to a
-:term:`context` before calling a view (which has the capability to
-accept the context in its argument list), and a declarative
-authorization system that makes use of this feature. Most other web
-frameworks besides :term:`Zope`, from which the pattern was stolen,
-have no equivalent core feature.
-
-We consider this an important feature for a particular class of
-applications (CMS-style applications, which the authors are often
-commissioned to write) that usually use :term:`traversal` against a
-persistent object graph. The object graph contains security
-declarations as :term:`ACL` objects.
-
-Having context-sensitive declarative security for individual objects
-in the object graph is simply required for this class of application.
-Other frameworks save for Zope just do not have this feature. This is
-one of the primary reasons that :app:`Pyramid` was actually
-written.
-
-If you don't like this, it doesn't mean you can't use
-:app:`Pyramid`. Just ignore this feature and avoid configuring an
-authorization or authentication policy and using ACLs. You can build
-"Pylons-1.X-style" applications using :app:`Pyramid` that use their own
-security model via decorators or plain-old-imperative logic in view
-code.
+:app:`Pyramid` provides some features that other web frameworks do not.
+These are features meant for use cases that might not make sense to you if
+you're building a simple "bespoke" web application:
+
+- An optional way to map URLs to code using :term:`traversal` which implies a
+ walk of a :term:`resource tree`.
+
+- The ability to aggregate Pyramid application configuration from multiple
+ sources using :meth:`pyramid.config.Configurator.include`.
+
+- View and subscriber registrations made using :term:`interface` objects
+ instead of class objects (e.g. :ref:`using_resource_interfaces`).
+
+- A declarative :term:`authorization` system.
+
+- Multiple separate I18N :term:`translation string` factories, each of which
+ can name its own "domain".
+
+These features are important to the authors of :app:`Pyramid`. The
+:app:`Pyramid` authors are often commissioned to build CMS-style
+applications. Such applications are often "frameworky" because they have
+more than one deployment. Each deployment requires a slightly different
+composition of sub-applications, and the framework and sub-applications often
+need to be *extensible*. Because the application has more than one
+deployment, pluggability and extensibility is important, as maintaining
+multiple forks of the application, one per deployment, is extremely
+undesirable. Because it's easier to extend a system that uses
+:term:`traversal` "from the outside" than it is to do the same in a system
+that uses :term:`URL dispatch`, each deployment uses a :term:`resource tree`
+composed of a persistent tree of domain model objects, and uses
+:term:`traversal` to map :term:`view callable` code to resources in the tree.
+The resource tree contains very granular security declarations, as resources
+are owned and accessible by different sets of users. Interfaces are used to
+make unit testing and implementation substitutability easier.
+
+In a bespoke web application, usually there's a single canonical deployment,
+and therefore no possibility of multiple code forks. Extensibility is not
+required; the code is just changed in-place. Security requirements are often
+less granular. Using the features listed above will often be overkill for
+such an application.
+
+If you don't like these features, it doesn't mean you can't or shouldn't use
+:app:`Pyramid`. They are all optional, and a lot of time has been spent
+making sure you don't need to know about them up-front. You can build
+"Pylons-1.X-style" applications using :app:`Pyramid` that are purely bespoke
+by ignoring the features above. You may find these features handy later
+after building a "bespoke" web application that suddenly becomes popular and
+requires extensibility because it must be deployed in multiple locations.
Pyramid Is Too Big
------------------
@@ -1459,7 +1472,7 @@ global*:
# this is executed if the request method was GET or the
# credentials were invalid
-The `Pylons 1.X <http://pylonshq.com>`_ web framework uses a similar
+The `Pylons 1.X <http://pylonsproject.org>`_ 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.
diff --git a/docs/index.rst b/docs/index.rst
index 7b1c46b70..0dc476e46 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -6,7 +6,7 @@ The Pyramid Web Application Development Framework
:app:`Pyramid` is a small, fast, down-to-earth Python web application
development framework. It is developed as part of the `Pylons Project
-<http://docs.pylonshq.com/>`_. It is licensed under a `BSD-like license
+<http://docs.pylonsproject.org/>`_. It is licensed under a `BSD-like license
<http://repoze.org/license.html>`_.
.. note::
@@ -175,7 +175,7 @@ commenting, and file uploads. See the `KARL site
Support and Development
=======================
-The `Pylons Project web site <http://docs.pylonshq.com/>`_ is the main online
+The `Pylons Project web site <http://pylonsproject.org/>`_ is the main online
source of :app:`Pyramid` support and development information.
To report bugs, use the `issue tracker
@@ -196,7 +196,7 @@ To check out the trunk via ``git``, use this command:
To find out how to become a contributor to :app:`Pyramid`, please see the
`contributor's section of the documentation
-<http://docs.pylonshq.com/index.html#contributing>`_.
+<http://docs.pylonsproject.org/index.html#contributing>`_.
Index and Glossary
==================
diff --git a/docs/narr/MyProject/myproject/templates/mytemplate.pt b/docs/narr/MyProject/myproject/templates/mytemplate.pt
index 02fc00eeb..0bfea9d53 100644
--- a/docs/narr/MyProject/myproject/templates/mytemplate.pt
+++ b/docs/narr/MyProject/myproject/templates/mytemplate.pt
@@ -1,76 +1,106 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" xmlns:tal="http://xml.zope.org/namespaces/tal">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xml:lang="en"
+ xmlns:tal="http://xml.zope.org/namespaces/tal">
<head>
- <title>The Pyramid Web Application Development Framework</title>
- <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
- <meta name="keywords" content="python web application" />
- <meta name="description" content="pyramid web application" />
- <link rel="shortcut icon" href="${request.application_url}/static/favicon.ico" />
- <link rel="stylesheet" href="${request.application_url}/static/pylons.css" type="text/css" media="screen" charset="utf-8" />
- <link href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" rel="stylesheet" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <!--[if lte IE 6]>
- <link rel="stylesheet" href="${request.application_url}/static/ie6.css" type="text/css" media="screen" charset="utf-8" />
- <![endif]-->
+ <title>The Pyramid Web Application Development Framework</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+ <meta name="keywords" content="python web application" />
+ <meta name="description" content="pyramid web application" />
+ <link rel="shortcut icon"
+ href="${request.static_url('myproject:static/favicon.ico')}" />
+ <link rel="stylesheet"
+ href="${request.static_url('myproject:static/pylons.css')}"
+ type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet"
+ href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin"
+ type="text/css" media="screen" charset="utf-8" />
+ <!--[if lte IE 6]>
+ <link rel="stylesheet"
+ href="${request.static_url('myproject:static/ie6.css')}"
+ type="text/css" media="screen" charset="utf-8" />
+ <![endif]-->
</head>
<body>
- <div id="wrap">
- <div id="top">
- <div class="top align-center">
- <div><img src="${request.application_url}/static/pyramid.png" width="750" height="169" alt="pyramid"/></div>
- </div>
- </div>
- <div id="middle">
- <div class="middle align-center">
- <p class="app-welcome">
- Welcome to <span class="app-name">${project}</span>, an application generated by<br/>
- the Pyramid web application development framework.
- </p>
- </div>
- </div>
- <div id="bottom">
- <div class="bottom">
- <div id="left" class="align-right">
- <h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
- <input type="text" id="q" name="q" value="" />
- <input type="submit" id="x" value="Go" />
- </form>
- </div>
- <div id="right" class="align-left">
- <h2>Pyramid links</h2>
- <ul class="links">
- <li>
- <a href="http://pylonshq.com">Pylons Website</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
- </li>
- <li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
- </li>
- <li>
- <a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- <div id="footer">
- <div class="footer">© Copyright 2008-2010, Agendaless Consulting.</div>
- </div>
+ <div id="wrap">
+ <div id="top">
+ <div class="top align-center">
+ <div>
+ <img src="${request.static_url('myproject:static/pyramid.png')}"
+ width="750" height="169" alt="pyramid"/>
+ </div>
+ </div>
+ </div>
+ <div id="middle">
+ <div class="middle align-center">
+ <p class="app-welcome">
+ Welcome to <span class="app-name">${project}</span>,
+ an application generated by<br/>
+ the Pyramid web application development framework.
+ </p>
+ </div>
+ </div>
+ <div id="bottom">
+ <div class="bottom">
+ <div id="left" class="align-right">
+ <h2>Search documentation</h2>
+ <form method="get"
+ action="http://docs.pylonsproject.org/pyramid/dev/search.html">
+ <input type="text" id="q" name="q" value="" />
+ <input type="submit" id="x" value="Go" />
+ </form>
+ </div>
+ <div id="right" class="align-left">
+ <h2>Pyramid links</h2>
+ <ul class="links">
+ <li>
+ <a href="http://pylonsproject.org">
+ Pylons Website
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">
+ Narrative Documentation
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">
+ API Documentation
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">
+ Tutorials
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">
+ Change History
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">
+ Sample Applications
+ </a>
+ </li>
+ <li>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">
+ Support and Development
+ </a>
+ </li>
+ <li>
+ <a href="irc://irc.freenode.net#pyramid">
+ IRC Channel
+ </a>
+ </li>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div id="footer">
+ <div class="footer">© Copyright 2008-2010, Agendaless Consulting.</div>
+ </div>
</body>
</html> \ No newline at end of file
diff --git a/docs/narr/MyProject/myproject/tests.py b/docs/narr/MyProject/myproject/tests.py
index b14fb37af..5fa710278 100644
--- a/docs/narr/MyProject/myproject/tests.py
+++ b/docs/narr/MyProject/myproject/tests.py
@@ -1,15 +1,13 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from myproject.views import my_view
diff --git a/docs/narr/declarative.rst b/docs/narr/declarative.rst
index f36e55b29..5c731ab06 100644
--- a/docs/narr/declarative.rst
+++ b/docs/narr/declarative.rst
@@ -1068,15 +1068,15 @@ See :ref:`aclauthorizationpolicy_directive` for detailed information.
.. _zcml_adding_and_overriding_renderers:
-Adding and Overriding Renderers via ZCML
-----------------------------------------
+Adding and Changing Renderers via ZCML
+--------------------------------------
New templating systems and serializers can be associated with :app:`Pyramid`
renderer names. To this end, configuration declarations can be made which
-override an existing :term:`renderer factory` and which add a new renderer
+change an existing :term:`renderer factory` and which add a new renderer
factory.
-Adding or overriding a renderer via ZCML is accomplished via the
+Adding or changing an existing renderer via ZCML is accomplished via the
:ref:`renderer_directive` ZCML directive.
For example, to add a renderer which renders views which have a
@@ -1163,7 +1163,7 @@ with ``.jinja2`` as its ``renderer`` value. The ``name`` passed to the
See also :ref:`renderer_directive` and
:meth:`pyramid.config.Configurator.add_renderer`.
-Overriding an Existing Renderer
+Changing an Existing Renderer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can associate more than one filename extension with the same
@@ -1184,7 +1184,7 @@ After you do this, :app:`Pyramid` will treat templates ending in
both the ``.pt`` and ``.zpt`` filename extensions as Chameleon ZPT
templates.
-To override the default mapping in which files with a ``.pt``
+To change the default mapping in which files with a ``.pt``
extension are rendered via a Chameleon ZPT page template renderer, use
a variation on the following in your application's ZCML:
@@ -1200,7 +1200,7 @@ After you do this, the :term:`renderer factory` in
``my.package.pt_renderer`` will be used to render templates which end
in ``.pt``, replacing the default Chameleon ZPT renderer.
-To override the default mapping in which files with a ``.txt``
+To ochange the default mapping in which files with a ``.txt``
extension are rendered via a Chameleon text template renderer, use a
variation on the following in your application's ZCML:
diff --git a/docs/narr/hooks.rst b/docs/narr/hooks.rst
index cf3f56e87..c12a5abb4 100644
--- a/docs/narr/hooks.rst
+++ b/docs/narr/hooks.rst
@@ -543,6 +543,8 @@ The default context URL generator is available for perusal as the class
.. index::
single: view mapper
+.. _using_a_view_mapper:
+
Using a View Mapper
-------------------
diff --git a/docs/narr/install.rst b/docs/narr/install.rst
index e32d0c6c3..c5ec14aa1 100644
--- a/docs/narr/install.rst
+++ b/docs/narr/install.rst
@@ -295,7 +295,7 @@ Installing :app:`Pyramid` on a Windows System
c:\> cd env
-#. (Optional) Consider using ``bin\activate.bat`` to make your shell
+#. (Optional) Consider using ``Scripts\activate.bat`` to make your shell
environment wired to use the virtualenv.
#. Use ``easy_install`` pointed at the "current" index to get
diff --git a/docs/narr/introduction.rst b/docs/narr/introduction.rst
index c61ef21d4..2da75df39 100644
--- a/docs/narr/introduction.rst
+++ b/docs/narr/introduction.rst
@@ -104,7 +104,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 <http://docs.pylonshq.com>`_
+contributors. The `Pylons Project website <http://docs.pylonsproject.org>`_
includes details about how :app:`Pyramid` relates to the Pylons Project.
.. index::
diff --git a/docs/narr/muchadoabouttraversal.rst b/docs/narr/muchadoabouttraversal.rst
index bc1b48462..c57e58cd0 100644
--- a/docs/narr/muchadoabouttraversal.rst
+++ b/docs/narr/muchadoabouttraversal.rst
@@ -43,12 +43,12 @@ ever used a run-of-the-mill file system with folders and files.
URL Dispatch
------------
-Let's step back and consider the problem we're trying to solve, which is
-simple. An HTTP request for a particular path has been routed to our web
-application. The requested path will possibly invoke a specific :term:`view
-callable` function defined somewhere in our app. We're trying to determine
-*which* callable function, if any, should be invoked for a given requested
-URL.
+Let's step back and consider the problem we're trying to solve. An
+HTTP request for a particular path has been routed to our web
+application. The requested path will possibly invoke a specific
+:term:`view callable` function defined somewhere in our app. We're
+trying to determine *which* callable function, if any, should be
+invoked for a given requested URL.
Many systems, including Pyramid, offer a simple solution. They offer the
concept of "URL matching". URL matching approaches this problem by parsing
@@ -59,10 +59,9 @@ request path matches a specific pattern, the associated function is called.
If the request path matches more than one pattern, some conflict resolution
scheme is used, usually a simple order precedence so that the first match
will take priority over any subsequent matches. If a request path doesn't
-match any of the defined patterns, :app:`Pyramid` a "404 Not Found" response
-is returned.
+match any of the defined patterns, a "404 Not Found" response is returned.
-In Pyramid, we offer an implementation of URL mapping which we call
+In Pyramid, we offer an implementation of URL matching which we call
:term:`URL dispatch`. Using :app:`Pyramid` syntax, we might have a match
pattern such as ``/{userid}/photos/{photoid}``, mapped to a ``photo_view()``
function defined somewhere in our code. Then a request for a path such as
@@ -115,7 +114,7 @@ then you understand view lookup.
The major difference between file system lookup and traversal is that a file
system lookup steps through nested directories and files in a file system
-tree, while traversal steps through nested dictionary-type objects in an
+tree, while traversal steps through nested dictionary-type objects in a
:term:`resource tree`. Let's take a detailed look at one of our example
paths, so we can see what I mean:
@@ -123,7 +122,7 @@ The path ``/joeschmoe/photos/photo1``, has four segments: ``/``,
``joeschmoe``, ``photos`` and ``photo1``. With file system lookup we might
have a root folder (``/``) containing a nested folder (``joeschmoe``), which
contains another nested folder (``photos``), which finally contains a JPG
-file ("photo1"). With traversal, we instead have a dictionary-like root
+file (``photo1``). With traversal, we instead have a dictionary-like root
object. Asking for the ``joeschmoe`` key gives us another dictionary-like
object. Asking this in turn for the ``photos`` key gives us yet another
mapping object, which finally (hopefully) contains the resource that we're
@@ -154,9 +153,9 @@ Since :app:`Pyramid` is not a highly opinionated framework, it makes no
restriction on how a :term:`resource` is implemented; a developer can
implement them as he wishes. One common pattern used is to persist all of
the resources, including the root, in a database as a graph. The root object
-is a dictionarylike object. Dictionarylike objects in Python supply a
+is a dictionary-like object. Dictionary-like objects in Python supply a
``__getitem__`` method which is called when key lookup is done. Under the
-hood, when ``adict`` is a dictionarylike object, Python translates
+hood, when ``adict`` is a dictionary-like object, Python translates
``adict['a']`` to ``adict.__getitem__('a')``. Try doing this in a Python
interpreter prompt if you don't believe us:
@@ -174,7 +173,7 @@ interpreter prompt if you don't believe us:
1
-The dictionarylike root object stores the ids of all of its subresources as
+The dictionary-like root object stores the ids of all of its subresources as
keys, and provides a ``__getitem__`` implementation that fetches them. So
``get_root()`` fetches the unique root object, while
``get_root()['joeschmoe']`` returns a different object, also stored in the
@@ -185,12 +184,13 @@ days, or anywhere else, it doesn't matter. As long as the returned objects
provide the dictionary-like API (i.e. as long as they have an appropriately
implemented ``__getitem__`` method) then traversal will work.
-In fact, you don't need a "database" at all. You could trivially implement a
-set of objects with ``__getitem__`` methods that search for files in specific
-directories, and thus precisely recreate the older mechanism of having the
-URL path mapped directly to a folder structure on the file system. Or you
-could use plain dictionaries too. Traversal is in fact a superset of file
-system lookup.
+In fact, you don't need a "database" at all. You could use plain
+dictionaries, with your site's URL structure hard-coded directly in
+the Python source. Or you could trivially implement a set of objects
+with ``__getitem__`` methods that search for files in specific
+directories, and thus precisely recreate the traditional mechanism of
+having the URL path mapped directly to a folder structure on the file
+system. Traversal is in fact a superset of file system lookup.
.. note:: See the chapter entitled :ref:`resources_chapter` for a more
technical overview of resources.
@@ -207,13 +207,14 @@ that you might want to take after finding a :term:`resource`. With our photo
example, for instance, you might want to view the photo in a page, but you
might also want to provide a way for the user to edit the photo and any
associated metadata. We'll call the former the ``view`` view, and the latter
-will be the ``edit`` view (Original, I know.) :app:`Pyramid` has a
-centralized view registry where named views can be associated with specific
-resource types. So in our example, we'll assume that we've registered
-``view`` and ``edit`` views for photo objects, and that we've specified the
-``view`` view as the default, so that ``/joeschmoe/photos/photo1/view`` and
-``/joeschmoe/photos/photo1`` are equivalent. The edit view would sensibly be
-provided by a request for ``/joeschmoe/photos/photo1/edit``.
+will be the ``edit`` view. (Original, I know.) :app:`Pyramid` has a
+centralized view :term:`application registry` where named views can be
+associated with specific resource types. So in our example, we'll assume
+that we've registered ``view`` and ``edit`` views for photo objects, and that
+we've specified the ``view`` view as the default, so that
+``/joeschmoe/photos/photo1/view`` and ``/joeschmoe/photos/photo1`` are
+equivalent. The edit view would sensibly be provided by a request for
+``/joeschmoe/photos/photo1/edit``.
Hopefully it's clear that the first portion of the edit view's URL path is
going to resolve to the same resource as the non-edit version, specifically
@@ -232,15 +233,15 @@ response.
You might conceptualize a request for ``/joeschmoe/photos/photo1/edit`` as
ultimately converted into the following piece of Pythonic pseudocode::
-
+
context = get_root()['joeschmoe']['photos']['photo1']
view_callable = get_view(context, 'edit')
request.context = context
view_callable(request)
The ``get_root`` and ``get_view`` functions don't really exist. Internally,
-:app:`Pyramid` does something more complicated. But the example above is a
-reasonable approximation of the view lookup algorithm in pseudocode.
+:app:`Pyramid` does something more complicated. But the example above
+is a reasonable approximation of the view lookup algorithm in pseudocode.
Use Cases
---------
@@ -264,20 +265,18 @@ folder. He might decide to nest folders dozens of layers deep. How will you
construct matching patterns that could account for every possible combination
of paths that might develop?
-It's possible, but it will make for some somewhat ugly URLs. And the
-matching patterns are going to become complex quickly as you try to handle
-all of the edge cases.
-
-With traversal, however, it's straightforward. If you want 20 layers of
-nesting, it's no problem. :app:`Pyramid` will happily call ``__getitem__``
-as many times as it needs to, until it runs out of path segments or until a
-resource raises a :exc:`KeyError`. Each resource only needs to know how to
-fetch its immediate children, the traversal algorithm takes care of the rest.
-
-One of the key advantages of traversal is that the structure of the resource
-tree can live in the database, and not in the code. It's simple to let users
-modify the tree at runtime to set up their own personalized directory
-structures.
+It might be possible, but it certainly won't be easy. The matching
+patterns are going to become complex quickly as you try to handle all
+of the edge cases.
+
+With traversal, however, it's straightforward. 20 layers of nesting would be
+no problem. :app:`Pyramid` will happily call ``__getitem__`` as many times
+as it needs to, until it runs out of path segments or until a resource raises
+a :exc:`KeyError`. Each resource only needs to know how to fetch its
+immediate children, the traversal algorithm takes care of the rest. Also,
+since the structure of the resource tree can live in the database and not in
+the code, it's simple to let users modify the tree at runtime to set up their
+own personalized "directory" structures.
Another use case in which traversal shines is when there is a need to support
a context-dependent security policy. One example might be a document
diff --git a/docs/narr/project.rst b/docs/narr/project.rst
index c1017b5c1..46de560c2 100644
--- a/docs/narr/project.rst
+++ b/docs/narr/project.rst
@@ -601,7 +601,7 @@ or influencing runtime behavior of a :app:`Pyramid` application. See
default 'application' (although it's actually a pipeline of middleware and an
application) run by ``paster serve`` when it is invoked against this
configuration file. The name ``main`` is a convention used by PasteDeploy
-signifying that it the default application.
+signifying that it is the default application.
The ``[server:main]`` section of the configuration file configures a WSGI
server which listens on TCP port 6543. It is configured to listen on all
@@ -705,7 +705,8 @@ who want to use your application.
be included in the tarball. If you don't use Subversion, and instead use
a different version control system, you may need to install a setuptools
add-on such as ``setuptools-git`` or ``setuptools-hg`` for this behavior
- to work properly.
+ to work properly. Alternatively, you can specify the non-Python-source
+ files by hand in a ``manifest template``, called ``MANIFEST.in`` by default.
``setup.cfg``
~~~~~~~~~~~~~
@@ -876,9 +877,6 @@ represent the root.
This directory contains static assets which support the ``mytemplate.pt``
template. It includes CSS and images.
-.. index::
- single: tests.py
-
``templates/mytemplate.pt``
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -892,6 +890,9 @@ Templates are accessed and used by view configurations and sometimes by view
functions themselves. See :ref:`templates_used_directly` and
:ref:`templates_used_as_renderers`.
+.. index::
+ single: tests.py
+
``tests.py``
~~~~~~~~~~~~
diff --git a/docs/narr/renderers.rst b/docs/narr/renderers.rst
index d888e3376..56d0a5199 100644
--- a/docs/narr/renderers.rst
+++ b/docs/narr/renderers.rst
@@ -389,12 +389,12 @@ documentation in :ref:`request_module`.
.. _adding_and_overriding_renderers:
-Adding and Overriding Renderers
--------------------------------
+Adding and Changing Renderers
+-----------------------------
New templating systems and serializers can be associated with :app:`Pyramid`
renderer names. To this end, configuration declarations can be made which
-override an existing :term:`renderer factory`, and which add a new renderer
+change an existing :term:`renderer factory`, and which add a new renderer
factory.
Renderers can be registered imperatively using the
@@ -546,7 +546,7 @@ set as ``renderer=`` in the view configuration.
See also :ref:`renderer_directive` and
:meth:`pyramid.config.Configurator.add_renderer`.
-Overriding an Existing Renderer
+Changing an Existing Renderer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can associate more than one filename extension with the same existing
@@ -563,7 +563,7 @@ extension for the same kinds of templates. For example, to associate the
After you do this, :app:`Pyramid` will treat templates ending in both the
``.pt`` and ``.zpt`` filename extensions as Chameleon ZPT templates.
-To override the default mapping in which files with a ``.pt`` extension are
+To change the default mapping in which files with a ``.pt`` extension are
rendered via a Chameleon ZPT page template renderer, use a variation on the
following in your application's startup code:
@@ -585,3 +585,44 @@ the ``name`` attribute to the renderer tag:
config.add_renderer(None, 'mypackage.json_renderer_factory')
+Overriding A Renderer At Runtime
+--------------------------------
+
+.. warning:: This is an advanced feature, not typically used by "civilians".
+
+In some circumstances, it is necessary to instruct the system to ignore the
+static renderer declaration provided by the developer in view configuration,
+replacing the renderer with another *after a request starts*. For example,
+an "omnipresent" XML-RPC implementation that detects that the request is from
+an XML-RPC client might override a view configuration statement made by the
+user instructing the view to use a template renderer with one that uses an
+XML-RPC renderer. This renderer would produce an XML-RPC representation of
+the data returned by an arbitrary view callable.
+
+To use this feature, create a :class:`pyramid.events.NewRequest`
+:term:`subscriber` which sniffs at the request data and which conditionally
+sets an ``override_renderer`` attribute on the request itself, which is the
+*name* of a registered renderer. For example:
+
+.. code-block:: python
+ :linenos:
+
+ from pyramid.event import subscriber
+ from pyramid.event import NewRequest
+
+ @subscriber(NewRequest)
+ def set_xmlrpc_params(event):
+ request = event.request
+ if (request.content_type == 'text/xml'
+ and request.method == 'POST'
+ and not 'soapaction' in request.headers
+ and not 'x-pyramid-avoid-xmlrpc' in request.headers):
+ params, method = parse_xmlrpc_request(request)
+ request.xmlrpc_params, request.xmlrpc_method = params, method
+ request.is_xmlrpc = True
+ request.override_renderer = 'xmlrpc'
+ return True
+
+The result of such a subscriber will be to replace any existing static
+renderer configured by the developer with a (notional, nonexistent) XML-RPC
+renderer if the request appears to come from an XML-RPC client.
diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst
index cf13f8c8d..c97b4c676 100644
--- a/docs/narr/resources.rst
+++ b/docs/narr/resources.rst
@@ -186,7 +186,7 @@ you will reach the filesystem root directory.
objects "by hand". Instead, as necessary, during traversal :app:`Pyramid`
will wrap each resource (even the root resource) in a ``LocationProxy``
which will dynamically assign a ``__name__`` and a ``__parent__`` to the
- traversed resrouce (based on the last traversed resource and the name
+ traversed resource (based on the last traversed resource and the name
supplied to ``__getitem__``). The root resource will have a ``__name__``
attribute of ``None`` and a ``__parent__`` attribute of ``None``.
diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst
index 7ef8e1923..b97cc7be6 100644
--- a/docs/narr/templates.rst
+++ b/docs/narr/templates.rst
@@ -448,7 +448,7 @@ Here's what a simple :term:`Chameleon` ZPT template used under
<body>
<h1 class="title">Welcome to <code>${project}</code>, an
application generated by the <a
- href="http://pylonshq.com/pyramid">pyramid</a> web
+ href="http://docs.pylonsproject.org/projects/pyramid/dev/">pyramid</a> web
application framework.</h1>
</body>
</html>
@@ -744,7 +744,7 @@ look like:
<body>
<h1 class="title">Welcome to <code>${project}</code>, an
application generated by the <a
- href="http://pylonshq.com/pyramid">pyramid</a> web
+ href="http://docs.pylonsproject.org/projects/pyramid/dev/">pyramid</a> web
application framework.</h1>
</body>
</html>
diff --git a/docs/narr/testing.rst b/docs/narr/testing.rst
index 007b96c2a..08c6e355b 100644
--- a/docs/narr/testing.rst
+++ b/docs/narr/testing.rst
@@ -78,38 +78,43 @@ See :ref:`threadlocals_chapter` for information about these functions and the
data structures they return.
If your code uses these ``get_current_*`` functions or calls :app:`Pyramid`
-code which uses ``get_current_*`` functions, you will need to construct a
-:term:`Configurator` and call its ``begin`` method within the ``setUp``
-method of your unit test and call the same Configurator's ``end`` method
-within the ``tearDown`` method of your unit test.
-
-We'll also instruct the Configurator we use during testing to *autocommit*.
-Normally when a Configurator is used by an application, it defers performing
-any "real work" until its ``.commit`` method is called (often implicitly by
-the :meth:`pyramid.config.Configurator.make_wsgi_app` method). Passing
-``autocommit=True`` to the Configurator constructor causes the Configurator
-to perform all actions implied by methods called on it immediately, which is
-more convenient for unit-testing purposes than needing to call
-:meth:`pyramid.config.Configurator.commit` in each test.
-
-The use of a Configurator and its ``begin`` and ``end`` methods allows you to
-supply each unit test method in a test case with an environment that has an
-isolated registry and an isolated request for the duration of a single test.
-Here's an example of using this feature:
+code which uses ``get_current_*`` functions, you will need to call
+:func:`pyramid.testing.setUp` in your test setup and you will need to call
+:func:`pyramid.testing.tearDown` in your test teardown.
+:func:`~pyramid.testing.setUp` pushes a registry onto the :term:`thread
+local` stack, which makes the ``get_current_*`` functions work. It returns a
+:term:`Configurator` object which can be used to perform extra configuration
+required by the code under test. :func:`~pyramid.testing.tearDown` pops the
+thread local stack.
+
+Normally when a Configurator is used directly with the ``main`` block of a
+Pyramid application, it defers performing any "real work" until its
+``.commit`` method is called (often implicitly by the
+:meth:`pyramid.config.Configurator.make_wsgi_app` method). The Configurator
+returned by :func:`~pyramid.testing.setUp` is however an *autocommitting*
+Configurator which performs all actions implied by methods called on it
+immediately. This is more convenient for unit-testing purposes than needing
+to call :meth:`pyramid.config.Configurator.commit` in each test after adding
+extra configuration statements.
+
+The use of the :func:`~pyramid.testing.setUp` and
+:func:`~pyramid.testing.tearDown` functions allows you to supply each unit
+test method in a test case with an environment that has an isolated registry
+and an isolated request for the duration of a single test. Here's an example
+of using this feature:
.. code-block:: python
:linenos:
import unittest
- from pyramid.config import Configurator
+ from pyramid import testing
class MyTest(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
The above will make sure that
:func:`pyramid.threadlocal.get_current_registry` will return the
@@ -118,35 +123,33 @@ instance when :func:`pyramid.threadlocal.get_current_registry` is called in a
test case method attached to ``MyTest``. Each test case method attached to
``MyTest`` will use an isolated registry.
-The :meth:`pyramid.config.Configurator.begin` method accepts various
-arguments that influence the code run during the test. See the
-:ref:`configuration_module` chapter for information about the API of a
-:term:`Configurator`, including its ``begin`` and ``end`` methods.
+The :func:`~pyramid.testing.setUp` and :func:`~pyramid.testing.tearDown`
+functions accepts various arguments that influence the environment of the
+test. See the :ref:`testing_module` chapter for information about the extra
+arguments supported by these functions.
If you also want to make :func:`pyramid.get_current_request` return something
other than ``None`` during the course of a single test, you can pass a
-:term:`request` object into the :meth:`pyramid.config.Configurator.begin`
-method of the Configurator within the ``setUp`` method of your test:
+:term:`request` object into the :func:`pyramid.testing.setUp` within the
+``setUp`` method of your test:
.. code-block:: python
:linenos:
import unittest
- from pyramid.config import Configurator
from pyramid import testing
class MyTest(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
request = testing.DummyRequest()
- self.config.begin(request=request)
+ self.config = testing.setUp(request=request)
def tearDown(self):
- self.config.end()
+ testing.tearDown()
-If you pass a :term:`request` object into the ``begin`` method of the
-configurator within your test case's ``setUp``, any test method attached to
-the ``MyTest`` test case that directly or indirectly calls
+If you pass a :term:`request` object into :func:`pyramid.testing.setUp`
+within your test case's ``setUp``, any test method attached to the ``MyTest``
+test case that directly or indirectly calls
:func:`pyramid.threadlocal.get_current_request` will receive the request you
passed into the ``begin`` method. Otherwise, during testing,
:func:`pyramid.threadlocal.get_current_request` will return ``None``. We use
@@ -162,18 +165,18 @@ they're used by frameworks. Sorry. So here's a rule of thumb: if you don't
*know* whether you're calling code that uses the
:func:`pyramid.threadlocal.get_current_registry` or
:func:`pyramid.threadlocal.get_current_request` functions, or you don't care
-about any of this, but you still want to write test code, just always create
-an autocommitting Configurator instance and call its ``begin`` method within
-the ``setUp`` of a unit test, then subsequently call its ``end`` method in
-the test's ``tearDown``. This won't really hurt anything if the application
-you're testing does not call any ``get_current*`` function.
+about any of this, but you still want to write test code, just always call
+:func:`pyramid.testing.setUp` in your test's ``setUp`` method and
+:func:`pyramid.testing.tearDown` in your tests' ``tearDown`` method. This
+won't really hurt anything if the application you're testing does not call
+any ``get_current*`` function.
.. index::
single: pyramid.testing
single: Configurator testing API
Using the ``Configurator`` and ``pyramid.testing`` APIs in Unit Tests
-------------------------------------------------------------------------
+---------------------------------------------------------------------
The ``Configurator`` API and the ``pyramid.testing`` module provide a number
of functions which can be used during unit testing. These functions make
@@ -217,16 +220,14 @@ without needing to invoke the actual application configuration implied by its
:linenos:
import unittest
- from pyramid.config import Configurator
from pyramid import testing
class MyTest(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_view_fn_not_submitted(self):
from my.package import view_fn
@@ -277,8 +278,8 @@ performs a similar template registration and assertion. We assert at the end
of this that the renderer's ``say`` attribute is ``Yo``, as this is what is
expected of the view function in the branch it's testing.
-Note that the test calls the :meth:`pyramid.config.Configurator.begin` method
-in its ``setUp`` method and the ``end`` method of the same in its
+Note that the test calls the :func:`pyramid.testing.setUp` function in its
+``setUp`` method and the :func:`pyramid.testing.tearDown` function in its
``tearDown`` method. If you use any of the
:class:`pyramid.config.Configurator` APIs during testing, be sure to use this
pattern in your test case's ``setUp`` and ``tearDown``; these methods make
@@ -327,7 +328,6 @@ after accessing some values that require a fully set up environment.
import unittest
- from pyramid.config import Configurator
from pyramid import testing
class ViewIntegrationTests(unittest.TestCase):
@@ -337,13 +337,12 @@ after accessing some values that require a fully set up environment.
(including dependent registrations for pyramid itself).
"""
import myapp
- self.config = Configurator(package=myapp, autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
self.config.load_zcml('myapp:configure.zcml')
def tearDown(self):
""" Clear out the application registry """
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from myapp.views import my_view
diff --git a/docs/narr/viewconfig.rst b/docs/narr/viewconfig.rst
index f8b3fdb24..c11fc1697 100644
--- a/docs/narr/viewconfig.rst
+++ b/docs/narr/viewconfig.rst
@@ -841,6 +841,35 @@ configuration that results in calling the ``show_template`` method, then
rendering the template with ``home.mak``, and the url ``/hello/about`` will
call the same method and render the ``about.mak`` template.
+Handler ``__action_decorator__`` Attribute
+++++++++++++++++++++++++++++++++++++++++++
+
+If a handler class has an ``__action_decorator__`` attribute, then the
+value of the class attribute will be passed in as the ``decorator``
+argument every time a handler action is registered as a view callable.
+This means that, like anything passed to ``add_view()`` as the
+``decorator`` argument, ``__action_decorator__`` must be a callable
+accepting a single argument. This argument will itself be a callable
+accepting ``(context, request)`` arguments, and
+``__action_decorator__`` must return a replacement callable with the
+same call signature.
+
+Note that, since handler actions are registered as views against the
+handler class and not a handler instance, any ``__action_decorator__``
+attribute must *not* be a regular instance method. Defining an
+``__action_decorator__`` instance method on a handler class will
+result in a :exc:`ConfigurationError`. Instead, ``__action_decorator__``
+can be any other type of callable: a staticmethod, classmethod, function,
+or some sort of callable instance.
+
+.. note::
+
+ In a Pylons 1.0 controller, it was possible to override the ``__call__()``
+ method, which allowed a developer to "wrap" the entire action invocation,
+ with a try/except or any other arbitrary code. In :app:`Pyramid`, this
+ can be emulated with the use of an ``__action_decorator__`` classmethod
+ on your handler class.
+
.. index::
single: resource interfaces
diff --git a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/authorization/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
index cac9ccaa7..2a2340683 100644
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org/">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py b/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py
index 0a3d507a0..1f3c3bb4d 100644
--- a/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py
+++ b/docs/tutorials/wiki/src/basiclayout/tutorial/tests.py
@@ -1,15 +1,13 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from tutorial.views import my_view
diff --git a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/models/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki/src/models/tutorial/tests.py b/docs/tutorials/wiki/src/models/tutorial/tests.py
index 839964538..51c97a95d 100644
--- a/docs/tutorials/wiki/src/models/tutorial/tests.py
+++ b/docs/tutorials/wiki/src/models/tutorial/tests.py
@@ -1,6 +1,5 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class PageModelTests(unittest.TestCase):
@@ -50,11 +49,10 @@ class AppmakerTests(unittest.TestCase):
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from tutorial.views import my_view
diff --git a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki/src/views/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
index 1020a8b99..08916f43c 100644
--- a/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/authorization/tutorial/tests.py
@@ -1,6 +1,5 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
def _initTestingDB():
@@ -20,11 +19,10 @@ def _registerRoutes(config):
class ViewWikiTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_it(self):
from tutorial.views import view_wiki
@@ -36,12 +34,10 @@ class ViewWikiTests(unittest.TestCase):
class ViewPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import view_page
@@ -71,12 +67,11 @@ class ViewPageTests(unittest.TestCase):
class AddPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import add_page
@@ -104,12 +99,11 @@ class AddPageTests(unittest.TestCase):
class EditPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import edit_page
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki2/src/basiclayout/tutorial/tests.py b/docs/tutorials/wiki2/src/basiclayout/tutorial/tests.py
index fa3788340..5efa6affa 100644
--- a/docs/tutorials/wiki2/src/basiclayout/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/basiclayout/tutorial/tests.py
@@ -1,5 +1,4 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
def _initTestingDB():
@@ -10,12 +9,11 @@ def _initTestingDB():
class TestMyView(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
_initTestingDB()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_it(self):
from tutorial.views import my_view
diff --git a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/models/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki2/src/models/tutorial/tests.py b/docs/tutorials/wiki2/src/models/tutorial/tests.py
index 42b0aaada..71f5e21e3 100644
--- a/docs/tutorials/wiki2/src/models/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/models/tutorial/tests.py
@@ -1,5 +1,4 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
def _initTestingDB():
@@ -9,12 +8,11 @@ def _initTestingDB():
class TestMyView(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
_initTestingDB()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_it(self):
from tutorial.views import my_view
diff --git a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
index cac9ccaa7..e31a342b2 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
+++ b/docs/tutorials/wiki2/src/views/tutorial/templates/mytemplate.pt
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('tutorial:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('tutorial:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('tutorial:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/docs/tutorials/wiki2/src/views/tutorial/tests.py b/docs/tutorials/wiki2/src/views/tutorial/tests.py
index 7b770f927..b9797df67 100644
--- a/docs/tutorials/wiki2/src/views/tutorial/tests.py
+++ b/docs/tutorials/wiki2/src/views/tutorial/tests.py
@@ -1,6 +1,5 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
def _initTestingDB():
@@ -20,11 +19,10 @@ def _registerRoutes(config):
class ViewWikiTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_it(self):
from tutorial.views import view_wiki
@@ -36,12 +34,11 @@ class ViewWikiTests(unittest.TestCase):
class ViewPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import view_page
@@ -71,12 +68,12 @@ class ViewPageTests(unittest.TestCase):
class AddPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
+ self.config = testing.setUp()
self.config.begin()
def tearDown(self):
self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import add_page
@@ -104,12 +101,11 @@ class AddPageTests(unittest.TestCase):
class EditPageTests(unittest.TestCase):
def setUp(self):
self.session = _initTestingDB()
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
self.session.remove()
- self.config.end()
+ testing.tearDown()
def _callFUT(self, request):
from tutorial.views import edit_page
diff --git a/pyramid/config.py b/pyramid/config.py
index ff5d51fc4..9604833f3 100644
--- a/pyramid/config.py
+++ b/pyramid/config.py
@@ -1892,32 +1892,25 @@ class Configurator(object):
# this is *not* an action method (uses caller_package)
def scan(self, package=None, categories=None):
- """ Scan a Python package and any of its subpackages for
- objects marked with :term:`configuration decoration` such as
- :class:`pyramid.view.view_config`. Any decorated object found
- will influence the current configuration state.
+ """Scan a Python package and any of its subpackages for objects
+ marked with :term:`configuration decoration` such as
+ :class:`pyramid.view.view_config`. Any decorated object found will
+ influence the current configuration state.
- The ``package`` argument should be a Python :term:`package` or
- module object (or a :term:`dotted Python name` which refers to
- such a package or module). If ``package`` is ``None``, the
- package of the *caller* is used.
+ The ``package`` argument should be a Python :term:`package` or module
+ object (or a :term:`dotted Python name` which refers to such a
+ package or module). If ``package`` is ``None``, the package of the
+ *caller* is used.
The ``categories`` argument, if provided, should be the
- :term:`Venusian` 'scan categories' to use during scanning.
- Providing this argument is not often necessary; specifying
- scan categories is an extremely advanced usage.
-
- By default, ``categories`` is ``None`` which will execute
- *all* Venusian decorator callbacks including
+ :term:`Venusian` 'scan categories' to use during scanning. Providing
+ this argument is not often necessary; specifying scan categories is
+ an extremely advanced usage. By default, ``categories`` is ``None``
+ which will execute *all* Venusian decorator callbacks including
:app:`Pyramid`-related decorators such as
- :class:`pyramid.view.view_config`. If this is not desirable
- because the codebase has other Venusian-using decorators that
- aren't meant to be invoked during a particular scan, use
- ``('pyramid',)`` as a ``categories`` value to limit the execution
- of decorator callbacks to only those registered by
- :app:`Pyramid` itself. Or pass a sequence of Venusian scan
- categories as necessary (e.g. ``('pyramid', 'myframework')``) to
- limit the decorators called to the set of categories required.
+ :class:`pyramid.view.view_config`. See the :ref:`Venusian`
+ documentation for more information about limiting a scan by using an
+ explicit set of categories.
"""
package = self.maybe_dotted(package)
if package is None: # pragma: no cover
diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py
index 14ff100b1..a9b686105 100644
--- a/pyramid/interfaces.py
+++ b/pyramid/interfaces.py
@@ -165,7 +165,7 @@ class IAuthenticationPolicy(Interface):
def unauthenticated_userid(request):
""" Return the *unauthenticated* userid. This method performs the
same duty as ``authenticated_userid`` but is permitted to return the
- userid based only on data present in the request; it neednt (and
+ userid based only on data present in the request; it needn't (and
shouldn't) check any persistent store to ensure that the user record
related to the request userid exists."""
diff --git a/pyramid/paster_templates/alchemy/+package+/templates/model.pt_tmpl b/pyramid/paster_templates/alchemy/+package+/templates/model.pt_tmpl
index 1fd3c0b20..236424cae 100644
--- a/pyramid/paster_templates/alchemy/+package+/templates/model.pt_tmpl
+++ b/pyramid/paster_templates/alchemy/+package+/templates/model.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -47,25 +46,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/alchemy/+package+/templates/root.pt_tmpl b/pyramid/paster_templates/alchemy/+package+/templates/root.pt_tmpl
index ca05896ae..557183a51 100644
--- a/pyramid/paster_templates/alchemy/+package+/templates/root.pt_tmpl
+++ b/pyramid/paster_templates/alchemy/+package+/templates/root.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -45,25 +44,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/pylons_basic/+package+/templates/mytemplate.mako_tmpl b/pyramid/paster_templates/pylons_basic/+package+/templates/mytemplate.mako_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/pylons_basic/+package+/templates/mytemplate.mako_tmpl
+++ b/pyramid/paster_templates/pylons_basic/+package+/templates/mytemplate.mako_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/pylons_basic/+package+/tests.py_tmpl b/pyramid/paster_templates/pylons_basic/+package+/tests.py_tmpl
index 9716146e0..7fd0404f0 100644
--- a/pyramid/paster_templates/pylons_basic/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/pylons_basic/+package+/tests.py_tmpl
@@ -1,14 +1,13 @@
import unittest
-from pyramid.config import Configurator
+from pyramid import testing
class HelloHandlerTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def _makeOne(self, request):
from {{package}}.handlers.hello import HelloHandler
diff --git a/pyramid/paster_templates/pylons_minimal/+package+/templates/mytemplate.mako_tmpl b/pyramid/paster_templates/pylons_minimal/+package+/templates/mytemplate.mako_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/pylons_minimal/+package+/templates/mytemplate.mako_tmpl
+++ b/pyramid/paster_templates/pylons_minimal/+package+/templates/mytemplate.mako_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/pylons_minimal/+package+/tests.py_tmpl b/pyramid/paster_templates/pylons_minimal/+package+/tests.py_tmpl
index 5f6c0da65..d29d32772 100644
--- a/pyramid/paster_templates/pylons_minimal/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/pylons_minimal/+package+/tests.py_tmpl
@@ -1,14 +1,13 @@
import unittest
-from pyramid.config import Configurator
+from pyramid import testing
class MyControllerTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def _makeOne(self, request):
from {{package}}.handlers import MyHandler
diff --git a/pyramid/paster_templates/pylons_sqla/+package+/templates/mytemplate.mako_tmpl b/pyramid/paster_templates/pylons_sqla/+package+/templates/mytemplate.mako_tmpl
index 9130f6da8..d12066ac8 100644
--- a/pyramid/paster_templates/pylons_sqla/+package+/templates/mytemplate.mako_tmpl
+++ b/pyramid/paster_templates/pylons_sqla/+package+/templates/mytemplate.mako_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -43,25 +42,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/pylons_sqla/+package+/tests.py_tmpl b/pyramid/paster_templates/pylons_sqla/+package+/tests.py_tmpl
index f2f95da60..2cf485cc2 100644
--- a/pyramid/paster_templates/pylons_sqla/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/pylons_sqla/+package+/tests.py_tmpl
@@ -1,16 +1,16 @@
import unittest
+from pyramid import testing
+
class MyHandlerTests(unittest.TestCase):
def setUp(self):
- from pyramid.config import Configurator
from sqlalchemy import create_engine
from {{package}}.models import initialize_sql
self.session = initialize_sql(create_engine('sqlite://'))
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def _makeOne(self, request):
from {{package}}.handlers import MyHandler
diff --git a/pyramid/paster_templates/routesalchemy/+package+/templates/mytemplate.pt_tmpl b/pyramid/paster_templates/routesalchemy/+package+/templates/mytemplate.pt_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/routesalchemy/+package+/templates/mytemplate.pt_tmpl
+++ b/pyramid/paster_templates/routesalchemy/+package+/templates/mytemplate.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/routesalchemy/+package+/tests.py_tmpl b/pyramid/paster_templates/routesalchemy/+package+/tests.py_tmpl
index 74ab8e08a..29aea7258 100644
--- a/pyramid/paster_templates/routesalchemy/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/routesalchemy/+package+/tests.py_tmpl
@@ -10,12 +10,11 @@ def _initTestingDB():
class TestMyView(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
_initTestingDB()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_it(self):
from {{package}}.views import my_view
diff --git a/pyramid/paster_templates/starter/+package+/templates/mytemplate.pt_tmpl b/pyramid/paster_templates/starter/+package+/templates/mytemplate.pt_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/starter/+package+/templates/mytemplate.pt_tmpl
+++ b/pyramid/paster_templates/starter/+package+/templates/mytemplate.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/starter/+package+/tests.py_tmpl b/pyramid/paster_templates/starter/+package+/tests.py_tmpl
index e1b795b7c..33f8c50b4 100644
--- a/pyramid/paster_templates/starter/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/starter/+package+/tests.py_tmpl
@@ -1,15 +1,13 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from {{package}}.views import my_view
diff --git a/pyramid/paster_templates/starter_zcml/+package+/templates/mytemplate.pt_tmpl b/pyramid/paster_templates/starter_zcml/+package+/templates/mytemplate.pt_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/starter_zcml/+package+/templates/mytemplate.pt_tmpl
+++ b/pyramid/paster_templates/starter_zcml/+package+/templates/mytemplate.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/starter_zcml/+package+/tests.py_tmpl b/pyramid/paster_templates/starter_zcml/+package+/tests.py_tmpl
index e1b795b7c..33f8c50b4 100644
--- a/pyramid/paster_templates/starter_zcml/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/starter_zcml/+package+/tests.py_tmpl
@@ -1,15 +1,13 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from {{package}}.views import my_view
diff --git a/pyramid/paster_templates/zodb/+package+/templates/mytemplate.pt_tmpl b/pyramid/paster_templates/zodb/+package+/templates/mytemplate.pt_tmpl
index a658ee2c9..e3fa39f28 100644
--- a/pyramid/paster_templates/zodb/+package+/templates/mytemplate.pt_tmpl
+++ b/pyramid/paster_templates/zodb/+package+/templates/mytemplate.pt_tmpl
@@ -7,8 +7,7 @@
<meta name="description" content="pyramid web application" />
<link rel="shortcut icon" href="${request.static_url('{{package}}:static/favicon.ico')}" />
<link rel="stylesheet" href="${request.static_url('{{package}}:static/pylons.css')}" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
- <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Nobile:regular,italic,bold,bolditalic&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
+ <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Neuton|Nobile:regular,i,b,bi&amp;subset=latin" type="text/css" media="screen" charset="utf-8" />
<!--[if lte IE 6]>
<link rel="stylesheet" href="${request.static_url('{{package}}:static/ie6.css')}" type="text/css" media="screen" charset="utf-8" />
<![endif]-->
@@ -32,7 +31,7 @@
<div class="bottom">
<div id="left" class="align-right">
<h2>Search documentation</h2>
- <form method="get" action="http://docs.pylonshq.com/pyramid/dev/search.html">
+ <form method="get" action="http://docs.pylonsproject.org/projects/pyramid/dev/search.html">
<input type="text" id="q" name="q" value="" />
<input type="submit" id="x" value="Go" />
</form>
@@ -41,25 +40,25 @@
<h2>Pyramid links</h2>
<ul class="links">
<li>
- <a href="http://pylonshq.com">Pylons Website</a>
+ <a href="http://pylonsproject.org">Pylons Website</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#narrative-documentation">Narrative Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#api-documentation">API Documentation</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#api-documentation">API Documentation</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#tutorials">Tutorials</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#tutorials">Tutorials</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#change-history">Change History</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#change-history">Change History</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#sample-applications">Sample Applications</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#sample-applications">Sample Applications</a>
</li>
<li>
- <a href="http://docs.pylonshq.com/pyramid/dev/#support-and-development">Support and Development</a>
+ <a href="http://docs.pylonsproject.org/projects/pyramid/dev/#support-and-development">Support and Development</a>
</li>
<li>
<a href="irc://irc.freenode.net#pyramid">IRC Channel</a>
diff --git a/pyramid/paster_templates/zodb/+package+/tests.py_tmpl b/pyramid/paster_templates/zodb/+package+/tests.py_tmpl
index 1d5c76c72..b0cbe33ad 100644
--- a/pyramid/paster_templates/zodb/+package+/tests.py_tmpl
+++ b/pyramid/paster_templates/zodb/+package+/tests.py_tmpl
@@ -1,15 +1,13 @@
import unittest
-from pyramid.config import Configurator
from pyramid import testing
class ViewTests(unittest.TestCase):
def setUp(self):
- self.config = Configurator(autocommit=True)
- self.config.begin()
+ self.config = testing.setUp()
def tearDown(self):
- self.config.end()
+ testing.tearDown()
def test_my_view(self):
from {{package}}.views import my_view
diff --git a/pyramid/testing.py b/pyramid/testing.py
index 96388b709..17012785b 100644
--- a/pyramid/testing.py
+++ b/pyramid/testing.py
@@ -566,6 +566,7 @@ class DummyRequest(object):
content_length = 0
query_string = ''
response_callbacks = ()
+ charset = 'UTF-8'
def __init__(self, params=None, environ=None, headers=None, path='/',
cookies=None, post=None, **kw):
if environ is None:
@@ -668,14 +669,6 @@ def setUp(registry=None, request=None, hook_zca=True, autocommit=True):
:term:`application registry`; the same registry will be returned
by :func:`pyramid.threadlocal.get_current_registry` during the
execution of the test.
-
- .. warning:: Although this method of setting up a test registry
- will never disappear, after :app:`Pyramid` 1.0,
- using the ``begin`` and ``end`` methods of a
- ``Configurator`` are preferred to using
- ``pyramid.testing.setUp`` and
- ``pyramid.testing.tearDown``. See
- :ref:`testing_chapter` for more information.
"""
manager.clear()
if registry is None:
@@ -714,15 +707,6 @@ def tearDown(unhook_zca=True):
action of :func:`pyramid.testing.setUp` called with the
argument ``hook_zca=True``. If :mod:`zope.component` cannot be
imported, ignore the argument.
-
- .. warning:: Although this method of tearing a test setup down
- will never disappear, after :app:`Pyramid` 1.0,
- using the ``begin`` and ``end`` methods of a
- ``Configurator`` are preferred to using
- ``pyramid.testing.setUp`` and
- ``pyramid.testing.tearDown``. See
- :ref:`testing_chapter` for more information.
-
"""
if unhook_zca:
try:
@@ -747,9 +731,7 @@ def tearDown(unhook_zca=True):
def cleanUp(*arg, **kw):
""" :func:`pyramid.testing.cleanUp` is an alias for
- :func:`pyramid.testing.setUp`. Although this function is
- effectively deprecated as of :app:`Pyramid` 1.0, due to its
- extensive production usage, it will never be removed."""
+ :func:`pyramid.testing.setUp`. """
return setUp(*arg, **kw)
class DummyRendererFactory(object):
diff --git a/pyramid/tests/test_urldispatch.py b/pyramid/tests/test_urldispatch.py
index 12c5cf220..a452fdb97 100644
--- a/pyramid/tests/test_urldispatch.py
+++ b/pyramid/tests/test_urldispatch.py
@@ -239,6 +239,17 @@ class TestCompileRoute(unittest.TestCase):
self.assertEqual(matcher('foo/baz/biz/buz/bar'), None)
self.assertEqual(generator(
{'baz':1, 'buz':2, 'traverse':u'/a/b'}), '/foo/1/biz/2/bar/a/b')
+
+ def test_with_bracket_star(self):
+ matcher, generator = self._callFUT('/foo/{baz}/biz/{buz}/bar{remainder:.*}')
+ self.assertEqual(matcher('/foo/baz/biz/buz/bar'),
+ {'baz':'baz', 'buz':'buz', 'remainder':''})
+ self.assertEqual(matcher('/foo/baz/biz/buz/bar/everything/else/here'),
+ {'baz':'baz', 'buz':'buz',
+ 'remainder':'/everything/else/here'})
+ self.assertEqual(matcher('foo/baz/biz/buz/bar'), None)
+ self.assertEqual(generator(
+ {'baz':1, 'buz':2, 'remainder':'/a/b'}), '/foo/1/biz/2/bar%2Fa%2Fb')
def test_no_beginning_slash(self):
matcher, generator = self._callFUT('foo/:baz/biz/:buz/bar')
diff --git a/pyramid/traversal.py b/pyramid/traversal.py
index f32b43493..f5c79dbeb 100644
--- a/pyramid/traversal.py
+++ b/pyramid/traversal.py
@@ -2,6 +2,7 @@ import urllib
from zope.interface import implements
from zope.interface.interfaces import IInterface
+from zope.deprecation import deprecated
from repoze.lru import lru_cache
@@ -73,7 +74,8 @@ def find_resource(resource, path):
resolved by ``find_resource``.
.. note:: For backwards compatibility purposes, this function can also
- be imported as :func:`pyramid.traversal.find_model`.
+ be imported as :func:`pyramid.traversal.find_model`, although doing so
+ will emit a deprecation warning.
"""
D = traverse(resource, path)
view_name = D['view_name']
@@ -84,6 +86,12 @@ def find_resource(resource, path):
find_model = find_resource # b/w compat
+deprecated(
+ 'find_model',
+ 'pyramid.traversal.find_model is deprecated as of Pyramid 1.0. Use'
+ '``pyramid.traversal.find_resource`` instead (API-compat, simple '
+ 'rename).')
+
def find_interface(resource, class_or_interface):
"""
Return the first resource found in the :term:`lineage` of ``resource``
@@ -143,7 +151,8 @@ def resource_path(resource, *elements):
single leading '/' character.
.. note:: For backwards compatibility purposes, this function can also
- be imported as ``model_path``.
+ be imported as ``model_path``, although doing so will cause
+ a deprecation warning to be emitted.
"""
# joining strings is a bit expensive so we delegate to a function
# which caches the joined result for us
@@ -151,6 +160,12 @@ def resource_path(resource, *elements):
model_path = resource_path # b/w compat
+deprecated(
+ 'model_path',
+ 'pyramid.traversal.model_path is deprecated as of Pyramid 1.0. Use'
+ '``pyramid.traversal.resource_path`` instead (API-compat, simple rename).')
+
+
def traverse(resource, path):
"""Given a resource object as ``resource`` and a string or tuple
representing a path as ``path`` (such as the return value of
@@ -346,14 +361,20 @@ def resource_path_tuple(resource, *elements):
its name will be the first element in the generated
path tuple rather than the empty string.
- .. note:: For backwards compatibility purposes, this function can also
- be imported as ``model_path_tuple``.
+ .. note:: For backwards compatibility purposes, this function can also be
+ imported as ``model_path_tuple``, although doing so will cause a
+ deprecation warning to be emitted.
"""
return tuple(_resource_path_list(resource, *elements))
model_path_tuple = resource_path_tuple # b/w compat
+deprecated(
+ 'model_path_tuple',
+ 'pyramid.traversal.model_path_tuple is deprecated as of Pyramid 1.0. Use'
+ '``pyramid.traversal.resource_path_tuple`` instead (API-compat, simple '
+ 'rename).')
def _resource_path_list(resource, *elements):
""" Implementation detail shared by resource_path and resource_path_tuple"""
@@ -362,7 +383,7 @@ def _resource_path_list(resource, *elements):
path.extend(elements)
return path
-_model_path_list = _resource_path_list # b/w compat
+_model_path_list = _resource_path_list # b/w compat, not an API
def virtual_root(resource, request):
"""
@@ -633,7 +654,7 @@ class ResourceTreeTraverser(object):
'traversed':vpath_tuple, 'virtual_root':vroot,
'virtual_root_path':vroot_tuple, 'root':root}
-ModelGraphTraverser = ResourceTreeTraverser # b/w compat
+ModelGraphTraverser = ResourceTreeTraverser # b/w compat, not API, used in wild
class TraversalContextURL(object):
""" The IContextURL adapter used to generate URLs for a resource in a
diff --git a/pyramid/url.py b/pyramid/url.py
index 3126ad26c..f2507830d 100644
--- a/pyramid/url.py
+++ b/pyramid/url.py
@@ -2,6 +2,8 @@
import os
+from zope.deprecation import deprecated
+
from repoze.lru import lru_cache
from pyramid.interfaces import IContextURL
@@ -273,8 +275,9 @@ def resource_url(resource, request, *elements, **kw):
virtual root prefix (it will be stripped off the
left hand side of the generated URL).
- .. note:: For backwards compatibility purposes, this function can also
- be imported as ``model_url``.
+ .. note:: For backwards compatibility purposes, this function can also be
+ imported as ``model_url``, although doing so will emit a deprecation
+ warning.
"""
try:
reg = request.registry
@@ -307,6 +310,12 @@ def resource_url(resource, request, *elements, **kw):
model_url = resource_url # b/w compat (forever)
+deprecated(
+ 'model_url',
+ 'pyramid.url.model_url is deprecated as of Pyramid 1.0. Use'
+ '``pyramid.url.resource_url`` instead (API-compat, simple '
+ 'rename).')
+
def static_url(path, request, **kw):
"""
Generates a fully qualified URL for a static :term:`asset`.
diff --git a/pyramid/urldispatch.py b/pyramid/urldispatch.py
index 0f8691a07..5d1e53947 100644
--- a/pyramid/urldispatch.py
+++ b/pyramid/urldispatch.py
@@ -75,6 +75,7 @@ class RoutesMapper(object):
# stolen from bobo and modified
old_route_re = re.compile(r'(\:[a-zA-Z]\w*)')
+star_in_brackets = re.compile(r'\{[^\}]*\*\w*[^\}]*\}')
route_re = re.compile(r'(\{[a-zA-Z][^\}]*\})')
def update_pattern(matchobj):
name = matchobj.group(0)
@@ -87,7 +88,7 @@ def _compile_route(route):
if not route.startswith('/'):
route = '/' + route
star = None
- if '*' in route:
+ if '*' in route and not star_in_brackets.search(route):
route, star = route.rsplit('*', 1)
pat = route_re.split(route)
pat.reverse()
diff --git a/setup.py b/setup.py
index 3a278f694..889aaecec 100644
--- a/setup.py
+++ b/setup.py
@@ -12,7 +12,7 @@
#
##############################################################################
-__version__ = '1.0a9'
+__version__ = '0.0'
import os
import platform
@@ -68,7 +68,7 @@ setup(name='pyramid',
keywords='web wsgi pylons pyramid bfg',
author="Chris McDonough, Agendaless Consulting",
author_email="pylons-devel@googlegroups.com",
- url="http://docs.pylonshq.com",
+ url="http://docs.pylonsproject.org",
license="BSD-derived (http://www.repoze.org/LICENSE.txt)",
packages=find_packages(),
include_package_data=True,