PylonsHQ.

Layout: Fixed-width

0.9.6

Skip to end of metadata
Go to start of metadata

For those upgrading, please keep in mind that deprecation warnings are just that... warnings. Your application is not broken when you see them, and you should feel free to update your project to remedy them at your own pace. The easiest way to update your Pylons project is by following the directions on upgrading on the wiki here: http://wiki.pylonshq.com/display/pylonsdocs/Upgrading

Note that the backup option is recommended, then merge your changes into the new project files. In the future we're also looking at making it possible for 3-way merges on project templates which will mostly automate this task.

Additional Thanks
------------------------

  • I'd really like to thank Brendan Arnold for kicking off the whole "people in a hurry" doc series.
  • Ches Martin did an excellent job updating both the QuickWiki docs and the QuickWiki Pylons project, thanks a bunch!
  • David Smith joined the Pylons developer team, and has been helping out here and there.
  • Phil Jenvey for all his hard work
  • Patch submissions from David Turner, David Smith, and others whose name escapes me.
  • Bug reports from the active IRC channel, many thanks to all of you.

Changes
------------

Global Response object:

One of the bigger changes in 0.9.6 is the new way to return responses (Note that returning Response objects is still allowed, but is being phased out). A global response object is now made available which can track cookies, headers, and the status code to return to clients, as well as content. This means your controller actions only need to return content, such as a string or generator. This 0.9.5 example:

1
return Response("Hello World")

Is now just:

1
return "Hello World"

The content will be merged into the global response object for you. This will make it easier to set cookies and headers in your controllers without worrying whether or not it will really make it into the response.

Returning a Response object will generate a PendingDeprecationWarning in 0.9.6, and will generate a DeprecationWarning in 0.9.7. PendingDeprecationWarnings are hidden, by default; temporarily enabling them can aid in migrating your projects from the old 0.9.5 style to the new style. This can be done by adding the following code to your load_environment function:

1
2
import warnings
warnings.simplefilter('default', PendingDeprecationWarning)

Uniform Config Access:

Getting to the configuration for your project during start-up, and during handling of a request was previously a little tough. It required different methods and helper functions to reliably find where the configuration was. This has been fixed in 0.9.6, and there is a single pylons.config object that is available immediately after your projects environment was loaded.

Logging:

There is now logging throughout the entire Pylons code-base. This makes it easier to track down how your request is routed, to which controller, and how it has handled it. For those wondering why a certain action was called instead of another one, what arguments were passed to it, etc. this information should really help out. Phil Jenvey has put up a nice document on how to configure logging output to Chainsaw which really makes the new logging shine: http://wiki.pylonshq.com/display/pylonsdocs/Logging#lumberjacking-with-log4j-s-chainsaw

Default Template Language:

The default template language for Pylons 0.9.6 is now Mako. Myghty served us great, but provided Mike Bayer with a rather nasty code base filled with Perl port cruft to maintain that didn't have much of a future. Mako is an excellent update on Myghty, that provides a wonderfully fresh approach to Python templating as well as being the fastest Python templating language available.

Note that Myghty is still usable with Pylons, and people are free to continue using it as desired.

More Unicode:

The Pylons request object now returns unicode parameters by default. In 0.9.5 this was optional, while in 0.9.6 it is now on by default. Note that if you have code relying on request parameters being basic strings you will want to add the following line to your updated lib/environment.py module:

1
config['request_options']['charset'] = None

Or if you haven't updated your project template to 0.9.6, the following will disable unicode:

1
2
3
4
request_settings = pylons.config.request_defaults.copy()
request_settings['charset'] = None
return pylons.config.Config(tmpl_options, map, paths,                                    
                            request_settings=request_settings)

Templating Changes:

Template render statements beginning with a / mark will no longer have the dots replaced with slashes. This shouldn't affect most people using module style syntax as that generally implies you don't put a / at the front.

Database usage with SQLAlchemy:

There was quite a bit of debate about how to best handle using SQLAlchemy with Pylons. In the end however, it was decided that pylons.database is too limiting, and ties usage of SQLAlchemy to specific versions of Pylons in ways that don't benefit either project. For those using SQLAlchemy 0.3, the best choice is using SAContext and is documented in the In a Hurry docs: http://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+0.3+for+people+in+a+hurry

For those using SQLAlchemy 0.4, nothing besides 0.4 and Pylons 0.9.6 is needed, and using them together is documented here: http://wiki.pylonshq.com/display/pylonscookbook/SQLAlchemy+0.4+for+people+in+a+hurry

And finally, the full changelog of the various parts that make Pylons what it is (click to expand):

PYLONS

ROUTES

WEBHELPERS

PASTESCRIPT

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Powered by Pylons - Contact Administrators