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

Re: [Cheetahtemplate-discuss] getVar inconsistency

Expand Messages
  • Shannon -jj Behrens
    I m sorry, I think you misunderstood me. I meant for g to actually *do* something via a __getattr__ method. I.e. $g.foo would call g s __getattr__ method,
    Message 1 of 17 , Apr 29, 2005
      I'm sorry, I think you misunderstood me. I meant for g to actually
      *do* something via a __getattr__ method. I.e. $g.foo would call g's
      __getattr__ method, which would look up foo via the getVar mechanism.
      I.e. dirty Python magic ;)

      I agree that:

      #def g(value)
      #try
      #return $getVar(value)
      #except
      #return ""
      #end def

      $g("foo")

      while less syntactically elegant, would work with no changes to Cheetah.

      Best Regards,
      -jj

      On 4/28/05, mso@... <mso@...> wrote:
      > JJ wrote:
      > > Alternatively, if you add a method called, say g, to your parent class
      > > template, you could arrange things so that $g.var would do what you
      > > want, without any changes to Cheetah :-/
      >
      > searchList = [{'g': Cheetah.Tools.RecursiveNull()}]
      >
      > That would work.

      --
      I have decided to switch to Gmail, but messages to my Yahoo account will
      still get through.


      -------------------------------------------------------
      This SF.Net email is sponsored by: NEC IT Guy Games.
      Get your fingers limbered up and give it your best shot. 4 great events, 4
      opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
      win an NEC 61 plasma display. Visit http://www.necitguy.com/?r
      _______________________________________________
      Cheetahtemplate-discuss mailing list
      Cheetahtemplate-discuss@...
      https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss
    Your message has been successfully submitted and would be delivered to recipients shortly.