Re: ImportHooks vs imp
Tavis Rudd <[email protected]> Thu, 15 Jul 2010 14:10:18 -0700 (PDT)
| Newsgroups | gmane.comp.python.cheetah |
|---|---|
| Message-ID | <alpine.LNX.2.00.1007151408160.9905@o3> |
Hi, I can't think of any way to do that without either hacking the existing ImportHooks module (and I can't think of how you'd achieve what you want) or writing a new implementation that works with imp. Tavis On Mon, 12 Jul 2010, Богун Дмитрий wrote: > Hello. > > I need to make 2 sets of templates. One generic level, and some count of > overlays for gnereric templates. > > for example I have generic template /tmpl/web/main.tmpl and possible > overlays for it /tmpl/_users_/vasya/web/main.tmpl > and /tmpl/_users_/petya/web/main.tmpl. > > Now to load templates I use direct calls to Template.compile and give it > required open file descriptor. But this is not very comfortable. > > I want to try ImportHooks but, because of multiple, dynamically changed > search path, I don't want to add all path into sys.path. I want to use > imp module to load module from required places... After try I see that > ImportHooks and imp can't work together. > > Into attach my example, where I try to use ImportHooks and imp > toogether(_gen.tmpl and t0.tmpl locaten into /tmp/tmpl. empty > __init__.py too placed into /tmp/tmpl). > > Is there a way to use ImportHooks and not place all search path into > sys.path? > > PS Sorry for my English. > ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Cheetahtemplate-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss