Re: placeholder "$request" - is it now reserved?

Buck Golemon <[email protected]> Fri, 24 Aug 2012 08:47:28 -0700
Newsgroups gmane.comp.python.cheetah
Message-ID <CANDQx1or6MMQFsW3kjJcXD=uYi2KVqzkoNPNLhTwQNUk_08Bwg@mail.gmail.com>
--===============0477321144500949980==
Content-Type: multipart/alternative; boundary=f46d04428238a4eb8c04c804e418

--f46d04428238a4eb8c04c804e418
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

I doubt that the VFFSL function treats those variables specially. The
current style (in cheetah) is to prefix cheetah internals with _CHEETAH_.
It would seem quite valid to do so in this case as well.

On Fri, Aug 24, 2012 at 7:59 AM, Brian Bird <[email protected]>w=
rote:

>  I=92ve dug a little further and it looks like the Servlet class (which i=
s
> inherited by the Template class) contains 4 class variables:****
>
> request, transaction, application and session****
>
> ** **
>
> These variables appear to mask any similarly named variables defined in
> the namespaces passed to the Template constructor. This did not happen in
> Cheetah 2.0.****
>
> ** **
>
> Is this a bug or a deliberate change in design?****
>
> ** **
>
> I tried hacking the code to rename the class variables in Servlet and it
> makes the below code work as expected for 3 of the variables (although th=
is
> is hardly a good solution). However, it still doesn=92t work for the
> transaction variable because that also appears to be defined in the
> Template class.****
>
> ** **
>
> My assumption is that the order of the objects searched in the VFFSL
> method is now different. I assume this also means that other variable nam=
es
> may be unavailable for use in a namespace too.****
>
> ** **
>
> Thanks for any help.****
>
> ** **
>
> Brian****
>
> ** **
>
> *From:* Brian Bird [mailto:[email protected]]
> *Sent:* 06 August 2012 15:29
> *To:* [email protected]
> *Subject:* [Cheetahtemplate-discuss] placeholder "$request" - is it now
> reserved?****
>
> ** **
>
> I=92ve just upgraded from Cheetah 2.0 to Cheetah 2.4 and found the follow=
ing
> code gives different output:****
>
> ** **
>
> from Cheetah.Template import Template****
>
> print Template(source=3D"Hello $x $request",namespaces=3D{"x":"X",
> "request":"REQUEST"})****
>
> ** **
>
> Cheetah 2.0:****
>
> Hello X REQUEST****
>
> ** **
>
> Cheetah 2.4:****
>
> Hello X****
>
> ** **
>
> ** **
>
> It looks to me like the key =93request=94 in the namespace is being repla=
ced
> with a blank value. (If I change the key to =93request2=94 for example, i=
t
> works as I expect.) Is =93$request=94 now reserved in the namespace? If s=
o, are
> there any others?****
>
> ** **
>
> Note, this upgrade happened because I=92m moving from Ubuntu 10.04 to Ubu=
ntu
> 12.04. This means python has also been upgraded from 2.6 to 2.7. I can=92=
t
> find anything in the documentation to suggest this is a deliberate change=
.
> I have seen some examples with the placeholder =93$request=94 all to do w=
ith
> Webware/Webkit. I don=92t think I=92m using either of these, but is there=
 a way
> to know for sure?****
>
> ** **
>
> Thanks,****
>
> ** **
>
> Brian****
>
>
> -------------------------------------------------------------------------=
-----
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Cheetahtemplate-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
>
>

--f46d04428238a4eb8c04c804e418
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

I doubt that the VFFSL function treats those variables specially. The curre=
nt style (in cheetah) is to prefix cheetah internals with _CHEETAH_. It wou=
ld seem quite valid to do so in this case as well.<br><br><div class=3D"gma=
il_quote">
On Fri, Aug 24, 2012 at 7:59 AM, Brian Bird <span dir=3D"ltr">&lt;<a href=
=3D"mailto:[email protected]" target=3D"_blank">Brian.Bird@secur=
etrading.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div lang=3D"EN-GB" link=3D"blue" vlink=3D"purple">
<div>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">I=92ve dug a little fu=
rther and it looks like the Servlet class (which is inherited by the Templa=
te class) contains 4 class variables:<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">request, transaction, =
application and session<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">These variables appear=
 to mask any similarly named variables defined in the namespaces passed to =
the Template constructor. This did not happen in Cheetah 2.0.<u></u><u></u>=
</span></p>

<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">Is this a bug or a del=
iberate change in design?<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">I tried hacking the co=
de to rename the class variables in Servlet and it makes the below code wor=
k as expected for 3 of the variables (although this is hardly a good soluti=
on). However, it still doesn=92t work
 for the transaction variable because that also appears to be defined in th=
e Template class.<u></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">My assumption is that =
the order of the objects searched in the VFFSL method is now different. I a=
ssume this also means that other variable names may be unavailable for use =
in a namespace too.<u></u><u></u></span></p>

<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">Thanks for any help.<u=
></u><u></u></span></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d">Brian<u></u><u></u></s=
pan></p>
<p class=3D"MsoNormal"><span style=3D"color:#1f497d"><u></u>=A0<u></u></spa=
n></p>
<div>
<div style=3D"border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm =
0cm 0cm">
<p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:10.0pt;fo=
nt-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">From:</span></b><span =
lang=3D"EN-US" style=3D"font-size:10.0pt;font-family:&quot;Tahoma&quot;,&qu=
ot;sans-serif&quot;"> Brian
 Bird [mailto:<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>] <br>
<b>Sent:</b> 06 August 2012 15:29<br>
<b>To:</b> <a href=3D"mailto:[email protected]"=
 target=3D"_blank">[email protected]</a><br>
<b>Subject:</b> [Cheetahtemplate-discuss] placeholder &quot;$request&quot; =
- is it now reserved?<u></u><u></u></span></p>
</div>
</div><div><div class=3D"h5">
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">I=92ve just upgraded from Cheetah 2.0 to Cheetah 2.4=
 and found the following code gives different output:<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">from Cheetah.Template import Template<u></u><u></u><=
/p>
<p class=3D"MsoNormal">print Template(source=3D&quot;Hello $x $request&quot=
;,namespaces=3D{&quot;x&quot;:&quot;X&quot;, &quot;request&quot;:&quot;REQU=
EST&quot;})<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Cheetah 2.0:<u></u><u></u></p>
<p class=3D"MsoNormal">Hello X REQUEST<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Cheetah 2.4:<u></u><u></u></p>
<p class=3D"MsoNormal">Hello X<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">It looks to me like the key =93request=94 in the nam=
espace is being replaced with a blank value. (If I change the key to =93req=
uest2=94 for example, it works as I expect.) Is =93$request=94 now reserved=
 in the namespace? If so, are there any others?<u></u><u></u></p>

<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Note, this upgrade happened because I=92m moving fro=
m Ubuntu 10.04 to Ubuntu 12.04. This means python has also been upgraded fr=
om 2.6 to 2.7. I can=92t find anything in the documentation to suggest this=
 is a deliberate change. I have seen some
 examples with the placeholder =93$request=94 all to do with Webware/Webkit=
. I don=92t think I=92m using either of these, but is there a way to know f=
or sure?<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Thanks,<u></u><u></u></p>
<p class=3D"MsoNormal"><u></u>=A0<u></u></p>
<p class=3D"MsoNormal">Brian<u></u><u></u></p>
</div></div></div>
</div>

<br>-----------------------------------------------------------------------=
-------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today&#39;s security and<br>
threat landscape has changed and how IT managers can respond. Discussions<b=
r>
will include endpoint security, mobile security and the latest in malware<b=
r>
threats. <a href=3D"http://www.accelacomm.com/jaw/sfrnl04242012/114/5012226=
3/" target=3D"_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122=
263/</a><br>_______________________________________________<br>
Cheetahtemplate-discuss mailing list<br>
<a href=3D"mailto:[email protected]">Cheetahtem=
[email protected]</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-dis=
cuss" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/cheeta=
htemplate-discuss</a><br>
<br></blockquote></div><br>

--f46d04428238a4eb8c04c804e418--


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

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
--===============0477321144500949980==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Cheetahtemplate-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss

--===============0477321144500949980==--