Latest Version: 0.9.6.2

Warning

This documentation does not refer to the most recent version of Pylons. Current Documentation

helpers

Myghty compatibility object, etag_cache, redirect_to and Myghty Module Components

Additional helper object available for use in Controllers is the etag_cache, along with the Myghty compatibility objects for Pylons 0.8 projects and new Myghty Module Components for use in Myghty templates.


Functions

f redirect_to() ...

Issues a redirect based on the arguments.

Redirect's should occur as a "302 Moved" header, however the web framework may utilize a different method.

All arguments are passed to url_for to retrieve the appropriate URL, then the resulting URL it sent to the redirect function as the URL.

f etag_cache(key=None) ...

Use the HTTP Entity Tag cache for Browser side caching

If a "If-None-Match" header is found, and equivilant to key, then a 304 HTTP message will be returned with the ETag to tell the browser that it should use its current cache of the page.

Otherwise, the ETag header will be added to a new response object and returned for use in your action.

Suggested use is within a Controller Action like so:

import pylons

class YourController(BaseController):
    def index(self):
        resp = etag_cache(key=1)
        resp.write(render('/splash.myt'))
        return resp

Note

This works because etag_cache will raise an HTTPNotModified exception if the ETag recieved matches the key provided.

See the source for more information.

Top