Re: propogating locals in sub-includes

"Jason Persampieri" <[email protected]> Thu, 13 Dec 2007 11:42:49 -0500
Newsgroups gmane.comp.python.spyce.general
Message-ID <[email protected]>
--===============0942582052==
Content-Type: multipart/alternative; 
	boundary="----=_Part_38883_32558397.1197564169522"

------=_Part_38883_32558397.1197564169522
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I ended up doing

locals().update(include.context)

before my include calls.  Not sure how clean it is, but it works.

Yeah, I'd love to use tags, but the included files need to be *very* simple
python/spyce files for the main user of this project.

_jason

On Dec 12, 2007 7:58 PM, Jonathan Ellis <[email protected]> wrote:

> It might work if you do
>
> A: include.spyce(B, locals())
> B: incluce.spyce(C, include.context)
> C: include.vars.foo
>
> But I'm not sure the include module is smart enough for that to work.
>
> The "modern" way to reuse code in spyce is custom tags.
>
> On Wed, 12 Dec 2007 13:47:37 -0500, "Jason Persampieri"
> <[email protected]> said:
> > Next question.
> >
> > I have a *spyce.include* inside a file that is itself *spyce-include*'d.
> > I've accepted the necessity of using *include.vars* to access data in my
> > included file (sadly... I wish they were just added to the included
> > file's
> > local namespace, but oh well), but it would be nice if *include.context*
> > was
> > automagically added to the context dict when including another file.
> >
> > Basically, if file A includes file B which includes file C, I'd like to
> > access A.foo in C via *include.vars.foo*.
> >
> > Or am I missing something obvious (for the umpteenth time)?
> >
> > Jason Persampieri
> > Programmer
> > Boston College - Bioinformatics Dept.
>

------=_Part_38883_32558397.1197564169522
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

I ended up doing<br><br>locals().update(include.context) <br><br>before my include calls.&nbsp; Not sure how clean it is, but it works.<br><br>Yeah, I&#39;d love to use tags, but the included files need to be *very* simple python/spyce files for the main user of this project.
<br><br>_jason<br><br><div class="gmail_quote">On Dec 12, 2007 7:58 PM, Jonathan Ellis &lt;<a href="mailto:[email protected]">[email protected]</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It might work if you do<br><br>A: include.spyce(B, locals())<br>B: incluce.spyce(C, include.context)<br>C: include.vars.foo<br><br>But I&#39;m not sure the include module is smart enough for that to work.<br><br>The &quot;modern&quot; way to reuse code in spyce is custom tags.
<br><div><div></div><div class="Wj3C7c"><br>On Wed, 12 Dec 2007 13:47:37 -0500, &quot;Jason Persampieri&quot;<br>&lt;<a href="mailto:[email protected]">[email protected]</a>&gt; said:<br>&gt; Next question.
<br>&gt;<br>&gt; I have a *spyce.include* inside a file that is itself *spyce-include*&#39;d.<br>&gt; I&#39;ve accepted the necessity of using *include.vars* to access data in my<br>&gt; included file (sadly... I wish they were just added to the included
<br>&gt; file&#39;s<br>&gt; local namespace, but oh well), but it would be nice if *include.context*<br>&gt; was<br>&gt; automagically added to the context dict when including another file.<br>&gt;<br>&gt; Basically, if file A includes file B which includes file C, I&#39;d like to
<br>&gt; access A.foo in C via *include.vars.foo*.<br>&gt;<br>&gt; Or am I missing something obvious (for the umpteenth time)?<br>&gt;<br>&gt; Jason Persampieri<br>&gt; Programmer<br>&gt; Boston College - Bioinformatics Dept.
<br></div></div></blockquote></div><br>

------=_Part_38883_32558397.1197564169522--


--===============0942582052==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
--===============0942582052==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Spyce-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spyce-users

--===============0942582052==--