skip to navigation
skip to content

pyramid 1.0a1

The Pyramid web application framework, a Pylons project

Latest Version: 1.9.1

Pyramid

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 project, and underlies the newest web frameworks produced by the Pylons community.

pyramid was previously known as repoze.bfg.

Support and Documentation

See the Pylons Project website to view documentation, report bugs, and obtain support.

License

pyramid is offered under the BSD-derived Repoze Public License.

Authors

pyramid is made available by Agendaless Consulting and a team of contributors.

1.0a1 (2010-11-05)

Features (delta from BFG 1.3)

  • Mako templating renderer supports resource specification format for template lookups and within Mako templates. Absolute filenames must be used in Pyramid to avoid this lookup process.

  • Add pyramid.httpexceptions module, which is a facade for the webob.exc module.

  • Direct built-in support for the Mako templating language.

  • A new configurator method exists: add_handler. This method adds a Pylons-style “view handler” (such a thing used to be called a “controller” in Pylons 1.0).

  • New argument to configurator: session_factory.

  • New method on configurator: set_session_factory

  • Using request.session now returns a (dictionary-like) session object if a session factory has been configured.

  • The request now has a new attribute: tmpl_context for benefit of Pylons users.

  • The decorator previously known as pyramid.view.bfg_view is now known most formally as pyramid.view.view_config in docs and paster templates. An import of pyramid.view.bfg_view, however, will continue to work “forever”.

  • New API methods in pyramid.session: signed_serialize and signed_deserialize.

  • New interface: pyramid.interfaces.IRendererInfo. An object of this type is passed to renderer factory constructors (see “Backwards Incompatibilities”).

  • New event type: pyramid.interfaces.IBeforeRender. An object of this type is sent as an event before a renderer is invoked (but after the application-level renderer globals factory added via pyramid.configurator.configuration.set_renderer_globals_factory, if any, has injected its own keys). Applications may now subscribe to the IBeforeRender event type in order to introspect the and modify the set of renderer globals before they are passed to a renderer. The event object iself has a dictionary-like interface that can be used for this purpose. For example:

    from repoze.events import subscriber
    from pyramid.interfaces import IRendererGlobalsEvent
    
    @subscriber(IRendererGlobalsEvent)
    def add_global(event):
        event['mykey'] = 'foo'
    

    If a subscriber attempts to add a key that already exist in the renderer globals dictionary, a KeyError is raised. This limitation is due to the fact that subscribers cannot be ordered relative to each other. The set of keys added to the renderer globals dictionary by all subscribers and app-level globals factories must be unique.

  • New class: pyramid.response.Response. This is a pure facade for webob.Response (old code need not change to use this facade, it’s existence is mostly for vanity and documentation-generation purposes).

  • All preexisting paster templates (except zodb) now use “imperative” configuration (starter, routesalchemy, alchemy).

  • A new paster template named pyramid_starter_zcml exists, which uses declarative configuration.

Documentation (delta from BFG 1.3)

  • Added a pyramid.httpexceptions API documentation chapter.
  • Added a pyramid.session API documentation chapter.
  • Added a Session Objects narrative documentation chapter.
  • Added an API chapter for the pyramid.personality module.
  • Added an API chapter for the pyramid.response module.
  • All documentation which previously referred to webob.Response now uses pyramid.response.Response instead.
  • The documentation has been overhauled to use imperative configuration, moving declarative configuration (ZCML) explanations to a separate narrative chapter declarative.rst.
  • The ZODB Wiki tutorial was updated to take into account changes to the pyramid_zodb paster template.
  • The SQL Wiki tutorial was updated to take into account changes to the pyramid_routesalchemy paster template.

Backwards Incompatibilities (with BFG 1.3)

  • There is no longer an IDebugLogger registered as a named utility with the name repoze.bfg.debug.

  • The logger which used to have the name of repoze.bfg.debug now has the name pyramid.debug.

  • The deprecated API pyramid.testing.registerViewPermission has been removed.

  • The deprecated API named pyramid.testing.registerRoutesMapper has been removed.

  • The deprecated API named pyramid.request.get_request was removed.

  • The deprecated API named pyramid.security.Unauthorized was removed.

  • The deprecated API named pyramid.view.view_execution_permitted was removed.

  • The deprecated API named pyramid.view.NotFound was removed.

  • The bfgshell paster command is now named pshell.

  • The Venusian “category” for all built-in Venusian decorators (e.g. subscriber and view_config/bfg_view) is now pyramid instead of bfg.

  • pyramid.renderers.rendered_response function removed; use render_pyramid.renderers.render_to_response instead.

  • Renderer factories now accept a renderer info object rather than an absolute resource specification or an absolute path. The object has the following attributes: name (the renderer= value), package (the ‘current package’ when the renderer configuration statement was found), type: the renderer type, registry: the current registry, and settings: the deployment settings dictionary.

    Third-party repoze.bfg renderer implementations that must be ported to Pyramid will need to account for this.

    This change was made primarily to support more flexible Mako template rendering.

  • The presence of the key repoze.bfg.message in the WSGI environment when an exception occurs is now deprecated. Instead, code which relies on this environ value should use the exception attribute of the request (e.g. request.exception[0]) to retrieve the message.

  • The values bfg_localizer and bfg_locale_name kept on the request during internationalization for caching purposes were never APIs. These however have changed to localizer and locale_name, respectively.

  • The default cookie_name value of the authtktauthenticationpolicy ZCML now defaults to auth_tkt (it used to default to repoze.bfg.auth_tkt).

  • The default cookie_name value of the pyramid.authentication.AuthTktAuthenticationPolicy constructor now defaults to auth_tkt (it used to default to repoze.bfg.auth_tkt).

  • The request_type argument to the view ZCML directive, the pyramid.configuration.Configurator.add_view method, or the pyramid.view.view_config decorator (nee bfg_view) is no longer permitted to be one of the strings GET, HEAD, PUT, POST or DELETE, and now must always be an interface. Accepting the method-strings as request_type was a backwards compatibility strategy servicing repoze.bfg 1.0 applications. Use the request_method parameter instead to specify that a view a string request-method predicate.

 
File Type Py Version Uploaded on Size
pyramid-1.0a1.tar.gz (md5) Source 2010-11-05 1MB