Am working on a simple game/app. When I call a variable on web2py view, I get this error:
quack= duck.quack()
TypeError: unbound method quack() must be called with duck instance as first argument (got nothing instead)
my codes are here: In the module module
from gluon import *
class duck():
def quack():
return 'Quacks like a duck'
def walk():
return 'Walks like a person'
In the controller
def data_filters():
fils = duck.quack()
return dict(fils=fils)
In the view:
{{extend 'layout.html'}}
{{=fils}}
class Duck():
def quack(self):
return 'Quacks like a duck'
def walk(self):
return 'Walks like a person'
def data_filters():
duck = Duck()
fils = duck.quack()
return dict(fils=fils)
class Duck(object):
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/zWGI68D2VDA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.