Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

A set of sane routing defaults for the Pyramid web framework

Project Description

tomb_routes

Intro

A set of simple defaults for Pyramid routing.

Pyramid’s URL dispatch has separate concepts for routes and views. This gives additional flexibility in that you can one route map to multiple views, using different predicates (e.g.: predicates depending on Accept header, whether request is XHR or not, etc.). In many applications, this flexibility is not needed and having both routes and views adds a bit of complexity and duplication, and reduces DRYness. This module implements some easy-to-use mechanisms that create a route and a view in one step, resulting in simpler, easier to understand code. This kind of makes Pyramid’s routing look a bit more like Flask, albeit without Flask’s controversial thread locals.

You can use simple_route as a decorator:

from tomb_routes import simple_route
from pyramid.response import Response

@simple_route('/hello/{name}')
def my_route(request, name):
    return Response('Hello %s' % name)

or you can use it from the configurator:

config.include('tomb_routes')
config.add_simple_route(
    '/hello/{name}', view_callable,
    renderer='json'
)

Inspirations

Frameworks with very simple routing (including so-called “microframeworks”) are nothing new. Here are a few in the Python world:

Pyramid is a very powerful and extensible web framework and it’s a framework that we love, but sometimes we want very simple routing. This package brings the simplified routing from microframeworks to Pyramid, so we can have our cake and eat it too.

Release History

Release History

This version
History Node

0.0.8

History Node

0.0.8.dev1

History Node

0.0.7

History Node

0.0.6

History Node

0.0.5

History Node

0.0.4

History Node

0.0.3.dev15

History Node

0.0.2

History Node

0.0.1

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tomb_routes-0.0.8.tar.gz (6.9 kB) Copy SHA256 Checksum SHA256 Source Apr 29, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting