Package genshi :: Package template :: Module directives :: Class IfDirective

Class IfDirective



object --+    
         |    
 Directive --+
             |
            IfDirective

Implementation of the py:if template directive for conditionally excluding elements from being output.

>>> from genshi.template import MarkupTemplate
>>> tmpl = MarkupTemplate('''<div xmlns:py="http://genshi.edgewall.org/">
...   <b py:if="foo">${bar}</b>
... </div>''')
>>> print tmpl.generate(foo=True, bar='Hello')
<div>
  <b>Hello</b>
</div>


Nested Classes

Inherited from Directive: __metaclass__

Instance Methods
 
__call__(self, stream, ctxt, directives)
Apply the directive to the given stream.

Inherited from Directive: __init__, __repr__

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Methods

Inherited from Directive: attach

Class Variables
  ATTRIBUTE = 'test'
  tagname = 'if'
Properties

Inherited from Directive: expr

Inherited from object: __class__

Method Details

__call__(self, stream, ctxt, directives)
(Call operator)

 
Apply the directive to the given stream.
Overrides: Directive.__call__
(inherited documentation)