Or for more portability

exec('import applications.%s.modules.mylib as mylib' %
request.application)

Massimo

On 22 Apr, 07:41, Iceberg <iceb...@21cn.com> wrote:
> Just as usual, in your whatever app's controllers/default.py, you can
> do:
>
>   import applications.share.modules.mylib
>
> On Apr22, 8:27pm, Timmie <timmichel...@gmx-topmail.de> wrote:
>
> > This is exactly what I am looking for!
>
> > How would you import / reuse the "modules/mylib.py"?
>
> > many thanks & regards,
> > Timmie
>
> > On 22 Apr., 10:49, Iceberg <iceb...@21cn.com> wrote:
>
> > > I did this before. Maybe it can help you too.
>
> > > There are some "resources" need to be shared among many of my apps.
> > > These resources include public documents (*.html, *.pdf, *.swf, *.js,
> > > even modules/mylib.py etc). I wrapped them inside an dedicated app
> > > named "share", so that in my other app I can refer to those resources
> > > by "share". For example, in app foo I can do:
>
> > > index.html
> > >   <script src="{{=URL(a='share',c='static',f='my_util.js')}}"
> > > type="text/javascript"></script>
> > >   <a href="{{=URL(a='share',c='static',f='bio.pdf')}}">About Us</a>
--~--~---------~--~----~------------~-------~--~----~
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