Exemple #1
0
 def testhaskey(self):
     c = Context()
     class A:
         a = 1
 
     c = Context({'base':A()})
     self.assertTrue( c.has_key( 'base' ) )
     self.assertTrue( c.has_key( 'base.a' ) )
     self.assertFalse( c.has_key( 'base.b' ) )
Exemple #2
0
 def render( self, context=None ):
     "Evaluate the template to a given context."
     ctx = Context()
     for key, value in  self.environment.settings.items():
         ctx['settings.'+key] = value
     if context:
         ctx.update( context )
     
     return self._ast.eval( ctx )