changeset 4093:742cabb168b9

browser._format: refactored input parameter "method". The default value is changed from "GET" to None. Now it does not add a form tag to the table on default. You have to give a value of "GET" or "POST" to add a form tag using the given method.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 13 Sep 2008 15:12:14 +0200
parents 4afcf928ff6e
children 1f6f713c526c
files MoinMoin/action/AttachFile.py MoinMoin/action/Despam.py MoinMoin/action/info.py MoinMoin/macro/ShowSmileys.py MoinMoin/parser/text_csv.py MoinMoin/stats/hitcounts.py MoinMoin/stats/languages.py MoinMoin/stats/useragents.py MoinMoin/widget/browser.py
diffstat 9 files changed, 15 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Sat Sep 13 15:12:14 2008 +0200
@@ -1107,7 +1107,7 @@
 
         browser = DataBrowserWidget(request)
         browser.setData(data)
-        return browser.render()
+        return browser.render(method="GET")
 
     return ''
 
--- a/MoinMoin/action/Despam.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/action/Despam.py	Sat Sep 13 15:12:14 2008 +0200
@@ -71,7 +71,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(dataset)
-    return table.render()
+    return table.render(method="GET")
 
 class tmp:
     pass
--- a/MoinMoin/action/info.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/action/info.py	Sat Sep 13 15:12:14 2008 +0200
@@ -176,7 +176,7 @@
 
         div = html.DIV(id="page-history")
         div.append(html.INPUT(type="hidden", name="action", value="diff"))
-        div.append(history_table.render())
+        div.append(history_table.render(method="GET"))
 
         form = html.FORM(method="GET", action="")
         form.append(div)
--- a/MoinMoin/macro/ShowSmileys.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/macro/ShowSmileys.py	Sat Sep 13 15:12:14 2008 +0200
@@ -49,7 +49,7 @@
     if data:
         browser = DataBrowserWidget(macro.request)
         browser.setData(data)
-        return browser.render()
+        return browser.render(method="GET")
 
     return ''
 
--- a/MoinMoin/parser/text_csv.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/parser/text_csv.py	Sat Sep 13 15:12:14 2008 +0200
@@ -185,4 +185,4 @@
     def format(self, formatter):
         browser = DataBrowserWidget(self.request, show_header=self._show_header)
         browser.setData(self.data)
-        self.request.write(browser.format())
+        self.request.write(browser.render(method="GET"))
--- a/MoinMoin/stats/hitcounts.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/stats/hitcounts.py	Sat Sep 13 15:12:14 2008 +0200
@@ -189,7 +189,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(hits)
-    return table.render()
+    return table.render(method="GET")
 
 
 def draw(pagename, request):
--- a/MoinMoin/stats/languages.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/stats/languages.py	Sat Sep 13 15:12:14 2008 +0200
@@ -87,5 +87,5 @@
 
     table = DataBrowserWidget(request)
     table.setData(languages)
-    return table.render()
+    return table.render(method="GET")
 
--- a/MoinMoin/stats/useragents.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/stats/useragents.py	Sat Sep 13 15:12:14 2008 +0200
@@ -116,7 +116,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(agents)
-    return table.render()
+    return table.render(method="GET")
 
 def draw(pagename, request):
     import shutil, cStringIO
--- a/MoinMoin/widget/browser.py	Sat Sep 13 10:34:43 2008 +0200
+++ b/MoinMoin/widget/browser.py	Sat Sep 13 15:12:14 2008 +0200
@@ -93,16 +93,18 @@
         common[2] = self._makeoption(self._notempty, value == self.__notempty, self.__notempty)
         return '\n'.join(common + result)
 
-    def _format(self, formatter=None, method="GET"):
+    def _format(self, formatter=None, method=None):
         """
         does the formatting of the table
         @param formatter: formatter
-        @param method: GET or POST method
+        @param method: None is the default and does not create a form 
+                       while "GET" or "POST" will create the form using the given method 
         """
         fmt = formatter or self.request.formatter
 
         result = []
-        result.append(fmt.rawHTML('<form action="%s/%s" method="%s" name="%sform">' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.request.page.page_name), method, self.data_id)))
+        if method:
+            result.append(fmt.rawHTML('<form action="%s/%s" method="%s" name="%sform">' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.request.page.page_name), method, self.data_id)))
         result.append(fmt.div(1))
 
         havefilters = False
@@ -189,7 +191,8 @@
 
         result.append(fmt.table(0))
         result.append(fmt.div(0))
-        result.append(fmt.rawHTML('</form>'))
+        if method:
+            result.append(fmt.rawHTML('</form>'))
         return ''.join(result)
 
     format = _format # DEPRECATED, use render()