Created
September 23, 2011 19:39
-
-
Save wickman/1238253 to your computer and use it in GitHub Desktop.
bottle bug simplest example
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 bottle | |
bottle.debug(True) | |
class BottleServer(object): | |
def __init__(self): | |
self.app = bottle.Bottle() | |
self.setup_routes() | |
def hello(self, **kw): | |
return 'hello: %s' % repr(kw) | |
def setup_routes(self): | |
self.app.route("/hello", callback=self.hello) | |
self.app.route("/hello/:first", callback=self.hello) | |
def run(self, hostname, port): | |
bottle.run(self.app, host=hostname, port=port) | |
bs = BottleServer() | |
bs.run('localhost', 8888) | |
Results in: | |
Traceback (most recent call last): | |
File "bottle_test.py", line 20, in <module> | |
bs = BottleServer() | |
File "bottle_test.py", line 8, in __init__ | |
self.setup_routes() | |
File "bottle_test.py", line 14, in setup_routes | |
self.app.route("/hello", callback=self.hello) | |
File "build/bdist.macosx-10.4-x86_64/egg/bottle.py", line 594, in route | |
File "build/bdist.macosx-10.4-x86_64/egg/bottle.py", line 591, in decorator | |
File "build/bdist.macosx-10.4-x86_64/egg/bottle.py", line 530, in _build_callback | |
File "/Users/wickman/Local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/functools.py", line 33, in update_wrapper | |
setattr(wrapper, attr, getattr(wrapped, attr)) | |
AttributeError: 'instancemethod' object has no attribute '__module__' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment