changeset 1796:57f12932915f

cleaning up comments, minor refactorings in heading formatter
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Fri, 23 Feb 2007 20:31:08 +0100
parents 94887c1c1e8f
children 25c93ded258b 06ce4843b9b5
files MoinMoin/Page.py MoinMoin/PageEditor.py MoinMoin/action/AttachFile.py MoinMoin/formatter/text_docbook.py MoinMoin/formatter/text_html.py MoinMoin/macro/Include.py MoinMoin/parser/text_moin_wiki.py MoinMoin/widget/html.py MoinMoin/wikiutil.py
diffstat 9 files changed, 16 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Page.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/Page.py	Fri Feb 23 20:31:08 2007 +0100
@@ -122,11 +122,6 @@
         self.rev = kw.get('rev', 0) # revision of this page
         self.include_self = kw.get('include_self', 0)
 
-        # XXX uncomment to see how many pages we create....
-        #import sys, traceback
-        #print >>sys.stderr, "page %s" % repr(page_name)
-        #traceback.print_stack(limit=4, file=sys.stderr)
-
         formatter = kw.get('formatter', None)
         if isinstance(formatter, (str, unicode)): # mimetype given
             mimetype = str(formatter)
@@ -191,7 +186,7 @@
             revfile.close()
             rev = int(revstr)
         except:
-            rev = 99999999 # XXX
+            rev = 99999999 # XXX do some better error handling
         return rev
 
     def get_rev_dir(self, pagedir, rev=0):
@@ -715,7 +710,7 @@
             if isinstance(querystr, dict):
                 action = querystr.get('action', None)
             else:
-                action = None # XXX we don't support getting the action out of a str
+                action = None # we don't support getting the action out of a str
 
             querystr = wikiutil.makeQueryString(querystr)
 
@@ -1065,9 +1060,9 @@
                         # use nocache headers if a user is logged in (which triggers personalisation features)
                         request.disableHttpCaching(level=1)
                     else:
-                        # TODO: we need to know if a page generates dynamic content
+                        # TODO: we need to know if a page generates dynamic content -
                         # if it does, we must not use the page file mtime as last modified value
-                        # XXX The following code is commented because it is incorrect for dynamic pages:
+                        # The following code is commented because it is incorrect for dynamic pages:
                         #lastmod = os.path.getmtime(self._text_filename())
                         #request.setHttpHeader("Last-Modified: %s" % util.timefuncs.formathttpdate(lastmod))
                         pass
