This file contains 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
def ActuallyCalls(fn, namearg=None): | |
class __ActuallyCalls(object): | |
class __metaclass__(type): | |
def __new__(cls, name, supers, kwargs): | |
if name == '__ActuallyCalls': | |
return type.__new__(cls, name, supers, kwargs) | |
kwargs.pop('__module__', None) | |
if namearg: | |
kwargs[namearg] = name | |
return fn(**kwargs) |
This file contains 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
This quick hack wraps the filenames in the Werkzeug debugger with a link that opens them in my editor. | |
In my particular case I have Sublime Text and SublHandler on OS X (urls below), so my links point to subl://open/?url=<file url>, but you can easily change this for any other URL handler. | |
Sublime Text: http://www.sublimetext.com/ | |
SublHandler (for OS X): https://github.com/asuth/subl-handler |
This file contains 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 flask | |
class RoutingData(object): | |
def __init__(self, args, kwargs): | |
super(RoutingData, self).__init__() | |
self.args = args | |
self.kwargs = kwargs | |
def route(*args, **kwargs): | |
def wrap(fn): |
This file contains 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 flask | |
class HelloApp(flask.Flask): | |
def __init__(self, import_name): | |
super(HelloApp, self).__init__(import_name) | |
self.route("/hello")(self.hello) | |
def hello(self): | |
return "Hello, world!" |
NewerOlder