diff options
| -rw-r--r-- | CHANGES.txt | 44 | ||||
| -rw-r--r-- | docs/narr/resources.rst | 34 | ||||
| -rw-r--r-- | docs/narr/webob.rst | 28 | ||||
| -rw-r--r-- | docs/tutorials/wiki2/basiclayout.rst | 12 | ||||
| -rw-r--r-- | pyramid/registry.py | 2 | ||||
| -rw-r--r-- | pyramid/renderers.py | 7 | ||||
| -rw-r--r-- | pyramid/threadlocal.py | 5 | ||||
| -rw-r--r-- | pyramid/wsgi.py | 5 |
8 files changed, 61 insertions, 76 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index c719bbfad..2a968daf9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,20 +1,11 @@ -Twophase branch -=============== +Next release +============ -- A new module named ``pyramid.config`` was added. It subsumes the duties of - the older ``pyramid.configuration`` module. The ``pyramid.configuration`` - module remains, but it is deprecated. +Features +-------- -- ``pyramid.configuration.Configurator`` is now deprecated. Use - ``pyramid.config.Configurator``, passing its constructor - ``autocommit=True`` instead. The ``pyramid.configuration.Configurator`` - alias will live for a long time, as every application uses it, but its - import now issues a deprecation warning. The - ``pyramid.config.Configurator`` class has the same API as - ``pyramid.configuration.Configurator`` class, which it means to replace, - except by default it is a *non-autocommitting* configurator. The - now-deprecated ``pyramid.configuration.Configurator`` will autocommit every - time a configuration method is called. +- A new module named ``pyramid.config`` was added. It subsumes the duties of + the older ``pyramid.configuration`` module. - The new ``pyramid.config.Configurator` class has API methods that the older ``pyramid.configuration.Configurator`` class did not: ``with_context`` (a @@ -26,12 +17,6 @@ Twophase branch the Config object returned by ``setUp`` will be a non-autocommiting Config object. -Next release -============ - -Features --------- - - Add logging configuration to all paster templates. - ``pyramid_alchemy``, ``pyramid_routesalchemy``, and ``pylons_sqla`` paster @@ -89,6 +74,23 @@ Documentation - Add a "Modifying Package Structure" section to the project narrative documentation chapter (explain turning a module into a package). +Deprecations +------------ + +- ``pyramid.configuration.Configurator`` is now deprecated. Use + ``pyramid.config.Configurator``, passing its constructor + ``autocommit=True`` instead. The ``pyramid.configuration.Configurator`` + alias will live for a long time, as every application uses it, but its + import now issues a deprecation warning. The + ``pyramid.config.Configurator`` class has the same API as + ``pyramid.configuration.Configurator`` class, which it means to replace, + except by default it is a *non-autocommitting* configurator. The + now-deprecated ``pyramid.configuration.Configurator`` will autocommit every + time a configuration method is called. + + The ``pyramid.configuration`` module remains, but it is deprecated. Use + ``pyramid.config`` instead. + 1.0a4 (2010-11-21) ================== diff --git a/docs/narr/resources.rst b/docs/narr/resources.rst index 575afd1fe..c87157472 100644 --- a/docs/narr/resources.rst +++ b/docs/narr/resources.rst @@ -114,40 +114,6 @@ following kinds of resources defined in any Python package: - Any other resource (or set of resources) addressed by code that uses the setuptools :term:`pkg_resources` API. -Usually, overriding a resource in an existing application means -performing the following steps: - -- Create a new Python package. The easiest way to do this is to - create a new :app:`Pyramid` application using the "paster" - template mechanism. See :ref:`creating_a_project` for more - information. - -- Install the new package into the same Python environment as the - original application (e.g. ``python setup.py develop`` or ``python - setup.py install``). - -- Change the ``configure.zcml`` in the new package to include one or - more ``resource`` ZCML directives (see :ref:`resource_directive` - below). The new package's ``configure.zcml`` should then include - the original :app:`Pyramid` application's ``configure.zcml`` via - an include statement, e.g. ``<include - package="theoriginalpackage"/>``. - -- Add override resources to the package as necessary. - -- Change the Paste ``.ini`` file that starts up the original - application. Add a ``configure_zcml`` statement within the - application's section in the file which points at your *new* - package's ``configure.zcml`` file. See :ref:`environment_chapter` - for more information about this setting. - -Note that overriding resources is not the only way to extend or modify -the behavior of an existing :app:`Pyramid` application. A "heavier -hammer" way to do the same thing is explained in -:ref:`extending_chapter`. The heavier hammer way allows you to -replace a :term:`view` wholesale rather than resources that might be -used by a view. - .. index:: single: override_resource diff --git a/docs/narr/webob.rst b/docs/narr/webob.rst index 92de9d409..c4805df8d 100644 --- a/docs/narr/webob.rst +++ b/docs/narr/webob.rst @@ -124,19 +124,39 @@ URLs In addition to these attributes, there are several ways to get the URL of the request. I'll show various values for an example URL -``http://localhost/app/?id=10``, where the application is mounted at +``http://localhost/app/blog?id=10``, where the application is mounted at ``http://localhost/app``. ``req.url``: The full request URL, with query string, e.g., - ``http://localhost/app/?id=10`` + ``http://localhost/app/blog?id=10`` + +``req.host``: + The host information in the URL, e.g., + ``localhost`` + +``req.host_url``: + The URL with the host, e.g., ``http://localhost`` ``req.application_url``: The URL of the application (just the SCRIPT_NAME portion of the path, not PATH_INFO). E.g., ``http://localhost/app`` -``req.host_url``: - The URL with the host, e.g., ``http://localhost`` +``req.path_url``: + The URL of the application including the PATH_INFO. e.g., + ``http://localhost/app/blog`` + +``req.path``: + The URL including PATH_INFO without the host or scheme. e.g., + ``/app/blog`` + +``req.path_qs``: + The URL including PATH_INFO and the query string. e.g, + ``/app/blog?id=10`` + +``req.query_string``: + The query string in the URL, e.g., + ``id=10`` ``req.relative_url(url, to_application=False)``: Gives a URL, relative to the current URL. If ``to_application`` diff --git a/docs/tutorials/wiki2/basiclayout.rst b/docs/tutorials/wiki2/basiclayout.rst index 3e17f76e3..565bd0e96 100644 --- a/docs/tutorials/wiki2/basiclayout.rst +++ b/docs/tutorials/wiki2/basiclayout.rst @@ -19,12 +19,12 @@ an ``__init__.py`` file. Even if empty, this marks a directory as a Python package. We use ``__init__.py`` both as a package marker and to contain configuration code. -When you run the application using the ``paster`` command using the -``development.ini`` generated config file, the application configuration -points at an Setuptools *entry point* described as ``egg:tutorial#app``. In -our application, because the application's ``setup.py`` file says so, this -entry point happens to be the ``app`` function within the file named -``__init__.py``: +The generated ``development.ini`` file is read by ``paster`` which looks for +the application module in the ``use`` variable of the ``app:tutorial`` +section. The *entry point* is defined in the Setuptools configuration of this +module, specifically in the ``setup.py`` file. For this tutorial, the *entry +point* is defined as ``tutorial:main`` and points to the following ``main`` +function: .. literalinclude:: src/basiclayout/tutorial/__init__.py :linenos: diff --git a/pyramid/registry.py b/pyramid/registry.py index 0063abfef..37e230dc3 100644 --- a/pyramid/registry.py +++ b/pyramid/registry.py @@ -27,7 +27,7 @@ class Registry(Components, dict): result = Components.registerSubscriptionAdapter(self, *arg, **kw) self.has_listeners = True return result - + def registerHandler(self, *arg, **kw): result = Components.registerHandler(self, *arg, **kw) self.has_listeners = True diff --git a/pyramid/renderers.py b/pyramid/renderers.py index ba29f80d0..69c5f7275 100644 --- a/pyramid/renderers.py +++ b/pyramid/renderers.py @@ -158,7 +158,7 @@ class ChameleonRendererLookup(object): self.impl = impl self.registry = registry self.lock = threading.Lock() - + def get_spec(self, name, package): spec = name isabs = os.path.isabs(name) @@ -247,7 +247,7 @@ def template_renderer_factory(info, impl, lock=registry_lock): return lookup(info) # XXX deprecate -def renderer_from_name(path, package=None): +def renderer_from_name(path, package=None): return RendererHelper(name=path, package=package).renderer class RendererHelper(object): @@ -281,7 +281,7 @@ class RendererHelper(object): def get_renderer(self): return self.renderer - + def render(self, value, system_values, request=None): renderer = self.renderer if system_values is None: @@ -337,4 +337,3 @@ class RendererHelper(object): response.cache_expires = cache_for return response - diff --git a/pyramid/threadlocal.py b/pyramid/threadlocal.py index f08057453..d99b0b734 100644 --- a/pyramid/threadlocal.py +++ b/pyramid/threadlocal.py @@ -5,13 +5,13 @@ from pyramid.registry import global_registry class ThreadLocalManager(threading.local): def __init__(self, default=None): # http://code.google.com/p/google-app-engine-django/issues/detail?id=119 - # we *must* use a keword argument for ``default`` here instead + # we *must* use a keyword argument for ``default`` here instead # of a positional argument to work around a bug in the # implementation of _threading_local.local in Python, which is # used by GAE instead of _thread.local self.stack = [] self.default = default - + def push(self, info): self.stack.append(info) @@ -58,4 +58,3 @@ def get_current_registry(context=None): # context required by getSiteManager API tested nor scripted. """ return manager.get()['registry'] - diff --git a/pyramid/wsgi.py b/pyramid/wsgi.py index 3b2bd0bc2..69a250534 100644 --- a/pyramid/wsgi.py +++ b/pyramid/wsgi.py @@ -34,7 +34,7 @@ def wsgiapp(wrapped): application to a :term:`Response` and return it to :app:`Pyramid` as if the WSGI app were a :mod:`pyramid` view. - + """ def decorator(context, request): return request.get_response(wrapped) @@ -74,7 +74,7 @@ def wsgiapp2(wrapped): the WSGI app were a :app:`Pyramid` view. The ``SCRIPT_NAME`` and ``PATH_INFO`` values present in the WSGI environment are fixed up before the application is invoked. """ - + def decorator(context, request): traversed = request.traversed vroot_path = request.virtual_root_path or () @@ -94,4 +94,3 @@ def wsgiapp2(wrapped): request.environ['SCRIPT_NAME'] = script_name return request.get_response(wrapped) return wraps(wrapped)(decorator) # grokkability - |
