Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: 1.4-branch
Fetching contributors…

Cannot retrieve contributors at this time

373 lines (289 sloc) 17.517 kB

What's New In Pyramid 1.4

This article explains the new features in :app:`Pyramid` version 1.4 as compared to its predecessor, :app:`Pyramid` 1.3. It also documents backwards incompatibilities between the two versions and deprecations added to :app:`Pyramid` 1.4, as well as software dependency changes and notable documentation additions.

Major Feature Additions

The major feature additions in Pyramid 1.4 follow.

Third-Party Predicates

Easy Custom JSON Serialization

  • Views can now return custom objects which will be serialized to JSON by a JSON renderer by defining a __json__ method on the object's class. This method should return values natively serializable by json.dumps (such as ints, lists, dictionaries, strings, and so forth). See :ref:`json_serializing_custom_objects` for more information. The JSON renderer now also allows for the definition of custom type adapters to convert unknown objects to JSON serializations, in case you can't add a __json__ method to returned objects.

Partial Mako and Chameleon Template Renderings

  • The Mako renderer now supports using a def name in an asset spec. When the def name is present in the asset spec, the system will render the template named def within the template instead of rendering the entire template. An example asset spec which names a def is package:path/to/template#defname.mako. This will render the def named defname inside the template.mako template instead of rendering the entire template. The old way of returning a tuple in the form ('defname', {}) from the view is supported for backward compatibility.
  • The Chameleon ZPT renderer now supports using a macro name in an asset spec. When the macro name is present in the asset spec, the system will render the macro listed as a define-macro and return the result instead of rendering the entire template. An example asset spec: package:path/to/template#macroname.pt. This will render the macro defined as macroname within the template.pt template instead of the entire template.

Subrequest Support

Minor Feature Additions

Backwards Incompatibilities

Deprecations

Documentation Enhancements

Dependency Changes

  • Pyramid now requires WebOb 1.2b3+ (the prior Pyramid release only relied on 1.2dev+). This is to ensure that we obtain a version of WebOb that returns request.path_info as text.
Jump to Line
Something went wrong with that request. Please try again.