I just noticed when I try and use that class inside my search function
(in controllers/default.py) it works fine. So it must be something to
do with importing and using it?
On Aug 23, 3:50 am, Bruno Rocha wrote:
> This should work
>
> http://pastie.org/2412537
I get the same error? :(
On Aug 23, 3:50 am, Bruno Rocha wrote:
> This should work
>
> http://pastie.org/2412537
This should work
http://pastie.org/2412537
I'm not sure why you're getting that specific error, but I see a few
problems:
This may be a typo, but your module pastie says the module is named
object.py (which is probably not a good idea, since 'object' is a Python
builtin), but the controller says 'from objects import Search' (note the
Module:
http://pastie.org/2411032
Controller:
http://pastie.org/2411038
View:
http://pastie.org/2411047
That should be everything, thanks for the help man, I really
appreciate it! :)
On Aug 22, 9:27 pm, Bruno Rocha wrote:
> share your whole code in some pastie, gist or send the .py files I wil
share your whole code in some pastie, gist or send the .py files I will take
a look and try it here.
Yep just tried it then, same error unfortunately :(
On Aug 22, 8:15 pm, Bruno Rocha wrote:
> did you imported in this way:
>
> from objects import Search
>
> return dict(search=Search.show(db))
>
> ???
did you imported in this way:
from objects import Search
return dict(search=Search.show(db))
???
:( making an instance or adding @staticmethod won't work either, why
is it returning the error saying it has no attribute 'show'? why is it
looking for an attribute shouldn't it be saying it has no function at
least?
On Aug 22, 6:38 pm, Bruno Rocha wrote:
> ok small corretion, you need it as stat
ok small corretion, you need it as staticmethod (or need a instance before
calling)
change to:
class Search(object):
@*staticmethod*
def show(db):
*Explanations about imports:*
from gluon impot *
The above is to have access to web2py helpers and other gluon modules, if
you d
I've run into a problem, why won't this work:
# controllers/default.py
def search():
return dict(showsearch=objects.Search.show(db))
# controllers/default.py
# modules/objects.py
from gluon import *
request = current.request
class Search(object):
def show(self, db):
search =
db(d
1 more thing, could you explain these lines please:
from gluon import *
request = current.request
On Aug 22, 4:46 pm, Bruno Rocha wrote:
> I guess it is not wrong, but I do not recommend too much code in
> controllers, controllers should be for decide the app flow.
>
> I reccomend you to create
Great advice, I'll do that :)
Thanks, Bruno!
On Aug 22, 4:46 pm, Bruno Rocha wrote:
> I guess it is not wrong, but I do not recommend too much code in
> controllers, controllers should be for decide the app flow.
>
> I reccomend you to create a module in /modules
>
> # modules/myobjects.py
> fro
13 matches
Mail list logo