--- a/MoinMoin/PageEditor.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/PageEditor.py	Fri Feb 23 20:31:08 2007 +0100
@@ -712,8 +712,7 @@
         @rtype: string
         @return: new text of wikipage, variables replaced
         """
-        # TODO: Allow addition of variables via wikiconfig or a global
-        # wiki dict.
+        # TODO: Allow addition of variables via wikiconfig or a global wiki dict.
         request = self.request
         now = self._get_local_timestamp()
         user = request.user
@@ -737,7 +736,6 @@
             if request.dicts.has_dict(userDictPage):
                 variables.update(request.dicts.dict(userDictPage))
 
-        # TODO: Use a more stream-lined re.sub algorithm
         for name in variables:
             text = text.replace('@%s@' % name, variables[name])
         return text
--- a/MoinMoin/action/AttachFile.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/action/AttachFile.py	Fri Feb 23 20:31:08 2007 +0100
@@ -828,7 +828,7 @@
 
         request.emit_http_headers([
             'Content-Type: %s' % content_type,
-            'Last-Modified: %s' % timestamp, # TODO maybe add a short Expires: header here?
+            'Last-Modified: %s' % timestamp,
             'Content-Length: %d' % os.path.getsize(fpath),
             'Content-Disposition: %s; filename="%s"' % (content_dispo, filename_enc),
         ])
--- a/MoinMoin/formatter/text_docbook.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/formatter/text_docbook.py	Fri Feb 23 20:31:08 2007 +0100
@@ -360,7 +360,7 @@
     def pagelink(self, on, pagename='', page=None, **kw):
         FormatterBase.pagelink(self, on, pagename, page, **kw)
 
-        return self.interwikilink(on, 'Self', pagename) # FIXME
+        return self.interwikilink(on, 'Self', pagename)
 
     # FIXME: This is even more crappy
     def interwikilink(self, on, interwiki='', pagename='', **kw):
--- a/MoinMoin/formatter/text_html.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/formatter/text_html.py	Fri Feb 23 20:31:08 2007 +0100
@@ -1186,7 +1186,7 @@
                 # explicit base level for section number display
                 self._show_section_numbers = int(numbering)
 
-        heading_depth = depth # + 1
+        heading_depth = depth
 
         # closing tag, with empty line after, to make source more readable
         if not on:
@@ -1206,19 +1206,12 @@
         # Add space before heading, easier to check source code
         result = '\n' + self._open('h%d' % heading_depth, **kw)
 
-        # TODO: convert this to readable code
         if self.request.user.show_topbottom:
-            # TODO change top/bottom refs to content-specific top/bottom refs?
-            result = ("%s%s%s%s%s%s%s%s" %
-                      (result,
-                       kw.get('icons', ''),
-                       self.url(1, "#bottom", do_escape=0),
-                       self.icon('bottom'),
-                       self.url(0),
-                       self.url(1, "#top", do_escape=0),
-                       self.icon('top'),
-                       self.url(0)))
-        return "%s%s%s" % (result, kw.get('icons', ''), number)
+            result += "%s%s%s%s%s%s" % (
+                       self.url(1, "#bottom", do_escape=0), self.icon('bottom'), self.url(0),
+                       self.url(1, "#top", do_escape=0), self.icon('top'), self.url(0))
+
+        return "%s%s" % (result, number)
 
 
     # Tables #############################################################
--- a/MoinMoin/macro/Include.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/macro/Include.py	Fri Feb 23 20:31:08 2007 +0100
@@ -200,8 +200,6 @@
                 if request._page_headings[pntt] > 1:
                     hid += '-%d'%(request._page_headings[pntt],)
                 result.append(
-                    #macro.formatter.heading(1, level, hid,
-                    #    icons=edit_icon.replace('<img ', '<img align="right" ')) +
                     macro.formatter.heading(1, level, id=hid) +
                     inc_page.link_to(request, heading, css_class="include-heading-link") +
                     macro.formatter.heading(0, level)
--- a/MoinMoin/parser/text_moin_wiki.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/parser/text_moin_wiki.py	Fri Feb 23 20:31:08 2007 +0100
@@ -773,8 +773,7 @@
             level += 1
         depth = min(5, level)
 
-        # this is needed for Included pages
-        # TODO but it might still result in unpredictable results
+        # FIXME: needed for Included pages but might still result in unpredictable results
         # when included the same page multiple times
         title_text = h[level:-level].strip()
         pntt = self.formatter.page.page_name + title_text
--- a/MoinMoin/widget/html.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/widget/html.py	Fri Feb 23 20:31:08 2007 +0100
@@ -676,7 +676,6 @@
 #
 #    def __init__(self, request, **kw):
 #        Widget.__init__(self, request)
-#        # FIXME     vvvv
 #        self.form = form(**kw)
 #
 #    def render(self):
--- a/MoinMoin/wikiutil.py	Fri Feb 23 18:52:21 2007 +0100
+++ b/MoinMoin/wikiutil.py	Fri Feb 23 20:31:08 2007 +0100
@@ -365,9 +365,8 @@
         parts.append(filename[start:len(filename)])
         wikiname = ''.join(parts)
 
-    # This looks wrong, because at this stage "()" can be both errors
-    # like open "(" without close ")", or unquoted valid characters in
-    # the file name. FIXME: check this.
+    # FIXME: This looks wrong, because at this stage "()" can be both errors
+    # like open "(" without close ")", or unquoted valid characters in the file name.
     # Filter invalid filenames. Any left (xx) must be invalid
     #if '(' in wikiname or ')' in wikiname:
     #    raise InvalidFileNameError(filename)