Last active
December 11, 2015 04:58
-
-
Save spicavigo/4548648 to your computer and use it in GitHub Desktop.
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
URLS=[] | |
def create_url(url, method='get'): | |
def wrapper(func): | |
cls = type(func.func_name + 'Handler', (BaseHandler,), {method.lower():func}) | |
URLS.append((url, cls)) | |
def inner(*args, **kwargs): | |
return func(*args, **kwargs) | |
return inner | |
return wrapper | |
... Your Functions... | |
app = webapp2.WSGIApplication(URLS, debug=os.environ['SERVER_SOFTWARE'].startswith('Dev')) | |
""" | |
Usage: | |
@create_url(<path>, [<get or post>]) | |
def function(self): | |
... YOUR CODE ... | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment