Loading ...
Sorry, an error occurred while loading the content.

4998Re: [Cheetahtemplate-discuss] placeholder "$request" - is it now reserved?

Expand Messages
  • Buck Golemon
    Aug 24, 2012
      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 <Brian.Bird@...> wrote:

      I’ve dug a little further and it looks like the Servlet class (which is 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 this is hardly a good solution). However, it still doesn’t 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 names may be unavailable for use in a namespace too.

       

      Thanks for any help.

       

      Brian

       

      From: Brian Bird [mailto:Brian.Bird@...]
      Sent: 06 August 2012 15:29
      To: cheetahtemplate-discuss@...
      Subject: [Cheetahtemplate-discuss] placeholder "$request" - is it now reserved?

       

      I’ve just upgraded from Cheetah 2.0 to Cheetah 2.4 and found the following code gives different output:

       

      from Cheetah.Template import Template

      print Template(source="Hello $x $request",namespaces={"x":"X", "request":"REQUEST"})

       

      Cheetah 2.0:

      Hello X REQUEST

       

      Cheetah 2.4:

      Hello X

       

       

      It looks to me like the key “request” in the namespace is being replaced with a blank value. (If I change the key to “request2” for example, it works as I expect.) Is “$request” now reserved in the namespace? If so, are there any others?

       

      Note, this upgrade happened because I’m moving from Ubuntu 10.04 to Ubuntu 12.04. This means python has also been upgraded from 2.6 to 2.7. I can’t find anything in the documentation to suggest this is a deliberate change. I have seen some examples with the placeholder “$request” all to do with Webware/Webkit. I don’t think I’m 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
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


    • Show all 4 messages in this topic