So, I had put this:

from gluon.custom_import import track_changes; track_changes(True)

in my primary model, db.py.

But, it seemed to do no good.  On a lark, I restarted apache (thereby,
web2py).  And it worked.  My subsequent changes to the module now seem
to get picked up.

It seems it is not enough to put the auto-reload modules thing into a
model.  After doing so, it seems you have to restart web2py.

does this make sense?

By, the way I got the whole thing working, but I have so many "self's"
in the class it drives me crazy.  But, the controller is WAY simple
now.

On Feb 21, 9:40 pm, Lewis <[email protected]> wrote:
> This is the classic noob problem.  Defining a class and getting
> arguments mis-match when first instantiating an instance of the
> class.  But, I can't see where the problem is.
>
> Traceback (most recent call last):
>   File "/var/web2py/gluon/restricted.py", line 204, in restricted
>     exec ccode in environment
>   File "/var/web2py/applications/pyjokes/controllers/default.py", line
> 384, in <module>
>   File "/var/web2py/gluon/globals.py", line 172, in <lambda>
>     self._caller = lambda f: f()
>   File "/var/web2py/gluon/tools.py", line 2533, in f
>     return action(*a, **b)
>   File "/var/web2py/applications/pyjokes/controllers/default.py", line
> 376, in test
>     b = builder.Build_jokes(jodb)
> TypeError: __init__() takes exactly 1 argument (2 given)
>
> What follows is the definition of the class in a module.  __init__
> takes self and one additional argument:
>
> class Build_jokes:
>     """
>     docstring...
>     """
>
>     def __init__(self, dbhandle):
>         self.jodb = dbhandle
>         self.sortrequest = 'category'
>         self.sort_order = {'author': self.jodb.auth_user.last_name,
> 'category': self.jodb.category.name}
>         self.catquery = self.jodb.category.id>0
>         self.authorquery = self.jodb.joke.created_by>0
>
>     def anothermethod():
>         ... code ...
>
> Here is a controller/action (it's just a test for now--and not
> working!) where I try to access the class:
>
> def test():
>     import builder
>     b = builder.Build_jokes(jodb)       #Note:  this is line 376
> referenced in traceback
>     b.controls()
>     b.displayjokes()
>     form = DIV(b.sortfilter, b.joketable)
>
> Yes, the module and controller are in the same application. I've been
> looking at it for hours--I can't see where the argument mismatch is.

Reply via email to