> In my case, I would create a widgets.py file in the modules folder of > my application, put the widget code in widgets.py, in my model import > the widgets (from modules import widgets) and use it like this: > widget=timeplain. Wouldn't I? Very nearly! Since your web site is running as part of web2py, which has its current-working-directory as the web2py directory, you'll want:
from applications.<your appname>.modules.widgets import timeplain e.g. from applications.timetable.modules.widgets import timeplain if your application is called "timetable". You could do do from applications.timetable.modules.widgets import * If you were sure none of the functions/classes in widgets.py were called the same thing as something else in your name space. That would pull in everything from widgets.py, including timeplain. Then you can do widget=timeplain. Note also that: - at the top of widgets.py you'll need from gluon.sqlhtml import INPUT so that timeplain can find INPUT - the advantage of using modules is that the file is only sourced once when the server starts up. If you change the module file after it has been successfully imported the server won't pick up the changes unless you restart it. In the Windows binary version of web2py it doesn't seem to be enough to right click on the taskbar widget and choose "restart server": I needed to 'Exit' and restart fully. Good luck with the rest of your app. Chris --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

