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


Release history Release notifications

This version
History Node

0.2

History Node

0.1

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
pyramid_rewrite-0.2-py2.6.egg (6.4 kB) Copy SHA256 hash SHA256 Egg 2.6 Feb 5, 2012
pyramid_rewrite-0.2-py2.7.egg (6.4 kB) Copy SHA256 hash SHA256 Egg 2.7 Feb 5, 2012
pyramid_rewrite-0.2-py3.2.egg (4.3 kB) Copy SHA256 hash SHA256 Egg 3.2 Feb 5, 2012
pyramid_rewrite-0.2.tar.gz (4.1 kB) Copy SHA256 hash SHA256 Source None Feb 5, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page