fix for #29 Transcluded csv page is not wrapped with object overlay;
authorRoger Haase <crosseyedpenguin@yahoo.com>
Sun, 26 Aug 2012 14:03:02 -0700
changeset 1752bff62fea804a
parent 1751 cdc6a47ff523
child 1753 2be00a5febbe
child 1756 2ae7384dd311
fix for #29 Transcluded csv page is not wrapped with object overlay;
updated other converters to consistently return moin_page.page rather than table, object, etc.
MoinMoin/converter/archive_in.py
MoinMoin/converter/audio_video_in.py
MoinMoin/converter/everything.py
MoinMoin/converter/html_out.py
MoinMoin/converter/image_in.py
MoinMoin/converter/include.py
MoinMoin/converter/nonexistent_in.py
MoinMoin/converter/text_csv_in.py
     1.1 --- a/MoinMoin/converter/archive_in.py	Sun Aug 26 22:25:00 2012 +0200
     1.2 +++ b/MoinMoin/converter/archive_in.py	Sun Aug 26 14:03:02 2012 -0700
     1.3 @@ -56,7 +56,9 @@
     1.4                           self.process_datetime(dt),
     1.5                           self.process_name(name),
     1.6                          ) for size, dt, name in contents]
     1.7 -            return self.build_dom_table(contents, head=[_("Size"), _("Date"), _("Name")], cls='zebra')
     1.8 +            table = self.build_dom_table(contents, head=[_("Size"), _("Date"), _("Name")], cls='zebra')
     1.9 +            body = moin_page.body(children=(table, ))
    1.10 +            return moin_page.page(children=(body, ))
    1.11          except ArchiveException as err:
    1.12              logging.exception("An exception within archive file handling occurred:")
    1.13              # XXX we also use a table for error reporting, could be
     2.1 --- a/MoinMoin/converter/audio_video_in.py	Sun Aug 26 22:25:00 2012 +0200
     2.2 +++ b/MoinMoin/converter/audio_video_in.py	Sun Aug 26 14:03:02 2012 -0700
     2.3 @@ -33,7 +33,9 @@
     2.4              moin_page.type_: unicode(self.input_type),
     2.5              xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
     2.6          }
     2.7 -        return moin_page.object_(attrib=attrib, children=[u'Your Browser does not support HTML5 audio/video element.', ])
     2.8 +        obj = moin_page.object_(attrib=attrib, children=[u'Your Browser does not support HTML5 audio/video element.', ])
     2.9 +        body = moin_page.body(children=(obj, ))
    2.10 +        return moin_page.page(children=(body, ))
    2.11  
    2.12  
    2.13  from . import default_registry
     3.1 --- a/MoinMoin/converter/everything.py	Sun Aug 26 22:25:00 2012 +0200
     3.2 +++ b/MoinMoin/converter/everything.py	Sun Aug 26 14:03:02 2012 -0700
     3.3 @@ -27,7 +27,9 @@
     3.4          attrib = {
     3.5              xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
     3.6          }
     3.7 -        return moin_page.a(attrib=attrib, children=[u"Download {0}.".format(item_name)])
     3.8 +        a = moin_page.a(attrib=attrib, children=[u"Download {0}.".format(item_name)])
     3.9 +        body = moin_page.body(children=(a, ))
    3.10 +        return moin_page.page(children=(body, ))
    3.11  
    3.12  
    3.13  from . import default_registry
     4.1 --- a/MoinMoin/converter/html_out.py	Sun Aug 26 22:25:00 2012 +0200
     4.2 +++ b/MoinMoin/converter/html_out.py	Sun Aug 26 14:03:02 2012 -0700
     4.3 @@ -44,7 +44,8 @@
     4.4      href = unicode(href)
     4.5      # href will be "/wikiroot/SomeObject" or "/SomePage" for internal wiki items
     4.6      # or "http://Some.Org/SomeThing" for external link
     4.7 -    if elem.tag.name == 'page':
     4.8 +    if elem.tag.name not in ('object', 'img'):
     4.9 +        # XXX see issue #167: for wikis not running at root, only object and img elements have complete path
    4.10          # if wiki is not running at server root, prefix href with wiki root
    4.11          wiki_root = request.url_root[len(request.host_url):-1]
    4.12          if wiki_root:
     5.1 --- a/MoinMoin/converter/image_in.py	Sun Aug 26 22:25:00 2012 +0200
     5.2 +++ b/MoinMoin/converter/image_in.py	Sun Aug 26 14:03:02 2012 -0700
     5.3 @@ -31,7 +31,9 @@
     5.4              moin_page.type_: unicode(self.input_type),
     5.5              xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=get&rev={0}'.format(rev.revid)),
     5.6          }
     5.7 -        return moin_page.object_(attrib=attrib, children=[item_name, ])
     5.8 +        obj = moin_page.object_(attrib=attrib, children=[item_name, ])
     5.9 +        body = moin_page.body(children=(obj, ))
    5.10 +        return moin_page.page(children=(body, ))
    5.11  
    5.12  
    5.13  from . import default_registry
     6.1 --- a/MoinMoin/converter/include.py	Sun Aug 26 22:25:00 2012 +0200
     6.2 +++ b/MoinMoin/converter/include.py	Sun Aug 26 14:03:02 2012 -0700
     6.3 @@ -254,10 +254,8 @@
     6.4  
     6.5                      self.recurse(page_doc, page_href)
     6.6  
     6.7 -                    # if this is an existing item, mark it as a transclusion.  non-existent items are not marked (page_doc.tag.name == u'a')
     6.8                      # The href needs to be an absolute URI, without the prefix "wiki://"
     6.9 -                    if page_doc.tag.name == u'page':
    6.10 -                        page_doc = mark_item_as_transclusion(page_doc, p_href.path)
    6.11 +                    page_doc = mark_item_as_transclusion(page_doc, p_href.path)
    6.12                      included_elements.append(page_doc)
    6.13  
    6.14                  if len(included_elements) > 1:
     7.1 --- a/MoinMoin/converter/nonexistent_in.py	Sun Aug 26 22:25:00 2012 +0200
     7.2 +++ b/MoinMoin/converter/nonexistent_in.py	Sun Aug 26 14:03:02 2012 -0700
     7.3 @@ -28,8 +28,9 @@
     7.4          attrib = {
     7.5              xlink.href: Iri(scheme='wiki', authority='', path='/'+item_name, query='do=modify'),
     7.6          }
     7.7 -        return moin_page.a(attrib=attrib, children=[_("%(item_name)s does not exist. Create it?", item_name=item_name)])
     7.8 -
     7.9 +        a = moin_page.a(attrib=attrib, children=[_("%(item_name)s does not exist. Create it?", item_name=item_name)])
    7.10 +        body = moin_page.body(children=(a, ))
    7.11 +        return moin_page.page(children=(body, ))
    7.12  
    7.13  from . import default_registry
    7.14  from MoinMoin.util.mime import Type, type_moin_document
     8.1 --- a/MoinMoin/converter/text_csv_in.py	Sun Aug 26 22:25:00 2012 +0200
     8.2 +++ b/MoinMoin/converter/text_csv_in.py	Sun Aug 26 14:03:02 2012 -0700
     8.3 @@ -12,6 +12,7 @@
     8.4  
     8.5  from ._table import TableMixin
     8.6  from ._util import decode_data, normalize_split_text
     8.7 +from MoinMoin.util.tree import moin_page
     8.8  
     8.9  
    8.10  class Converter(TableMixin):
    8.11 @@ -39,7 +40,9 @@
    8.12                  row.append(encoded_cell.decode('utf-8'))
    8.13              if row:
    8.14                  rows.append(row)
    8.15 -        return self.build_dom_table(rows)
    8.16 +        table = self.build_dom_table(rows)
    8.17 +        body = moin_page.body(children=(table, ))
    8.18 +        return moin_page.page(children=(body, ))
    8.19  
    8.20  
    8.21  from . import default_registry