Re: Webware placeholders and the searchList

Brian Bird <[email protected]> Thu, 23 May 2013 10:18:17 +0000
Newsgroups gmane.comp.python.cheetah
Message-ID <[email protected]>
--===============5510709816087385878==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_6F7F60AEAD1E0D4B9958C3B7E7D2D4E331AFFCSTExchange01Menai_"

--_000_6F7F60AEAD1E0D4B9958C3B7E7D2D4E331AFFCSTExchange01Menai_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

I think this might be the same problem I found when I upgraded a while ago:
http://sourceforge.net/mailarchive/forum.php?thread_name=3D6F7F60AEAD1E0D4B=
9958C3B7E7D2D4E31EDA82%40STExchange01.Menai.local&forum_name=3Dcheetahtempl=
ate-discuss


Since 2.0 Cheetah seems to look at the Template instance variables before s=
earching the namespace. Most of these variables are prefixed with __CHEETAH=
__ so it's unlikely to be an issue. But 4 of them (request, transaction, ap=
plication and session) aren't and therefore mask the value you have in your=
 namespace.

Like you, I don't use WebWare, but the only solution I found was to rename =
my variables (eg. in your case call it $session2 instead of $session)



I have no idea why this changed, personally I think it's a bug but I don't =
know if anyone else agrees or whether anyone is maintaining Cheetah any mor=
e in any case?



From: Aaron Murray [mailto:[email protected]]
Sent: 22 May 2013 23:54
To: [email protected]
Subject: [Cheetahtemplate-discuss] Webware placeholders and the searchList

I am upgrading to Cheetah 2.4.4. I'm getting a lot of errors relating to my=
 $session placeholder (which is added to the searchList via a custom contex=
t object as ctx.session).

After the upgrade, $session is always None.  It seems like the Webware sess=
ion variable from Servlet.py is sitting in the searchList above my custom p=
laceholder.  The current Cheetah docs state:

"However, it is OK to put same-name variables in the searchList, because We=
bware does not use the searchList."

I know the docs are currently out of date.  It seems like this is no longer=
 true.

Is there any way I can avoid changing the name of my session placeholder in=
 every template?  I do not use Webware so I don't need any related function=
ality.

Thanks,
Aaron

--_000_6F7F60AEAD1E0D4B9958C3B7E7D2D4E331AFFCSTExchange01Menai_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:"Courier New";
	mso-fareast-language:EN-GB;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-GB" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D">I think this might be the=
 same problem I found when I upgraded a while ago:<o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><a href=3D"http://sourcef=
orge.net/mailarchive/forum.php?thread_name=3D6F7F60AEAD1E0D4B9958C3B7E7D2D4=
E31EDA82%40STExchange01.Menai.local&amp;forum_name=3Dcheetahtemplate-discus=
s">http://sourceforge.net/mailarchive/forum.php?thread_name=3D6F7F60AEAD1E0=
D4B9958C3B7E7D2D4E31EDA82%40STExchange01.Menai.local&amp;forum_name=3Dcheet=
ahtemplate-discuss</a><o:p></o:p></span></p>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<pre><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;=
sans-serif&quot;;color:#1F497D">Since 2.0 Cheetah seems to look at the Temp=
late instance variables before searching the namespace. Most of these varia=
bles are prefixed with __CHEETAH__ so it&#8217;s unlikely to be an issue. B=
ut 4 of them (</span>request, transaction, application and session<span sty=
le=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quo=
t;;color:#1F497D">) aren&#8217;t and therefore mask the value you have in y=
our namespace.<o:p></o:p></span></pre>
<pre><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;=
sans-serif&quot;;color:#1F497D">Like you, I don&#8217;t use WebWare, but th=
e only solution I found was to rename my variables (eg. in your case call i=
t $session2 instead of $session)<o:p></o:p></span></pre>
<pre><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;=
sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span></pre>
<pre><span style=3D"font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;=
sans-serif&quot;;color:#1F497D">I have no idea why this changed, personally=
 I think it&#8217;s a bug but I don&#8217;t know if anyone else agrees or w=
hether anyone is maintaining Cheetah any more in any case?<o:p></o:p></span=
></pre>
<pre><o:p>&nbsp;</o:p></pre>
<p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:&quot;Ca=
libri&quot;,&quot;sans-serif&quot;;color:#1F497D"><o:p>&nbsp;</o:p></span><=
/p>
<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;"> Aaron Murray [mailto:[email protected]]
<br>
<b>Sent:</b> 22 May 2013 23:54<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> [Cheetahtemplate-discuss] Webware placeholders and the sear=
chList<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<div>
<p class=3D"MsoNormal">I am upgrading to Cheetah 2.4.4. I'm getting a lot o=
f errors relating to my $session placeholder (which is added to the searchL=
ist via a custom context object as ctx.session).<o:p></o:p></p>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">After the upgrade, $session is always None. &nbsp;It=
 seems like the Webware session variable from Servlet.py is sitting in the =
searchList above my custom placeholder. &nbsp;The current Cheetah docs stat=
e:<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">&quot;However, it is OK to put same-name variables i=
n the searchList, because Webware does not use the searchList.&quot;<o:p></=
o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">I know the docs are currently out of date. &nbsp;It =
seems like this is no longer true.<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Is there any way I can avoid changing the name of my=
 session placeholder in every template? &nbsp;I do not use Webware so I don=
't need any related functionality.<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Thanks,<o:p></o:p></p>
</div>
<div>
<p class=3D"MsoNormal">Aaron<o:p></o:p></p>
</div>
</div>
</div>
</body>
</html>

--_000_6F7F60AEAD1E0D4B9958C3B7E7D2D4E331AFFCSTExchange01Menai_--


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

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
--===============5510709816087385878==
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

--===============5510709816087385878==--