On Jul1, 12:08pm, Xie <[email protected]> wrote: > Recently I'm having some trouble with web2py but I don't know where > the problem is. My best guess is that it's about the MVC namespace. > Please correct me if I'm wrong. > > The problem is that I defined a class "App" in models/utils.py and > when I tried to inherit this class in another .py file under the > models directory, web2py told me that class "App" is not found. I was > confused and moved class "App" to db.py(where database connection is > defined) and *bang*, it worked. No more error ticket and class "App" > is successfully inherited. > > I'm not that familiar with web2py internals. Why did this happen? Is > there any resolution order or something? > > Thanks > > -- Xie
web2py loads models in alphabetic order. So you need to make sure your basic definition comes prior to your "another .py file". For example, "models/0_setting.py" is kind of de facto convention. However, I would recommend you to put your basic things inside modules/ whatever.py, this way you might have more flexibility. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

