changeset 559:7fa7120dfcc6

macro.DictColumns: add a comment columns to the result table.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Tue, 29 Mar 2011 15:09:43 +0200
parents 626e6880e69a
children f502d6e75c07
files data/plugin/macro/DictColumns.py
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/macro/DictColumns.py	Thu Mar 10 13:37:56 2011 +0100
+++ b/data/plugin/macro/DictColumns.py	Tue Mar 29 15:09:43 2011 +0200
@@ -55,7 +55,8 @@
                  sort=u'', reverse=u'',
                  hide=u'', filter_name=u'NeverExistingDefaultFilter',
                  filter_value=u'', template_page=u'', alias_page=u'',
-                 parser=u'text_moin_wiki', markup="definition list", search_term=None):
+                 parser=u'text_moin_wiki', markup="definition list",
+                 search_term=None, comments=False):
 
         self.formatter = macro.formatter
         self.request = macro.request
@@ -73,6 +74,7 @@
         self.filter_name = filter_name
         self.filter_value = filter_value
         self.filter_key, self.filter_word = (u"", u"")
+        self.comments = comments
         regex = re.compile(ur'(?P<key>\w*)=(?P<value>.*)', re.UNICODE)
         try:
             self.filter_key, self.filter_word = regex.search(filter_value).groups()
@@ -224,6 +226,8 @@
                                     wikiutil.escape(value, 1)))
                 else:
                     row.append('')
+            if self.comments:
+                row.append('')
             try:
                 parent, child = page_name.split('/', 1)
             except ValueError:
@@ -244,7 +248,9 @@
                     if name in hide_columns:
                         col.hidden = True
                     data.columns.extend([col])
-
+            if self.comments:
+                col = Column("Comment", label="Comment")
+                data.columns.extend([col])
         return data
 
     def render(self):
@@ -276,9 +282,11 @@
 def macro_DictColumns(macro, pagename=unicode, title=u'', names=u'', sort=u'', reverse=u'',
                       hide=u'', filter_name=u'NeverExistingDefaultFilter',
                       filter_value=u'', template_page=u'', alias_page=u'',
-                      parser=u'text_moin_wiki', markup=("definition list", "title",
-                                                        "multiline definition list",
-                                                        "dl", "mdl", "t"),
+                      parser=u'text_moin_wiki',
+                      markup=("definition list", "title",
+                              "multiline definition list",
+                              "dl", "mdl", "t"),
+                      comments=False,
                       search_term=None):
     """
     Creates a table by data browser widget from definition lists key value pairs.