Created
July 13, 2012 03:08
-
-
Save binarymatt/3102435 to your computer and use it in GitHub Desktop.
pyramid all in one route defintion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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