2011/6/20 selecta <gr...@delarue-berlin.de> > > I guess I can improve the design by replacing sys.modules by a class that > > will do the lockup in applications.appname if it fails like in this > example. > > How can I access appname from the code? I guess this is the new thread > > variable thing implemented recently. > > not sure i can follow you here, do you mean request.application?? no i > guess i'm lost >
It is a bit like you said but "request" is only available for models, controllers and views so the thread variable thing was added for core modules. I don't know yet if I can use this technique in gluon.custom_import. > > > > How much do you need this extra feature? > > well, what i want to do is to create an application that i can > distribute easily (pyMantis, ...) for this i need to be able to add > new modules in future distributions and remove them again if they are > not needed, so far I have written a plugin for creating releases (win > linux mac and web2py app packages) and updating running releases > (using the web2py app packages). The plugin currently looks into the > site packages folder and adds all site packages from a local myapp/ > site-packages directory. This i not so nice i think and also a bit > error-prone. So it would be nice to create web2py app packages that > just work without any further setup steps (just like web2pys > philosophy: batteries included) > Yes, but I think it is the only module to have that bug and it plays with low level stuff instead of doing standard imports. Before a fix is made, you try to replace: oldmod = sys.modules['pygments.lexers'] with: import pygments.lexers as oldmod -- A+ ------------- Pierre My blog and profile (http://pierrethibault.posterous.com)<http://pierrethibault.posterous.com> YouTube page (http://www.youtube.com/user/tubetib)<http://www.youtube.com/user/tubetib> Twitter (http://twitter.com/pierreth2) <http://twitter.com/pierreth2>