Belphenor
(usa Linux Mint)
Enviado em 31/05/2015 - 23:38h
galera, estou aprendendo a lidar com o web.py e tem um erro que não consigo entender e muito menos resolver:
basicamente quando tento executar minha aplicação aparece a seguinte mensagem:
______________________________________________________________________
<type 'exceptions.TypeError'> at /
GET() takes exactly 2 arguments (1 given)
Python /usr/lib/python2.7/site-packages/web/application.py in handle_class, line 395
Web GET
http://0.0.0.0:1234/
Traceback (innermost first)
/usr/lib/python2.7/site-packages/web/application.py in handle_class
return tocall(*args) ...
▶ Local vars
/usr/lib/python2.7/site-packages/web/application.py in _delegate
raise web.redirect(url)
elif '.' in f:
mod, cls = f.rsplit('.', 1)
mod = __import__(mod, None, None, [''])
cls = getattr(mod, cls)
else:
cls = fvars[f]
return handle_class(cls) ...
elif hasattr(f, '__call__'):
return f()
else:
return web.notfound()
def _match(self, mapping, value):
▶ Local vars
/usr/lib/python2.7/site-packages/web/application.py in handle
return self._delegate(fn, self.fvars, args) ...
▶ Local vars
/usr/lib/python2.7/site-packages/web/application.py in process
return self.handle() ...
▶ Local vars
__________________________________________________________________________
e este é meu codigo:
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import web
render = web.template.render('templates/')
urls = (
'/', 'index' )
class index:
def GET(self):
todos = db.select('todo')
return render.index(todos)
if __name__ == "__main__":
app = web.application(urls, globals())
db = web.database(dbn='mysql', user='root', pw='senha1', db='python')
app.run()