Skip to main content

Small Pyramid extension for rewriting urls

Project description

Introduction

pyramid_rewrite is a small extension for Pyramid to rewrite urls before further processing takes place.

Installation

Just do

pip install pyramid_rewrite

or

easy_install pyramid_rewrite

Compatibility

pyramid_rewrite runs with pyramid>=1.3 and python>=2.6 and python>=3.2. Other versions might also work.

Documentation

Usage example:

def main(global_config, **settings):
    config = Configurator(settings=settings)
    config.include('pyramid_rewrite')
    # add url rewriting rules...
    #   first parameter is a regular expression
    #   second parameter is the target url
    config.add_rewrite_rule(r'/favicon.ico', r'/static/favicon.ico')
    config.add_rewrite_rule(r'/gallery/(?P<subpath>.*)',
                            r'/root/%(subpath)s')
    #
    # ... rest of configuration
    #
    # return WSGI application instance
    return config.make_wsgi_app()

Better documentation might follow.

Changes

0.2

  • Added unit tests

  • Changed logging level

0.1

  • Initial version. Working.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyramid_rewrite-0.2.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distributions

pyramid_rewrite-0.2-py3.2.egg (4.3 kB view hashes)

Uploaded Source

pyramid_rewrite-0.2-py2.7.egg (6.4 kB view hashes)

Uploaded Source

pyramid_rewrite-0.2-py2.6.egg (6.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page