# HG changeset patch # User Aurelien Campeas # Date 1287677264 -7200 # Node ID 798200432f50c59c833ad2a5cbc1f611f507ba77 # Parent 2b93aa51503162ad35cd9d2086a735e7ca1041c7 some docstrings diff -r 2b93aa515031 -r 798200432f50 utils.py --- 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, '
', '
') as wow: + component.render_stuff(wow) + """ def __init__(self, w, tag, closetag=None): self.written = False self.tag = unicode(tag) diff -r 2b93aa515031 -r 798200432f50 web/component.py --- a/web/component.py Thu Oct 21 17:57:36 2010 +0200 +++ b/web/component.py Thu Oct 21 18:07:44 2010 +0200 @@ -183,7 +183,7 @@ class CtxComponent(AppObject): - """base class for contextual compontents. The following contexts are + """base class for contextual components. The following contexts are predefined: * boxes: 'left', 'incontext', 'right' @@ -191,12 +191,12 @@ * other: 'ctxtoolbar' The 'incontext', 'navcontenttop', 'navcontentbottom' and 'ctxtoolbar' - context are handled by the default primary view, others by the default main + contexts are handled by the default primary view, others by the default main template. All subclasses may not support all those contexts (for instance if it can't be displayed as box, or as a toolbar icon). You may restrict allowed context - as followed: + as follows: .. sourcecode:: python @@ -205,8 +205,8 @@ vocabulary=[list of contexts]) context = 'my default context' - You can configure default component's context by simply giving appropriate - value to the `context` class attribute, as seen above. + You can configure a component's default context by simply giving an + appropriate value to the `context` class attribute, as seen above. """ __registry__ = 'ctxcomponents' __select__ = ~no_cnx() @@ -290,7 +290,7 @@ w(u'