utils.py
changeset 6580 798200432f50
parent 6492 47a284c0d012
child 6684 b8bd0ecced2e
--- a/utils.py	Thu Oct 21 17:57:36 2010 +0200
+++ b/utils.py	Thu Oct 21 18:07:44 2010 +0200
@@ -77,6 +77,16 @@
 
 
 class wrap_on_write(object):
+    """ Sometimes it is convenient to NOT write some container element
+    if it happens that there is nothing to be written within,
+    but this cannot be known beforehand.
+    Hence one can do this:
+
+    .. sourcecode:: python
+
+       with wrap_on_write(w, '<div class="foo">', '</div>') as wow:
+           component.render_stuff(wow)
+    """
     def __init__(self, w, tag, closetag=None):
         self.written = False
         self.tag = unicode(tag)