changeset 3905:0248e23277ef

DataBrowserWidget: remove toHTML/render methods, change all callers to use .format()
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 28 Jul 2008 20:53:35 +0200
parents a452a1dab1f7
children bef1e62eebe5
files MoinMoin/action/AttachFile.py MoinMoin/action/Despam.py MoinMoin/action/info.py MoinMoin/macro/ShowSmileys.py MoinMoin/stats/hitcounts.py MoinMoin/stats/languages.py MoinMoin/stats/useragents.py MoinMoin/userform/admin.py MoinMoin/widget/browser.py
diffstat 9 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/AttachFile.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/action/AttachFile.py	Mon Jul 28 20:53:35 2008 +0200
@@ -1107,7 +1107,7 @@
 
         browser = DataBrowserWidget(request)
         browser.setData(data)
-        return browser.toHTML()
+        return browser.format()
 
     return ''
 
--- a/MoinMoin/action/Despam.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/action/Despam.py	Mon Jul 28 20:53:35 2008 +0200
@@ -71,7 +71,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(dataset)
-    table.render()
+    return table.format()
 
 class tmp:
     pass
@@ -197,7 +197,7 @@
     elif editor:
         show_pages(request, pagename, editor, timestamp)
     else:
-        show_editors(request, pagename, timestamp)
+        request.write(show_editors(request, pagename, timestamp))
 
     # End content and send footer
     request.write(request.formatter.endContent())
--- a/MoinMoin/action/info.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/action/info.py	Mon Jul 28 20:53:35 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.toHTML())
+        div.append(history_table.format())
 
         form = html.FORM(method="GET", action="")
         form.append(div)
--- a/MoinMoin/macro/ShowSmileys.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/macro/ShowSmileys.py	Mon Jul 28 20:53:35 2008 +0200
@@ -49,7 +49,7 @@
     if data:
         browser = DataBrowserWidget(macro.request)
         browser.setData(data)
-        return browser.toHTML()
+        return browser.format()
 
     return ''
 
--- a/MoinMoin/stats/hitcounts.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/stats/hitcounts.py	Mon Jul 28 20:53:35 2008 +0200
@@ -189,7 +189,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(hits)
-    return table.toHTML()
+    return table.format()
 
 
 def draw(pagename, request):
--- a/MoinMoin/stats/languages.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/stats/languages.py	Mon Jul 28 20:53:35 2008 +0200
@@ -87,5 +87,5 @@
 
     table = DataBrowserWidget(request)
     table.setData(languages)
-    return table.toHTML()
+    return table.format()
 
--- a/MoinMoin/stats/useragents.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/stats/useragents.py	Mon Jul 28 20:53:35 2008 +0200
@@ -116,7 +116,7 @@
 
     table = DataBrowserWidget(request)
     table.setData(agents)
-    return table.toHTML()
+    return table.format()
 
 def draw(pagename, request):
     import shutil, cStringIO
--- a/MoinMoin/userform/admin.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/userform/admin.py	Mon Jul 28 20:53:35 2008 +0200
@@ -97,7 +97,7 @@
 
         browser = DataBrowserWidget(request)
         browser.setData(data)
-        return browser.toHTML()
+        return browser.format()
 
     # No data
     return ''
--- a/MoinMoin/widget/browser.py	Sun Jul 27 14:19:20 2008 +0200
+++ b/MoinMoin/widget/browser.py	Mon Jul 28 20:53:35 2008 +0200
@@ -93,8 +93,8 @@
         common[2] = self._makeoption(self._notempty, value == self.__notempty, self.__notempty)
         return '\n'.join(common + result)
 
-    def format(self):
-        fmt = self.request.formatter
+    def format(self, formatter=None):
+        fmt = formatter or self.request.formatter
 
         result = []
         result.append(fmt.rawHTML('<form action="%s/%s" method="GET" name="%sform">' % (self.request.getScriptname(), wikiutil.quoteWikinameURL(self.request.page.page_name), self.data_id)))
@@ -187,8 +187,3 @@
         result.append(fmt.rawHTML('</form>'))
         return ''.join(result)
 
-    toHTML = format # old name of "format" function DEPRECATED, will be removed in 1.7
-
-    def render(self):
-        self.request.write(self.format())
-