Just some thought. Is it a good idea that if web2py can automatically
do this BEFORE accessing an app?

old_syspath=sys.path
sys.path.append(os.path.abspath('applications/%s/
modules'%request.application))
try:
  serve_currect_request()
finally: sys.path=old_syspath # So that different app won't mess up
their own modules

In this way, hopefully app can call third party modules in the usual,
simple, straightforward way, like this:

  import mylib  # rather than: import applications.myapp.modules.mylib

On Apr23, 11:19am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> probably
>
>   import applications.myapp.modules.modulefolder.twitter as twitter
>
> or better
>
>   exec('import applications.%s.modules.modulefolder.twitter as
> twitter' % request.application)
>
> Massimo
>
> On 22 Apr, 22:03, Michael <michael.no...@gmail.com> wrote:
>
> > This makes sense, but do i put the whole folder inside of modules?
>
> > would i access the library by saying
>
> > import applications.myapp.modules.modulefolder
>
> > or
>
> > import applications.myapp.modules.modulefolder.twitter.py
>
> > thanks! sorry for being such a newb ;P
>
> > On Apr 22, 10:02 pm, Iceberg <iceb...@21cn.com> wrote:
>
> > > I don't know mac, but when using Windows binary (the web2py_win.zip),
> > > I can always put 3rd party libraries into web2py/applications/myapp/
> > > modules, then access it, in a slightly different way:
>
> > >   import applications.myapp.modules.third_parti_lib
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to