title: pylons mako how to check if variable exist or not
body: <p>In django, we can do this:</p>
  
  <pre><code>views.py : 
  
      def A(request):
          context = {test : 'test'}
          return render_to_response('index.html', context , context_instance = RequestContext(request))
  
      def B(request):
          context = {}
          return render_to_response('index.html', context , context_instance = RequestContext(request))
  
  index.html:
  
          {% if test %}
              {{ test }}
          {% endif %}
  </code></pre>
  
  <p>And have our template render without error, even if i use <code>method B</code>, where variable <code>'test'</code> does not exist, but I still can put it in the template.</p>
  
  <p>I want to do the same with pylons + mako, in controller : </p>
  
  <pre><code>foo.py
  
      def A(self):
          c.test = 'test'
          return render('index.html')
  
      def B(self):
          return render('index.html')
  
  index.html :
  
          % if c.test:
              ${'c.test'}
          % endif
  </code></pre>
  
  <p>In Django, I can do that, but in Pylons, I get an error, is there anyway to check wheter <code>'c.test'</code> exists or not?</p>
  
  <p>the error : AttributeError: 'ContextObj' object has no attribute 'test'</p>