Skip to content

Instantly share code, notes, and snippets.

@binarymatt
Created July 13, 2012 03:08
Show Gist options
  • Save binarymatt/3102435 to your computer and use it in GitHub Desktop.
Save binarymatt/3102435 to your computer and use it in GitHub Desktop.
pyramid all in one route defintion
import venusian
class route(object):
venusian = venusian
def __init__(self, name, url):
self.name = name
self.url = url
def __call__(self, function):
def callback(context, name, ob):
config = context.config.with_package(info.module)
config.add_route(self.name, self.url)
config.add_view(function, route_name=self.name)
info = self.venusian.attach(function, callback, category='pyramid')
return function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment