I'm moving a whole bunch of (perfectly functional) business logic from
model files to custom modules. But when I try to import the modules in my
controllers custom_import is throwing an error. Here's the traceback:
File "/home/ian/web2py/gluon/restricted.py", line 204, in restricted
exec ccode in environment
File "/home/ian/web2py/applications/paideia/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/paideia/controllers/default.py>, line
5, in <module>
import paideia_stats, paideia_timestats, paideia_weeklycount
File "/home/ian/web2py/gluon/custom_import.py", line 284, in __call__
globals, locals, fromlist, level)
File "/home/ian/web2py/gluon/custom_import.py", line 312, in __import__dot
locals, [name], level)
File "/home/ian/web2py/gluon/custom_import.py", line 132, in __call__
raise e # Don't hide something that went wrong
TypeError: __init__() takes at least 2 arguments (1 given)
Here's the import statement that opens the controller:
4 import datetime
5 from paideia_stats import paideia_stats, paideia_timestats,
paideia_weeklycount
6 from paideia_bugs import paideia_bugs
The import of datetime is working fine, but custom_import is choking on my
first import from appname/modules/ (where I've placed the paideia_stats.py
module file). I've done a lot of work to try and track down the problem, but I
think I just don't know the core classes well enough. Any help would be greatly
appreciated.