I am surprised this ever worked as you say. The proper thing to do would be to do is to write
from ourlib import is_administrator In your models/db.py and it will be visible in all your models that follow db.py alphabetically and all your controllers and views. On Monday, 24 June 2013 13:41:11 UTC-5, Matt wrote: > > Yes, I am able to do that. But, in the __init__.py file inside the modules > directory I was also able to define something like "import simplejson as > json" (eg) and then it would act as if I imported that in all my > models/controllers/modules. > > For a more specific example, we have a method called "is_administrator" > that does a PAM check to see if the current user is an administrator on the > system. We use this method before 90% of our controller methods like so: > > @auth.requires(is_administrator(auth)) > > > so adding "from ourlib import is_administrator" to > <app>/modules/__init__.py meant that we didn't have to write "from ourlib > import is_administrator" at the top of every file in our controllers > directory. Was this just a mistake that it worked before? > > Matt > > > > > > On Monday, June 24, 2013 2:36:39 PM UTC-4, Massimo Di Pierro wrote: >> >> I am not sure what you mean. If you install a module under the modules/ >> folder you should be able to import it anywhere in the app. Is this not >> working? >> >> On Monday, 24 June 2013 13:09:59 UTC-5, Matt wrote: >>> >>> Previously we were able to define imports that we want shared across all >>> our models/controllers/modules by adding them to __init__.py in the >>> <app>/modules directory (eg. import simplejson as json). This doesn't seem >>> to work anymore, and I can't figure out what changed. Was this >>> functionality removed in recent web2py versions, or is there something else >>> getting in the way? >>> >>> Matt >>> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.