changeset 2027:606a6b22d82b

Merge with namespaces
author Roger Haase <crosseyedpenguin@yahoo.com>
date Sun, 03 Mar 2013 07:44:25 -0700
parents 56e38b884e87 (diff) f5b13839b63a (current diff)
children 54174e49198a
files
diffstat 148 files changed, 1870 insertions(+), 1843 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/ldap_testbase.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/ldap_testbase.py	Sun Mar 03 07:44:25 2013 -0700
@@ -50,7 +50,10 @@
 import hashlib
 
 try:
-    import ldap, ldif, ldap.modlist  # needs python-ldap
+    # needs python-ldap
+    import ldap
+    import ldap.modlist
+    import ldif
 except ImportError:
     ldap = None
 
@@ -81,13 +84,14 @@
 
 class Slapd(object):
     """ Manage a slapd process for testing purposes """
-    def __init__(self,
-                 config=None,  # config filename for -f
-                 executable=SLAPD_EXECUTABLE,
-                 debug_flags='',  # None,  # for -d stats,acl,args,trace,sync,config
-                 proto='ldap', ip='127.0.0.1', port=3890,  # use -h proto://ip:port
-                 service_name=''  # defaults to -n executable:port, use None to not use -n
-                ):
+    def __init__(
+        self,
+        config=None,  # config filename for -f
+        executable=SLAPD_EXECUTABLE,
+        debug_flags='',  # None,  # for -d stats,acl,args,trace,sync,config
+        proto='ldap', ip='127.0.0.1', port=3890,  # use -h proto://ip:port
+        service_name='',  # defaults to -n executable:port, use None to not use -n
+    ):
         self.executable = executable
         self.config = config
         self.debug_flags = debug_flags
@@ -150,14 +154,15 @@
 #set_tas_spins 0
 """
 
-    def __init__(self,
-                 basedn,
-                 rootdn, rootpw,
-                 instance=0,  # use different values when running multiple LdapEnvironments
-                 schema_dir='/etc/ldap/schema',  # directory with schemas
-                 coding='utf-8',  # coding used for config files
-                 timeout=10,  # how long to wait for slapd starting [s]
-                ):
+    def __init__(
+        self,
+        basedn,
+        rootdn, rootpw,
+        instance=0,  # use different values when running multiple LdapEnvironments
+        schema_dir='/etc/ldap/schema',  # directory with schemas
+        coding='utf-8',  # coding used for config files
+        timeout=10,  # how long to wait for slapd starting [s]
+    ):
         self.basedn = basedn
         self.rootdn = rootdn
         self.rootpw = rootpw
@@ -232,7 +237,7 @@
 try:
     import pytest
 
-    class LDAPTstBase:
+    class LDAPTstBase(object):
         """ Test base class for pytest based tests which need a LDAP server to talk to.
 
             Inherit your test class from this base class to test LDAP stuff.
@@ -252,7 +257,7 @@
             started = self.ldap_env.start_slapd()
             if not started:
                 pytest.skip("Failed to start {0} process, please see your syslog / log files"
-                             " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
+                            " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
             self.ldap_env.load_directory(ldif_content=self.ldif_content)
 
         def teardown_class(self):
--- a/MoinMoin/_tests/test_error.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/test_error.py	Sun Mar 03 07:44:25 2013 -0700
@@ -46,6 +46,7 @@
         err = error.Error(test)
         assert '%(message)s' % dict(message=err) == test
 
+
 class TestCompositeError(object):
 
     def setup_method(self, method):
@@ -72,4 +73,5 @@
         expected = ['This is a fatal Error']
         assert result == expected
 
+
 coverage_modules = ['MoinMoin.error']
--- a/MoinMoin/_tests/test_forms.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/test_forms.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,6 +10,7 @@
 
 from MoinMoin.forms import DateTimeUNIX
 
+
 def test_datetimeunix():
     dt = datetime.datetime(2012, 12, 21, 23, 45, 59)
     timestamp = timegm(dt.timetuple())
--- a/MoinMoin/_tests/test_test_environ.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/test_test_environ.py	Sun Mar 03 07:44:25 2013 -0700
@@ -14,6 +14,7 @@
 
 from MoinMoin._tests import wikiconfig
 
+
 class TestStorageEnvironWithoutConfig(object):
     def setup_method(self, method):
         self.class_level_value = 123
@@ -34,12 +35,13 @@
 
 
 CONTENT_ACL = dict(
-        before="+All:write", # need to write to sys pages
-        default="All:read,write,admin,create,destroy",
-        after="Me:create",
-        hierarchic=False,
+    before="+All:write",  # need to write to sys pages
+    default="All:read,write,admin,create,destroy",
+    after="Me:create",
+    hierarchic=False,
 )
 
+
 class TestStorageEnvironWithConfig(object):
 
     class Config(wikiconfig.Config):
--- a/MoinMoin/_tests/test_user.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/test_user.py	Sun Mar 03 07:44:25 2013 -0700
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 # Copyright: 2003-2004 by Juergen Hermann <jh@web.de>
 # Copyright: 2009 by ReimarBauer
-# Copyright: 2013 by ThomasWaldmann
+# Copyright: 2011-2013 by ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
@@ -67,7 +67,7 @@
     def testUnicodePassword(self):
         """ user: login with non-ascii password """
         # Create test user
-        name = u'__שם משתמש לא קיים__' # Hebrew
+        name = u'__שם משתמש לא קיים__'  # Hebrew
         password = name
         self.createUser(name, password)
 
@@ -87,7 +87,7 @@
         assert theUser.valid
 
         # invalidate the stored password (hash)
-        theUser.set_password("") # emptry str or None means "invalidate"
+        theUser.set_password("")  # emptry str or None means "invalidate"
         theUser.save()
 
         # Try to "login" with previous password
@@ -128,7 +128,7 @@
         # Login - this should replace the old password in the user file
         theUser = user.User(name=name, password=password)
         theUser.subscribe(pagename)
-        assert theUser.is_subscribed_to([pagename]) # list(!) of pages to check
+        assert theUser.is_subscribed_to([pagename])  # list(!) of pages to check
 
     def testSubscriptionSubPage(self):
         """ user: tests is_subscribed_to on a subpage """
@@ -140,7 +140,7 @@
         # Login - this should replace the old password in the user file
         theUser = user.User(name=name, password=password)
         theUser.subscribe(pagename)
-        assert not theUser.is_subscribed_to([testPagename]) # list(!) of pages to check
+        assert not theUser.is_subscribed_to([testPagename])  # list(!) of pages to check
 
     # Bookmarks -------------------------------------------------------
 
@@ -288,18 +288,18 @@
             u' User Name',
             u'User Name ',
             u'User   Name',
-            )
+        )
         for test in cases:
             assert not user.isValidName(test)
 
     def testValid(self):
         """ user: isValidName: accept names in any language, with spaces """
         cases = (
-            u'Jürgen Hermann', # German
-            u'ניר סופר', # Hebrew
-            u'CamelCase', # Good old camel case
-            u'가각간갇갈 갉갊감 갬갯걀갼' # Hangul (gibberish)
-            )
+            u'Jürgen Hermann',  # German
+            u'ניר סופר',  # Hebrew
+            u'CamelCase',  # Good old camel case
+            u'가각간갇갈 갉갊감 갬갯걀갼'  # Hangul (gibberish)
+        )
         for test in cases:
             assert user.isValidName(test)
 
--- a/MoinMoin/_tests/test_wikiutil.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/test_wikiutil.py	Sun Mar 03 07:44:25 2013 -0700
@@ -1,5 +1,5 @@
 # Copyright: 2003-2004 by Juergen Hermann <jh@web.de>
-# Copyright: 2007 by MoinMoin:ThomasWaldmann
+# Copyright: 2007-2013 by MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
@@ -19,11 +19,12 @@
 
 class TestCleanInput(object):
     def testCleanInput(self):
-        tests = [(u"", u""), # empty
-                 (u"aaa\r\n\tbbb", u"aaa   bbb"), # ws chars -> blanks
-                 (u"aaa\x00\x01bbb", u"aaabbb"), # strip weird chars
-                 (u"a"*500, u""), # too long
-                ]
+        tests = [
+            (u"", u""),  # empty
+            (u"aaa\r\n\tbbb", u"aaa   bbb"),  # ws chars -> blanks
+            (u"aaa\x00\x01bbb", u"aaabbb"),  # strip weird chars
+            (u"a" * 500, u""),  # too long
+        ]
         for instr, outstr in tests:
             assert wikiutil.clean_input(instr) == outstr
 
@@ -56,13 +57,14 @@
         (('MainPage', '/SubPage1'), 'MainPage/SubPage1'),
         (('MainPage', '/SubPage1/SubPage2'), 'MainPage/SubPage1/SubPage2'),
         (('MainPage/SubPage1', '/SubPage2/SubPage3'), 'MainPage/SubPage1/SubPage2/SubPage3'),
-        (('', '/OtherMainPage'), 'OtherMainPage'), # strange
+        (('', '/OtherMainPage'), 'OtherMainPage'),  # strange
         # PARENT_PREFIX
         (('MainPage/SubPage', '../SisterPage'), 'MainPage/SisterPage'),
         (('MainPage/SubPage1/SubPage2', '../SisterPage'), 'MainPage/SubPage1/SisterPage'),
         (('MainPage/SubPage1/SubPage2', '../../SisterPage'), 'MainPage/SisterPage'),
-        (('MainPage', '../SisterPage'), 'SisterPage'), # strange
+        (('MainPage', '../SisterPage'), 'SisterPage'),  # strange
     ]
+
     def test_abs_pagename(self):
         for (current_page, relative_page), absolute_page in self.tests:
             yield self._check_abs_pagename, current_page, relative_page, absolute_page
@@ -98,7 +100,7 @@
             (u'a/', u'a'),
             (u'a/////b/////c', u'a/b/c'),
             (u'a b/////c d/////e f', u'a b/c d/e f'),
-            )
+        )
         for test, expected in cases:
             result = wikiutil.normalize_pagename(test, app.cfg)
             assert result == expected
@@ -113,7 +115,7 @@
             (u'a   b  /  c    d  /  e   f', u'a b/c d/e f'),
             # All 30 unicode spaces
             (CHARS_SPACES, u''),
-            )
+        )
         for test, expected in cases:
             result = wikiutil.normalize_pagename(test, app.cfg)
             assert result == expected
@@ -130,11 +132,12 @@
             (u'a  ', u'a'),
             (u'a  b  c', u'a b c'),
             (u'a  b  /  c  d  /  e  f', u'a b/c d/e f'),
-            )
+        )
         for test, expected in cases:
             result = wikiutil.normalize_pagename(test, app.cfg)
             assert result == expected
 
+
 class TestGroupItems(object):
 
     def testNormalizeGroupName(self):
@@ -147,7 +150,7 @@
             (u'Name,:Group', u'NameGroup'),
             # remove than normalize spaces
             (u'Name ! @ # $ % ^ & * ( ) + Group', u'Name Group'),
-            )
+        )
         for test, expected in cases:
             # validate we are testing valid group names
             if wikiutil.isGroupItem(test):
@@ -159,12 +162,13 @@
     # with no parent
     result = wikiutil.ParentItemName(u'itemname')
     expected = u''
-    assert result == expected, ('Expected "%(expected)s" but got "%(result)s"')
+    assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
     # with a parent
     result = wikiutil.ParentItemName(u'some/parent/itemname')
     expected = u'some/parent'
     assert result == expected
 
+
 def testdrawing2fname():
     # with extension not in DRAWING_EXTENSIONS
     result = wikiutil.drawing2fname('Moin_drawing.txt')
@@ -175,6 +179,7 @@
     expected = 'Moindir.Moin_drawing.jpg'
     assert result == expected
 
+
 def testgetUnicodeIndexGroup():
     result = wikiutil.getUnicodeIndexGroup(['moin-2', 'MoinMoin'])
     expected = 'MOIN-2'
@@ -183,6 +188,7 @@
     with pytest.raises(IndexError):
         result = wikiutil.getUnicodeIndexGroup('')
 
+
 def testis_URL():
     sample_schemes = ['http', 'https', 'ftp', 'ssh']
     for scheme in sample_schemes:
@@ -196,6 +202,7 @@
     result = wikiutil.is_URL('invalid_scheme:MoinMoin')
     assert not result
 
+
 def testcontainsConflictMarker():
     # text with conflict marker
     result = wikiutil.containsConflictMarker("/!\\ '''Edit conflict - Conflict marker is present")
@@ -205,6 +212,7 @@
     result = wikiutil.containsConflictMarker('No conflict marker')
     assert not result
 
+
 def testsplit_anchor():
     """
     TODO: add the test for for split_anchor when we have better
@@ -222,15 +230,16 @@
     expected = ['#MoinMoin', '']
     assert result == expected
 
+
 def testfile_headers():
     test_headers = [
-                #test_file, content_type
-                ('imagefile.gif', 'image/gif'),
-                ('testfile.txt', 'text/plain'),
-                ('pdffile.pdf', 'application/pdf'),
-                ('docfile.doc', 'application/msword'),
-                (None, 'application/octet-stream')
-                ]
+        # test_file, content_type
+        ('imagefile.gif', 'image/gif'),
+        ('testfile.txt', 'text/plain'),
+        ('pdffile.pdf', 'application/pdf'),
+        ('docfile.doc', 'application/msword'),
+        (None, 'application/octet-stream'),
+    ]
 
     for test_file, content_type in test_headers:
         result = wikiutil.file_headers(test_file, None, 10)
@@ -242,4 +251,5 @@
     expected = [('Content-Type', 'text/plain')]
     assert result == expected
 
+
 coverage_modules = ['MoinMoin.wikiutil']
--- a/MoinMoin/_tests/wikiconfig.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/_tests/wikiconfig.py	Sun Mar 03 07:44:25 2013 -0700
@@ -1,4 +1,5 @@
 # Copyright: 2000-2004 by Juergen Hermann <jh@web.de>
+# Copyright: 2011-2013 by MoinMoin:ThomasWaldmann
 # License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
 
 """
@@ -13,10 +14,14 @@
 
 import os
 from os.path import abspath, dirname, join
+
 from MoinMoin.config.default import DefaultConfig
 
 
 class Config(DefaultConfig):
+    """
+    default configuration for the unit tests
+    """
     _here = abspath(dirname(__file__))
     _root = abspath(join(_here, '..', '..'))
     data_dir = join(_here, 'wiki', 'data')  # needed for plugins package TODO
--- a/MoinMoin/app.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/app.py	Sun Mar 03 07:44:25 2013 -0700
@@ -47,8 +47,7 @@
 
 
 def create_app_ext(flask_config_file=None, flask_config_dict=None,
-                   moin_config_class=None, warn_default=True, **kwargs
-                  ):
+                   moin_config_class=None, warn_default=True, **kwargs):
     """
     Factory for moin wsgi apps
 
--- a/MoinMoin/apps/admin/_tests/test_admin.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/admin/_tests/test_admin.py	Sun Mar 03 07:44:25 2013 -0700
@@ -7,6 +7,7 @@
 
 from flask import url_for
 
+
 class TestAdmin(object):
     def _test_view_get(self, url, status='200 OK', data=('<html>', '</html>')):
         with self.app.test_client() as c:
--- a/MoinMoin/apps/admin/templates/admin/index.html	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/admin/templates/admin/index.html	Sun Mar 03 07:44:25 2013 -0700
@@ -3,7 +3,6 @@
 <h1>{{ _("Admin Menu") }}</h1>
 <ul>
     <li><a href="{{ url_for('admin.userbrowser') }}">{{ _("Users") }}</a></li>
-    <li><a href="{{ url_for('admin.sysitems_upgrade') }}">{{ _("Upgrade System Items") }}</a></li>
     <li><a href="{{ url_for('admin.wikiconfig') }}">{{ _("Show Wiki Configuration") }}</a></li>
     <li><a href="{{ url_for('admin.wikiconfighelp') }}">{{ _("Wiki Configuration Help") }}</a></li>
 </ul>
--- a/MoinMoin/apps/admin/templates/admin/sysitems_upgrade.html	Sat Mar 02 14:09:49 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-{% extends theme("layout.html") %}
-{% block content %}
-<h1>{{ _("Upgrade System Items") }}</h1>
-<p>
-{{ _("You can upgrade your system items by uploading an xml file with new items below.") }}
-</p>
-<form action="{{ url_for('admin.sysitems_upgrade') }}" method="POST" enctype="multipart/form-data">
-<fieldset>
-    <label for="xmlfile">System items XML file:</label><input type="file" id="xmlfile" name="xmlfile" />
-    <input type="submit" name="submit" value="{{ _("Upgrade system items") }}" />
-</fieldset>
-</form>
-{% endblock %}
--- a/MoinMoin/apps/admin/views.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/admin/views.py	Sun Mar 03 07:44:25 2013 -0700
@@ -49,8 +49,7 @@
                           email=rev.meta[EMAIL],
                           disabled=False,  # TODO: add to index
                           groups=[groupname for groupname in groups if rev.meta[NAME] in groups[groupname]],
-                     )
-                     for rev in revs]
+                     ) for rev in revs]
     return render_template('admin/userbrowser.html', user_accounts=user_accounts, title_name=_(u"Users"))
 
 
@@ -98,27 +97,6 @@
     return redirect(url_for('.userbrowser'))
 
 
-@admin.route('/sysitems_upgrade', methods=['GET', 'POST', ])
-@require_permission(SUPERUSER)
-def sysitems_upgrade():
-    from MoinMoin.storage.backends import upgrade_sysitems  # XXX broken import, either fix or kill this
-    from MoinMoin.storage.error import BackendError
-    if request.method == 'GET':
-        action = 'syspages_upgrade'
-        label = 'Upgrade System Pages'
-        return render_template('admin/sysitems_upgrade.html',
-                               title_name=_(u"System items upgrade"))
-    if request.method == 'POST':
-        xmlfile = request.files.get('xmlfile')
-        try:
-            upgrade_sysitems(xmlfile)
-        except BackendError as e:
-            flash(_('System items upgrade failed due to the following error: %(error)s.', error=e), 'error')
-        else:
-            flash(_('System items have been upgraded successfully!'))
-        return redirect(url_for('.index'))
-
-
 from MoinMoin.config import default as defaultconfig
 
 
@@ -200,11 +178,12 @@
 def highlighterhelp():
     """display a table with list of available Pygments lexers"""
     import pygments.lexers
-    headings = [_('Lexer description'),
-                _('Lexer names'),
-                _('File patterns'),
-                _('Mimetypes'),
-               ]
+    headings = [
+        _('Lexer description'),
+        _('Lexer names'),
+        _('File patterns'),
+        _('Mimetypes'),
+    ]
     lexers = pygments.lexers.get_all_lexers()
     rows = sorted([[desc, ' '.join(names), ' '.join(patterns), ' '.join(mimetypes), ]
                    for desc, names, patterns, mimetypes in lexers])
@@ -217,9 +196,10 @@
 @admin.route('/interwikihelp', methods=['GET', ])
 def interwikihelp():
     """display a table with list of known interwiki names / urls"""
-    headings = [_('InterWiki name'),
-                _('URL'),
-               ]
+    headings = [
+        _('InterWiki name'),
+        _('URL'),
+    ]
     rows = sorted(app.cfg.interwiki_map.items())
     return render_template('user/interwikihelp.html',
                            title_name=_(u"Interwiki Names"),
@@ -230,9 +210,10 @@
 @admin.route('/itemsize', methods=['GET', ])
 def itemsize():
     """display a table with item sizes"""
-    headings = [_('Size'),
-                _('Item name'),
-               ]
+    headings = [
+        _('Size'),
+        _('Item name'),
+    ]
     rows = [(rev.meta[SIZE], rev.name)
             for rev in flaskg.storage.documents(wikiname=app.cfg.interwikiname)]
     rows = sorted(rows, reverse=True)
--- a/MoinMoin/apps/feed/_tests/test_feed.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/feed/_tests/test_feed.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,6 +10,7 @@
 from MoinMoin.constants.keys import COMMENT
 from MoinMoin._tests import update_item, wikiconfig
 
+
 class TestFeeds(object):
     class Config(wikiconfig.Config):
         """
--- a/MoinMoin/apps/feed/views.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/feed/views.py	Sun Mar 03 07:44:25 2013 -0700
@@ -101,7 +101,7 @@
                      author=author,
                      url=url_for_item(name, rev=this_revid, _external=True),
                      updated=datetime.fromtimestamp(rev.meta[MTIME]),
-                    )
+            )
         content = feed.to_string()
         # Hack to add XSLT stylesheet declaration since AtomFeed doesn't allow this
         content = content.split("\n")
--- a/MoinMoin/apps/frontend/_tests/test_frontend.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/frontend/_tests/test_frontend.py	Sun Mar 03 07:44:25 2013 -0700
@@ -52,25 +52,25 @@
         self._test_view_post('frontend.ajaxdelete', status='200 OK', content_types=['application/json', ], data=['{', '}'], form=dict(
             comment='Test',
             itemnames='["DoesntExist"]',
-            ), viewopts=dict(item_name='DoesntExist'))
+        ), viewopts=dict(item_name='DoesntExist'))
 
     def test_ajaxdelete_no_item_name_route(self):
         self._test_view_post('frontend.ajaxdelete', status='200 OK', content_types=['application/json', ], data=['{', '}'], form=dict(
             comment='Test',
             itemnames='["DoesntExist"]',
-            ))
+        ))
 
     def test_ajaxdestroy_item_name_route(self):
         self._test_view_post('frontend.ajaxdestroy', status='200 OK', content_types=['application/json', ], data=['{', '}'], form=dict(
             comment='Test',
             itemnames='["DoesntExist"]',
-            ), viewopts=dict(item_name='DoesntExist'))
+        ), viewopts=dict(item_name='DoesntExist'))
 
     def test_ajaxdestroy_no_item_name_route(self):
         self._test_view_post('frontend.ajaxdestroy', status='200 OK', content_types=['application/json', ], data=['{', '}'], form=dict(
             comment='Test',
             itemnames='["DoesntExist"]',
-            ))
+        ))
 
     def test_ajaxmodify(self):
         self._test_view_post('frontend.ajaxmodify', status='404 NOT FOUND', viewopts=dict(item_name='DoesntExist'))
@@ -78,7 +78,7 @@
     def test_jfu_server(self):
         self._test_view_post('frontend.jfu_server', status='200 OK', data=['{', '}'], form=dict(
             data_file=FileStorage(StringIO("Hello, world"), filename='C:\\fakepath\\DoesntExist.txt', content_type='text/plain'),
-            ), viewopts=dict(item_name='WillBeCreated'), content_types=['application/json', ])
+        ), viewopts=dict(item_name='WillBeCreated'), content_types=['application/json', ])
 
     def test_show_item(self):
         self._test_view('frontend.show_item', status='404 NOT FOUND', viewopts=dict(item_name='DoesntExist'))
@@ -201,7 +201,7 @@
 
     def test_favicon(self):
         rv = self._test_view('frontend.favicon', content_types=['image/x-icon', 'image/vnd.microsoft.icon', ], data=[])
-        assert rv.data.startswith('\x00\x00') # "reserved word, should always be 0"
+        assert rv.data.startswith('\x00\x00')  # "reserved word, should always be 0"
 
     def test_global_tags(self):
         self._test_view('frontend.global_tags')
@@ -236,28 +236,28 @@
         flaskg.user = user.User(name=u'moin', password=u'Xiwejr622')
         form = self.fillPasswordChangeForm(u'Xiwejr622', u'Woodoo645', u'Woodoo645')
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_user_unicode_password_change(self):
         name = u'moin'
-        password = u'__שם משתמש לא קיים__' # Hebrew
+        password = u'__שם משתמש לא קיים__'  # Hebrew
 
         self.createUser(name, password)
         flaskg.user = user.User(name=name, password=password)
         form = self.fillPasswordChangeForm(password, u'Woodoo645', u'Woodoo645')
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_user_password_change_to_unicode_pw(self):
         name = u'moin'
         password = u'Xiwejr622'
-        new_password = u'__שם משתמש לא קיים__' # Hebrew
+        new_password = u'__שם משתמש לא קיים__'  # Hebrew
 
         self.createUser(name, password)
         flaskg.user = user.User(name=name, password=password)
         form = self.fillPasswordChangeForm(password, new_password, new_password)
         valid = form.validate()
-        assert valid # form data is valid
+        assert valid  # form data is valid
 
     def test_fail_user_password_change_pw_mismatch(self):
         self.createUser(u'moin', u'Xiwejr622')
@@ -281,14 +281,12 @@
         """ helper to fill UserSettingsPasswordForm form
         """
         FormClass = views.UserSettingsPasswordForm
-        request_form = ImmutableMultiDict(
-           [
-              ('usersettings_password_password_current', current_password),
-              ('usersettings_password_password1', password1),
-              ('usersettings_password_password2', password2),
-              ('usersettings_password_submit', u'Save')
-           ]
-        )
+        request_form = ImmutableMultiDict([
+            ('usersettings_password_password_current', current_password),
+            ('usersettings_password_password1', password1),
+            ('usersettings_password_password2', password2),
+            ('usersettings_password_submit', u'Save')
+        ])
         form = FormClass.from_flat(request_form)
         return form
 
--- a/MoinMoin/apps/frontend/views.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/frontend/views.py	Sun Mar 03 07:44:25 2013 -0700
@@ -30,7 +30,7 @@
 from flask.ext.babel import format_date
 from flask.ext.themes import get_themes_list
 
-from flatland import Form, Enum, List
+from flatland import Form, List
 from flatland.validation import Validator
 
 from jinja2 import Markup
@@ -47,7 +47,7 @@
 from MoinMoin.themes import render_template, contenttype_to_class
 from MoinMoin.apps.frontend import frontend
 from MoinMoin.forms import (OptionalText, RequiredText, URL, YourOpenID, YourEmail, RequiredPassword, Checkbox,
-                            InlineCheckbox, Select, Names, Tags, Natural, Hidden, MultiSelect)
+                            InlineCheckbox, Select, Names, Tags, Natural, Hidden, MultiSelect, Enum)
 from MoinMoin.items import BaseChangeForm, Item, NonExistent
 from MoinMoin.items.content import content_registry
 from MoinMoin import user, util
@@ -206,7 +206,7 @@
                                            title_name=title_name,
                                            lookup_form=lookup_form,
                                            results=results,
-                                          )
+                    )
                     flaskg.clock.stop('lookup render')
                     if not num_results:
                         status = 404
@@ -214,7 +214,7 @@
     html = render_template('lookup.html',
                            title_name=title_name,
                            lookup_form=lookup_form,
-                          )
+    )
     return Response(html, status)
 
 
@@ -292,14 +292,14 @@
                                    query=query,
                                    medium_search_form=search_form,
                                    item_name=item_name,
-                                  )
+            )
             flaskg.clock.stop('search render')
     else:
         html = render_template('search.html',
                                query=query,
                                medium_search_form=search_form,
                                item_name=item_name,
-                              )
+        )
     return html
 
 
@@ -367,7 +367,7 @@
         status = 200
     content = render_template('dom.xml',
                               data_xml=Markup(item.content._render_data_xml()),
-                             )
+    )
     return Response(content, status, mimetype='text/xml')
 
 
@@ -390,7 +390,7 @@
     return render_template('highlight.html',
                            item=item, item_name=item.name,
                            data_text=Markup(item.content._render_data_highlight()),
-                          )
+    )
 
 
 @presenter('meta', add_trail=True)
@@ -413,7 +413,7 @@
                            meta_rendered=Markup(item._render_meta()),
                            show_revision=show_revision,
                            show_navigation=show_navigation,
-                          )
+    )
 
 
 @frontend.route('/+content/+<rev>/<itemname:item_name>')
@@ -536,7 +536,7 @@
                            item=item, item_name=item_name,
                            rev_id=rev,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+rename/<itemname:item_name>', methods=['GET', 'POST'])
@@ -564,7 +564,7 @@
     return render_template(item.rename_template,
                            item=item, item_name=item_name,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+delete/<itemname:item_name>', methods=['GET', 'POST'])
@@ -593,7 +593,7 @@
     return render_template(item.delete_template,
                            item=item, item_name=item_name,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+ajaxdelete/<itemname:item_name>', methods=['POST'])
@@ -695,7 +695,7 @@
                            item=item, item_name=item_name,
                            rev_id=rev,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+jfu-server/<itemname:item_name>', methods=['POST'])
@@ -721,19 +721,18 @@
                        size=size,
                        url=url_for('.show_item', item_name=item_name, rev=revid),
                        contenttype=contenttype_to_class(contenttype),
-                      )
+        )
     except AccessDenied:
         abort(403)
 
 
-contenttype_groups = content_registry.group_names[:]
-contenttype_group_descriptions = {}
-for g in contenttype_groups:
-    contenttype_group_descriptions[g] = ', '.join([e.display_name for e in content_registry.groups[g]])
-contenttype_groups.append('unknown items')
+def contenttype_selects_gen():
+    for g in content_registry.group_names:
+        description = u', '.join([e.display_name for e in content_registry.groups[g]])
+        yield g, None, description
+    yield u'unknown items', None, u'Items of contenttype unknown to MoinMoin'
 
-ContenttypeGroup = MultiSelect.of(Enum.using(valid_values=contenttype_groups).with_properties(
-                                  descriptions=contenttype_group_descriptions)).using(optional=True)
+ContenttypeGroup = MultiSelect.of(Enum.out_of(contenttype_selects_gen())).using(optional=True)
 
 
 class IndexForm(Form):
@@ -756,7 +755,7 @@
     # more.
     form = IndexForm.from_flat(request.args.items(multi=True))
     if not form['contenttype']:
-        form['contenttype'].set(contenttype_groups)
+        form['contenttype'].set(ContenttypeGroup.member_schema.valid_values)
 
     selected_groups = form['contenttype'].value
     startswith = request.values.get("startswith")
@@ -775,7 +774,7 @@
                            initials=initials,
                            startswith=startswith,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+mychanges')
@@ -790,7 +789,7 @@
                            title_name=_(u'My Changes'),
                            headline=_(u'My Changes'),
                            item_names=my_changes
-                          )
+    )
 
 
 def _mychanges(userid):
@@ -821,7 +820,7 @@
                            item_name=item_name,
                            headline=_(u"Items which refer to '%(item_name)s'", item_name=item_name),
                            item_names=refs_here
-                          )
+    )
 
 
 def _backrefs(item_name):
@@ -861,7 +860,7 @@
                            item_name=item_name,  # XXX no item here
                            history_page=history_page,
                            bookmark_time=bookmark_time,
-                          )
+    )
 
 
 @frontend.route('/+history')
@@ -897,7 +896,7 @@
                            history=history,
                            current_timestamp=current_timestamp,
                            bookmark_time=bookmark_time,
-                          )
+    )
 
 
 def _compute_item_sets():
@@ -980,7 +979,7 @@
         # Try to unsubscribe
         if not u.unsubscribe(item_name):
             msg = _("Can't remove regular expression subscription!") + u' ' + \
-                  _("Edit the subscription regular expressions in your settings."), "error"
+                _("Edit the subscription regular expressions in your settings."), "error"
     else:
         # Try to subscribe
         if not u.subscribe(item_name):
@@ -1102,7 +1101,7 @@
                     else:
                         flash(_('An error occurred while sending the verification email: "%(message)s" '
                                 'Please contact an administrator to activate your account.',
-                            message=msg), "error")
+                                message=msg), "error")
                 else:
                     flash(_('Account created, please log in now.'), "info")
                 return redirect(url_for('.show_root'))
@@ -1110,7 +1109,7 @@
     return render_template(template,
                            title_name=title_name,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+verifyemail', methods=['GET'])
@@ -1183,7 +1182,7 @@
     return render_template('lostpass.html',
                            title_name=title_name,
                            form=form,
-                          )
+    )
 
 
 class ValidPasswordRecovery(Validator):
@@ -1244,7 +1243,7 @@
     return render_template('recoverpass.html',
                            title_name=title_name,
                            form=form,
-                          )
+    )
 
 
 class ValidLogin(Validator):
@@ -1317,7 +1316,7 @@
                            title_name=title_name,
                            login_inputs=app.cfg.auth_login_inputs,
                            form=form,
-                          )
+    )
 
 
 @frontend.route('/+logout')
@@ -1401,23 +1400,18 @@
         display_name = OptionalText.using(label=L_('Display-Name')).with_properties(
             placeholder=L_("Your display name (informational)"))
         openid = YourOpenID.using(optional=True)
-        #timezones_keys = sorted(Locale('en').time_zones.keys())
-        timezones_keys = [unicode(tz) for tz in pytz.common_timezones]
-        timezone = Select.using(label=L_('Timezone')).valued(*timezones_keys)
-        supported_locales = [Locale('en')] + app.babel_instance.list_translations()
-        locales_available = sorted([(unicode(l), l.display_name) for l in supported_locales],
-                                   key=lambda x: x[1])
-        locales_keys = [l[0] for l in locales_available]
-        locale = Select.using(label=L_('Locale')).with_properties(labels=dict(locales_available)).valued(*locales_keys)
+        #_timezones_keys = sorted(Locale('en').time_zones.keys())
+        _timezones_keys = [unicode(tz) for tz in pytz.common_timezones]
+        timezone = Select.using(label=L_('Timezone')).out_of((e, e) for e in _timezones_keys)
+        _supported_locales = [Locale('en')] + app.babel_instance.list_translations()
+        locale = Select.using(label=L_('Locale')).out_of(
+            ((unicode(l), l.display_name) for l in _supported_locales), sort_by=1)
         submit_label = L_('Save')
 
     class UserSettingsUIForm(Form):
         name = 'usersettings_ui'
-        themes_available = sorted([(unicode(t.identifier), t.name) for t in get_themes_list()],
-                                  key=lambda x: x[1])
-        themes_keys = [t[0] for t in themes_available]
-        theme_name = Select.using(label=L_('Theme name')).with_properties(
-            labels=dict(themes_available)).valued(*themes_keys)
+        theme_name = Select.using(label=L_('Theme name')).out_of(
+            ((unicode(t.identifier), t.name) for t in get_themes_list()), sort_by=1)
         css_url = URL.using(label=L_('User CSS URL'), optional=True).with_properties(
             placeholder=L_("Give the URL of your custom CSS (optional)"))
         edit_rows = Natural.using(label=L_('Editor size')).with_properties(
@@ -1531,7 +1525,7 @@
                 response['form'] = render_template('usersettings_ajax.html',
                                                    part=part,
                                                    form=form,
-                                                  )
+                )
                 return jsonify(**response)
             else:
                 # if it is not a XHR request but there is an redirect pending, we use a normal HTTP redirect
@@ -1550,7 +1544,7 @@
     return render_template('usersettings.html',
                            title_name=title_name,
                            form_objs=forms,
-                          )
+    )
 
 
 @frontend.route('/+bookmark')
@@ -1661,7 +1655,7 @@
                            last_rev_id=rev_ids[-1],
                            oldrev=oldrev,
                            newrev=newrev,
-                          )
+    )
 
 
 def _diff_raw(item, revid1, revid2):
@@ -1832,7 +1826,7 @@
     return render_template('sitemap.html',
                            item_name=item_name,  # XXX no item
                            sitemap=sitemap,
-                          )
+    )
 
 
 class NestedItemListBuilder(object):
--- a/MoinMoin/apps/misc/_tests/test_misc.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/misc/_tests/test_misc.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 from MoinMoin._tests import wikiconfig
 
+
 class TestMisc(object):
     class Config(wikiconfig.Config):
         """
--- a/MoinMoin/apps/misc/views.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/misc/views.py	Sun Mar 03 07:44:25 2013 -0700
@@ -18,8 +18,6 @@
 from MoinMoin.constants.keys import MTIME
 from MoinMoin.themes import render_template
 
-SITEMAP_HAS_SYSTEM_ITEMS = True
-
 
 @misc.route('/sitemap')
 def sitemap():
@@ -34,16 +32,9 @@
     for rev in flaskg.storage.documents(wikiname=app.cfg.interwikiname):
         name = rev.name
         mtime = rev.meta[MTIME]
-        if False:  # was: wikiutil.isSystemItem(name)   XXX add back later, when we have that in the index
-            if not SITEMAP_HAS_SYSTEM_ITEMS:
-                continue
-            # system items are rather boring
-            changefreq = "yearly"
-            priority = "0.1"
-        else:
-            # these are the content items:
-            changefreq = "daily"
-            priority = "0.5"
+        # these are the content items:
+        changefreq = "daily"
+        priority = "0.5"
         sitemap.append((name, format_timestamp(mtime), changefreq, priority))
     # add an entry for root url
     root_item = app.cfg.item_root
--- a/MoinMoin/apps/serve/_tests/test_serve.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/apps/serve/_tests/test_serve.py	Sun Mar 03 07:44:25 2013 -0700
@@ -7,6 +7,7 @@
 
 from flask import url_for
 
+
 class TestServe(object):
     def test_index(self):
         with self.app.test_client() as c:
--- a/MoinMoin/auth/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -289,7 +289,7 @@
                  remove_blanks=False,  # Joe Doe -> JoeDoe
                  coding='utf-8',  # for decoding REMOTE_USER correctly
                  **kw
-                ):
+    ):
         super(GivenAuth, self).__init__(**kw)
         self.env_var = env_var
         self.user_name = user_name
@@ -381,7 +381,7 @@
               'openid': kw.get('login_openid'),
               'multistage': (stage and True) or None,
               'attended': True
-             }
+    }
     # add the other parameters from the form
     for param in kw.keys():
         params[param] = kw.get(param)
--- a/MoinMoin/auth/_tests/test_auth.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/_tests/test_auth.py	Sun Mar 03 07:44:25 2013 -0700
@@ -12,6 +12,7 @@
 from MoinMoin.auth import GivenAuth, handle_login, get_multistage_continuation_url
 from MoinMoin.user import create_user
 
+
 class TestConfiguredGivenAuth(object):
     """ Test: configured GivenAuth """
     class Config(wikiconfig.Config):
@@ -52,6 +53,7 @@
         assert test_user.valid
         assert test_user.name == [u'Test_User', ]
 
+
 def test_handle_login():
     # no messages in the beginning
     assert not flaskg._login_messages
@@ -73,8 +75,10 @@
     assert test_user2.name == [u'Test_User', ]
     assert test_user2.valid
 
+
 def test_get_multistage_continuation_url():
-    test_url = get_multistage_continuation_url('test_auth_name', extra_fields={'password': 'test_pass', 'test_key': 'test_value'})
+    test_url = get_multistage_continuation_url('test_auth_name',
+                                               extra_fields={'password': 'test_pass', 'test_key': 'test_value'})
     assert 'test_key=test_value' in test_url
     assert 'password=test_pass' in test_url
     assert 'stage=test_auth_name' in test_url
--- a/MoinMoin/auth/_tests/test_ldap_login.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/_tests/test_ldap_login.py	Sun Mar 03 07:44:25 2013 -0700
@@ -23,6 +23,7 @@
 
 import ldap
 
+
 class TestLDAPServer(LDAPTstBase):
     basedn = BASEDN
     rootdn = ROOTDN
@@ -35,13 +36,14 @@
         server_uri = self.ldap_env.slapd.url
         base_dn = self.ldap_env.basedn
         lo = ldap.initialize(server_uri)
-        ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3) # ldap v2 is outdated
+        ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)  # ldap v2 is outdated
         lo.simple_bind_s('', '')
         lusers = lo.search_st(base_dn, ldap.SCOPE_SUBTREE, '(uid=*)')
         uids = [ldap_dict['uid'][0] for dn, ldap_dict in lusers]
         assert 'usera' in uids
         assert 'userb' in uids
 
+
 class TestMoinLDAPLogin(LDAPTstBase):
     basedn = BASEDN
     rootdn = ROOTDN
@@ -132,6 +134,7 @@
         u2 = handle_login(None, username='usera', password='wrong')
         assert u2 is None
 
+
 class TestTwoLdapServers(object):
     basedn = BASEDN
     rootdn = ROOTDN
@@ -148,7 +151,7 @@
             started = ldap_env.start_slapd()
             if not started:
                 pytest.skip("Failed to start {0} process, please see your syslog / log files"
-                             " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
+                            " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
             ldap_env.load_directory(ldif_content=self.ldif_content)
             self.ldap_envs.append(ldap_env)
 
@@ -164,7 +167,7 @@
             server_uri = ldap_env.slapd.url
             base_dn = ldap_env.basedn
             lo = ldap.initialize(server_uri)
-            ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3) # ldap v2 is outdated
+            ldap.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)  # ldap v2 is outdated
             lo.simple_bind_s('', '')
             lusers = lo.search_st(base_dn, ldap.SCOPE_SUBTREE, '(uid=*)')
             uids = [ldap_dict['uid'][0] for dn, ldap_dict in lusers]
@@ -188,7 +191,7 @@
             started = ldap_env.start_slapd()
             if not started:
                 pytest.skip("Failed to start {0} process, please see your syslog / log files"
-                             " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
+                            " (and check if stopping apparmor helps, in case you use it).".format(SLAPD_EXECUTABLE))
             ldap_env.load_directory(ldif_content=self.ldif_content)
             self.ldap_envs.append(ldap_env)
 
@@ -198,13 +201,13 @@
         server_uri = 'ldap://127.0.0.1:3891'
         base_dn = 'ou=testing,dc=example,dc=org'
         ldap_auth1 = LDAPAuth(server_uri=server_uri, base_dn=base_dn,
-                             name="ldap1", autocreate=True,
-                             timeout=1)
+                              name="ldap1", autocreate=True,
+                              timeout=1)
         # short timeout, faster testing
         server_uri = 'ldap://127.0.0.1:3892'
         ldap_auth2 = LDAPAuth(server_uri=server_uri, base_dn=base_dn,
-                             name="ldap2", autocreate=True,
-                             timeout=1)
+                              name="ldap2", autocreate=True,
+                              timeout=1)
 
         auth = [ldap_auth1, ldap_auth2]
 
@@ -214,7 +217,7 @@
             try:
                 ldap_env.stop_slapd()
             except:
-                pass # one will fail, because it is already stopped
+                pass  # one will fail, because it is already stopped
             ldap_env.destroy_env()
 
     def testMoinLDAPFailOver(self):
--- a/MoinMoin/auth/ldap_login.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/ldap_login.py	Sun Mar 03 07:44:25 2013 -0700
@@ -41,7 +41,8 @@
     logout_possible = True
     name = 'ldap'
 
-    def __init__(self,
+    def __init__(
+        self,
         server_uri='ldap://localhost',  # ldap / active directory server URI
                                         # use ldaps://server:636 url for ldaps,
                                         # use  ldap://server for ldap without tls (and set start_tls to 0),
@@ -87,7 +88,7 @@
         name='ldap',  # use e.g. 'ldap_pdc' and 'ldap_bdc' (or 'ldap1' and 'ldap2') if you auth against 2 ldap servers
         report_invalid_credentials=True,  # whether to emit "invalid username or password" msg at login time or not
         **kw
-        ):
+    ):
         super(LDAPAuth, self).__init__(**kw)
         self.server_uri = server_uri
         self.bind_dn = bind_dn
@@ -176,11 +177,11 @@
                 filterstr = self.search_filter % locals()
                 logging.debug("Searching {0!r}".format(filterstr))
                 attrs = [getattr(self, attr) for attr in [
-                                         'email_attribute',
-                                         'displayname_attribute',
-                                         'surname_attribute',
-                                         'givenname_attribute',
-                                         ] if getattr(self, attr) is not None]
+                    'email_attribute',
+                    'displayname_attribute',
+                    'surname_attribute',
+                    'givenname_attribute',
+                ] if getattr(self, attr) is not None]
                 lusers = l.search_st(self.base_dn, self.scope, filterstr.encode(coding),
                                      attrlist=attrs, timeout=self.timeout)
                 # we remove entries with dn == None to get the real result list:
--- a/MoinMoin/auth/openidrp.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/openidrp.py	Sun Mar 03 07:44:25 2013 -0700
@@ -99,7 +99,7 @@
                                                            _external=True,
                                                            openid_openid=identity,
                                                            openid_submit='1'
-                                                          ))
+                    ))
 
             # not trusted
             return ContinueLogin(None, _('This OpenID provider is not trusted.'))
--- a/MoinMoin/auth/smb_mount.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/auth/smb_mount.py	Sun Mar 03 07:44:25 2013 -0700
@@ -23,7 +23,8 @@
 
         See man mount.cifs for details.
     """
-    def __init__(self,
+    def __init__(
+        self,
         server,  # mount.cifs //server/share
         share,  # mount.cifs //server/share
         mountpoint_fn,  # function of username to determine the mountpoint, e.g.:
@@ -36,7 +37,7 @@
         coding='utf-8',  # encoding used for username/password/cmdline (try 'iso8859-1' if default does not work)
         log='/dev/null',  # logfile for mount.cifs output
         **kw
-        ):
+    ):
         super(SMBMount, self).__init__(**kw)
         self.server = server
         self.share = share
--- a/MoinMoin/config/_tests/test_defaultconfig.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/config/_tests/test_defaultconfig.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,22 +10,24 @@
 
 from flask import current_app as app
 
+
 class TestPasswordChecker(object):
     username = u"SomeUser"
     tests_builtin = [
-        (u'', False), # empty
-        (u'1966', False), # too short
-        (u'asdfghjk', False), # keyboard sequence
-        (u'QwertZuiop', False), # german keyboard sequence, with uppercase
-        (u'mnbvcx', False), # reverse keyboard sequence
-        (u'12345678', False), # keyboard sequence, too easy
-        (u'aaaaaaaa', False), # not enough different chars
-        (u'BBBaaaddd', False), # not enough different chars
-        (username, False), # username == password
-        (username[1:-1], False), # password in username
-        (u"XXX{0}XXX".format(username), False), # username in password
-        (u'Moin-2007', True), # this should be OK
+        (u'', False),  # empty
+        (u'1966', False),  # too short
+        (u'asdfghjk', False),  # keyboard sequence
+        (u'QwertZuiop', False),  # german keyboard sequence, with uppercase
+        (u'mnbvcx', False),  # reverse keyboard sequence
+        (u'12345678', False),  # keyboard sequence, too easy
+        (u'aaaaaaaa', False),  # not enough different chars
+        (u'BBBaaaddd', False),  # not enough different chars
+        (username, False),  # username == password
+        (username[1:-1], False),  # password in username
+        (u"XXX{0}XXX".format(username), False),  # username in password
+        (u'Moin-2007', True),  # this should be OK
     ]
+
     def testBuiltinPasswordChecker(self):
         pw_checker = app.cfg.password_checker
         if not pw_checker:
@@ -36,4 +38,5 @@
                 print "{0!r}: {1}".format(pw, pw_error)
                 assert result == (pw_error is None)
 
+
 coverage_modules = ['MoinMoin.config.default']
--- a/MoinMoin/config/default.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/config/default.py	Sun Mar 03 07:44:25 2013 -0700
@@ -181,9 +181,9 @@
         error message with unknown names.
         """
         unknown = ['"{0}"'.format(name) for name in dir(self)
-                  if not name.startswith('_') and
-                  name not in DefaultConfig.__dict__ and
-                  not isinstance(getattr(self, name), (type(re), type(DefaultConfig)))]
+                   if not name.startswith('_') and
+                   name not in DefaultConfig.__dict__ and
+                   not isinstance(getattr(self, name), (type(re), type(DefaultConfig)))]
         if unknown:
             msg = """
 Unknown configuration options: {0}.
@@ -287,7 +287,7 @@
 
     keyboards = (ur"`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./",  # US kbd
                  ur"^1234567890ß´qwertzuiopü+asdfghjklöä#yxcvbnm,.-",  # german kbd
-                )  # TODO add more keyboards!
+    )  # TODO add more keyboards!
     for kbd in keyboards:
         rev_kbd = kbd[::-1]
         if password in kbd or password in rev_kbd or \
@@ -308,236 +308,222 @@
 # information on the layout of this structure.
 #
 options_no_group_name = {
-  # ==========================================================================
-  'datastruct': ('Datastruct', None, (
-    #('dicts', lambda cfg: datastruct.ConfigDicts({}),
-    ('dicts', lambda cfg: datastruct.WikiDicts(),
-     "function f(cfg) that returns a backend which is used to access dicts definitions."),
-    #('groups', lambda cfg: datastruct.ConfigGroups({}),
-    ('groups', lambda cfg: datastruct.WikiGroups(),
-     "function f(cfg) that returns a backend which is used to access groups definitions."),
-  )),
-  # ==========================================================================
-  'auth': ('Authentication / Authorization / Security', None, (
-    ('auth', DefaultExpression('[MoinAuth()]'),
-     "list of auth objects, to be called in this order (see HelpOnAuthentication)"),
-    ('secrets', None, """Either a long shared secret string used for multiple purposes or a dict {"purpose": "longsecretstring", ...} for setting up different shared secrets for different purposes."""),
-    ('SecurityPolicy',
-     DefaultSecurityPolicy,
-     "Class object hook for implementing security restrictions or relaxations"),
-    ('endpoints_excluded',
-     [],
-     "Exclude unwanted endpoints (list of strings)"),
-
-    ('password_checker', DefaultExpression('_default_password_checker'),
-     'checks whether a password is acceptable (default check is length >= 6, at least 4 different chars, no keyboard sequence, not username used somehow (you can switch this off by using `None`)'),
-
-    ('passlib_crypt_context', dict(
-        # schemes we want to support (or deprecated schemes for which we still have
-        # hashes in our storage).
-        # note about bcrypt: it needs additional code (that is not pure python and
-        # thus either needs compiling or installing platform-specific binaries)
-        schemes=["sha512_crypt", ],
-        # default scheme for creating new pw hashes (if not given, passlib uses first from schemes)
-        #default="sha512_crypt",
-        # deprecated schemes get auto-upgraded to the default scheme at login
-        # time or when setting a password (including doing a moin account pwreset).
-        #deprecated=["auto"],
-        # vary rounds parameter randomly when creating new hashes...
-        #all__vary_rounds=0.1,
-     ),
-     "passlib CryptContext arguments, see passlib docs"),
-  )),
-  # ==========================================================================
-  'spam_leech_dos': ('Anti-Spam / Leech / DOS',
-  'These settings help limiting ressource usage and avoiding abuse.',
-  (
-    ('textchas', None,
-     "Spam protection setup using site-specific questions/answers, see HelpOnSpam."),
-    ('textchas_expiry_time', 600,
-     "Time [s] for a !TextCha to expire."),
-  )),
-  # ==========================================================================
-  'style': ('Style / Theme / UI',
-  'These settings control how the wiki user interface will look like.',
-  (
-    ('sitename', u'Untitled Wiki',
-     "Short description of your wiki site, displayed below the logo on each page, and used in RSS documents as the channel title [Unicode]"),
-    ('interwikiname', None, "unique, stable and required InterWiki name (prefix, moniker) of the site [Unicode]"),
-    ('html_pagetitle', None, "Allows you to set a specific HTML page title (if None, it defaults to the value of `sitename`) [Unicode]"),
-    ('navi_bar', [
-        ('wikilink', 'frontend.show_root', dict(), L_('Home'), L_('Home Page')),
-        ('wikilink', 'frontend.global_history', dict(), L_('History'), L_('Global History')),
-        ('wikilink', 'frontend.index', dict(), L_('Index'), L_('Global Index')),
-        ('wikilink', 'frontend.global_tags', dict(), L_('Tags'), L_('Global Tags Index')),
-        ('wikilink', 'admin.index_user', dict(), L_('User'), L_('User')),
-        ('wikilink', 'admin.index', dict(), L_('Admin'), L_('Administration & Docs')),
-     ],
-     'Data to create the navi_bar from. Users can add more items in their quick links in user preferences. You need to configure a list of tuples (css_class, endpoint, args, label, title). Use L_() for translating. [list of tuples]'),
-
-    ('theme_default', u'modernized', "Default theme."),
-
-    ('serve_files', {},
-     """
-     Dictionary of name: filesystem_path for static file resources to serve
-     from the filesystem as url .../+serve/<name>/...
-     """),
-
-    ('supplementation_item_names', [u'Discussion', ],
-     "List of names of the supplementation (sub)items [Unicode]"),
-
-    ('interwiki_preferred', [], "In dialogues, show those wikis at the top of the list [list of Unicode]."),
-    ('sistersites', [], "list of tuples `('WikiName', 'sisterpagelist_fetch_url')`"),
-
-    ('trail_size', 5,
-     "Number of items in the trail of recently visited items"),
-
-    ('item_views', [
-        # (endpointname, label, check_item_exists
-        ('frontend.show_item', L_('Show'), L_('Show'), False, ),
-        ('frontend.download_item', L_('Download'), L_('Download'), True, ),
-        ('frontend.history', L_('History'), L_('Revision History'), True, ),
-        # note: when rendering a non-existing item, you'll be offered to
-        # create it (in the content area), so we do not offer "Modify":
-        ('frontend.modify_item', L_('Modify'), L_('Edit or Upload'), True, ),
-        ('special.supplementation', None, None, False, ),
-        ('frontend.index', L_('Index'), L_('List sub-items'), False, ),
-        ('special.comments', L_('Comments'), L_('Hide comments'), True, ),
-        ('special.transclusions', L_('Transclusions'), L_('Show transclusions'), True, ),
-        ('frontend.highlight_item', L_('Highlight'), L_('Show with Syntax-Highlighting'), True, ),
-        ('frontend.show_item_meta', L_('Meta'), L_('Display Metadata'), True, ),
-        ('frontend.quicklink_item', None, L_('Create or remove a navigation link to this item'), False, ),
-        ('frontend.subscribe_item', None, L_('Switch notifications about item changes on or off'), False, ),
-        ('frontend.rename_item', L_('Rename'), L_('Rename this item'), True, ),
-        ('frontend.delete_item', L_('Delete'), L_('Delete this item'), True, ),
-        ('frontend.destroy_item', L_('Destroy'), L_('Completely destroy this item'), True, ),
-        ('frontend.backrefs', L_('Referrers'), L_('What refers here?'), False, ),
-        ('frontend.sitemap', L_('Site Map'), L_('Local Site Map of this item'), True, ),
-        ('frontend.similar_names', L_('Similar'), L_('Items with similar names'), False, ),
-     ],
-     'list of edit bar entries (list of tuples (endpoint, label))'),
+    # ==========================================================================
+    'datastruct': ('Datastruct', None, (
+        # ('dicts', lambda cfg: datastruct.ConfigDicts({}),
+        ('dicts', lambda cfg: datastruct.WikiDicts(),
+         "function f(cfg) that returns a backend which is used to access dicts definitions."),
+        # ('groups', lambda cfg: datastruct.ConfigGroups({}),
+        ('groups', lambda cfg: datastruct.WikiGroups(),
+         "function f(cfg) that returns a backend which is used to access groups definitions."),
+    )),
+    # ==========================================================================
+    'auth': ('Authentication / Authorization / Security', None, (
+        ('auth', DefaultExpression('[MoinAuth()]'),
+         "list of auth objects, to be called in this order (see HelpOnAuthentication)"),
+        ('secrets', None, """Either a long shared secret string used for multiple purposes or a dict {"purpose": "longsecretstring", ...} for setting up different shared secrets for different purposes."""),
+        ('SecurityPolicy',
+         DefaultSecurityPolicy,
+         "Class object hook for implementing security restrictions or relaxations"),
+        ('endpoints_excluded',
+         [],
+         "Exclude unwanted endpoints (list of strings)"),
+        ('password_checker', DefaultExpression('_default_password_checker'),
+         'checks whether a password is acceptable (default check is length >= 6, at least 4 different chars, no keyboard sequence, not username used somehow (you can switch this off by using `None`)'),
 
-    ('show_hosts', True,
-     "if True, show host names and IPs. Set to False to hide them."),
-    ('show_interwiki', False,
-     "if True, let the theme display your interwiki name"),
-    ('show_names', True,
-     "if True, show user names in the revision history and on Recent``Changes. Set to False to hide them."),
-    ('show_section_numbers', False,
-     'show section numbers in headings by default'),
-    ('show_rename_redirect', False, "if True, offer creation of redirect pages when renaming wiki pages"),
-
-    ('template_dirs', [], "list of directories with templates that will override theme and base templates."),
-  )),
-  # ==========================================================================
-  'editor': ('Editor', None, (
-    ('item_license', u'', 'if set, show the license item within the editor. [Unicode]'),
-    #('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
-    ('edit_ticketing', True, None),
-  )),
-  # ==========================================================================
-  'paging': ('Paging', None, (
-    ('results_per_page', 50, "Number of results to be shown on a single page in pagination"),
-  )),
-  # ==========================================================================
-  'data': ('Data Storage', None, (
-    ('data_dir', './data/', "Path to the data directory."),
-    ('plugin_dirs', [], "Plugin directories."),
-
-    ('interwiki_map', {},
-     "Dictionary of wiki_name -> wiki_url"),
-    ('namespace_mapping', None,
-    "A list of tuples, each tuple containing: Namespace identifier, backend name. " +
-    "E.g.: [('', 'default')), ]. Please see HelpOnStorageConfiguration for further reference."),
-    ('backend_mapping', None,
-    "A dictionary that maps backend names to backends. " +
-    "E.g.: {'default': Backend(), }. Please see HelpOnStorageConfiguration for further reference."),
-    ('acl_mapping', None,
-    "This needs to point to a list of tuples, each tuple containing: name prefix, acl protection to be applied to matching items. " +
-    "E.g.: [('', dict(default='All:read,write,create')), ]. Please see HelpOnStorageConfiguration for further reference."),
-    ('create_storage', False, "Create (initialize) the storage backends before trying to use them."),
-    ('create_index', False, "Create (initialize) the index before trying to use them."),
-    ('destroy_storage', False, "Destroy (empty) the storage backends after using them."),
-    ('destroy_index', False, "Destroy (empty) the index after using it."),
-  )),
-  # ==========================================================================
-  'items': ('Special Item Names', None, (
-    ('item_root', u'Home', "Name of the root item (aka 'front page'). [Unicode]"),
+        ('passlib_crypt_context', dict(
+            # schemes we want to support (or deprecated schemes for which we still have
+            # hashes in our storage).
+            # note about bcrypt: it needs additional code (that is not pure python and
+            # thus either needs compiling or installing platform-specific binaries)
+            schemes=["sha512_crypt", ],
+            # default scheme for creating new pw hashes (if not given, passlib uses first from schemes)
+            #default="sha512_crypt",
+            # deprecated schemes get auto-upgraded to the default scheme at login
+            # time or when setting a password (including doing a moin account pwreset).
+            #deprecated=["auto"],
+            # vary rounds parameter randomly when creating new hashes...
+            #all__vary_rounds=0.1,
+        ), "passlib CryptContext arguments, see passlib docs"),
+    )),
+    # ==========================================================================
+    'spam_leech_dos': ('Anti-Spam / Leech / DOS', 'These settings help limiting ressource usage and avoiding abuse.', (
+        ('textchas', None,
+         "Spam protection setup using site-specific questions/answers, see HelpOnSpam."),
+        ('textchas_expiry_time', 600,
+         "Time [s] for a !TextCha to expire."),
+    )),
+    # ==========================================================================
+    'style': ('Style / Theme / UI', 'These settings control how the wiki user interface will look like.', (
+        ('sitename', u'Untitled Wiki',
+         "Short description of your wiki site, displayed below the logo on each page, and used in RSS documents as the channel title [Unicode]"),
+        ('interwikiname', None, "unique, stable and required InterWiki name (prefix, moniker) of the site [Unicode]"),
+        ('html_pagetitle', None, "Allows you to set a specific HTML page title (if None, it defaults to the value of `sitename`) [Unicode]"),
+        ('navi_bar', [
+            ('wikilink', 'frontend.show_root', dict(), L_('Home'), L_('Home Page')),
+            ('wikilink', 'frontend.global_history', dict(), L_('History'), L_('Global History')),
+            ('wikilink', 'frontend.index', dict(), L_('Index'), L_('Global Index')),
+            ('wikilink', 'frontend.global_tags', dict(), L_('Tags'), L_('Global Tags Index')),
+            ('wikilink', 'admin.index_user', dict(), L_('User'), L_('User')),
+            ('wikilink', 'admin.index', dict(), L_('Admin'), L_('Administration & Docs')),
+        ], 'Data to create the navi_bar from. Users can add more items in their quick links in user preferences. You need to configure a list of tuples (css_class, endpoint, args, label, title). Use L_() for translating. [list of tuples]'),
 
-    # the following regexes should match the complete name when used in free text
-    # the group 'all' shall match all, while the group 'key' shall match the key only
-    # e.g. FooGroup -> group 'all' ==  FooGroup, group 'key' == Foo
-    # moin's code will add ^ / $ at beginning / end when needed
-    ('item_dict_regex', ur'(?P<all>(?P<key>\S+)Dict)',
-     'Item names exactly matching this regex are regarded as items containing variable dictionary definitions [Unicode]'),
-    ('item_group_regex', ur'(?P<all>(?P<key>\S+)Group)',
-     'Item names exactly matching this regex are regarded as items containing group definitions [Unicode]'),
-  )),
-  # ==========================================================================
-  'user': ('User Preferences', None, (
-    ('user_defaults',
-     {
-        NAME: [],
-        DISPLAY_NAME: None,
-        EMAIL: None,
-        OPENID: None,
-        CSS_URL: None,
-        MAILTO_AUTHOR: False,
-        EDIT_ON_DOUBLECLICK: True,
-        SCROLL_PAGE_AFTER_EDIT: True,
-        SHOW_COMMENTS: False,
-        WANT_TRIVIAL: False,
-        ENC_PASSWORD: u'',  # empty value == invalid hash
-        DISABLED: False,
-        BOOKMARKS: {},
-        QUICKLINKS: [],
-        SUBSCRIBED_ITEMS: [],
-        EMAIL_SUBSCRIBED_EVENTS: [
-            # XXX PageChangedEvent.__name__
-            # XXX PageRenamedEvent.__name__
-            # XXX PageDeletedEvent.__name__
-            # XXX PageCopiedEvent.__name__
-            # XXX PageRevertedEvent.__name__
-        ],
-        THEME_NAME: None,  # None -> use cfg.theme_default
-        EDIT_ROWS: 0,
-        RESULTS_PER_PAGE: 0,
-        LOCALE: None,  # None -> do browser language detection, otherwise just use this locale
-        TIMEZONE: None,  # None -> use cfg.timezone_default
-     },
-     'Default attributes of the user object'),
-  )),
-  # ==========================================================================
-  'various': ('Various', None, (
-    ('bang_meta', True, 'if True, enable {{{!NoWikiName}}} markup'),
+        ('theme_default', u'modernized', "Default theme."),
 
-    ('config_check_enabled', False, "if True, check configuration for unknown settings."),
-
-    ('timezone_default', u'UTC', "Default time zone."),
-    ('locale_default', u'en_US', "Default locale for user interface and content."),
-
-    ('log_remote_addr', True,
-     "if True, log the remote IP address (and maybe hostname)."),
-    ('log_reverse_dns_lookups', True,
-     "if True, do a reverse DNS lookup on page SAVE. If your DNS is broken, set this to False to speed up SAVE."),
+        ('serve_files', {},
+         """
+         Dictionary of name: filesystem_path for static file resources to serve
+         from the filesystem as url .../+serve/<name>/...
+         """),
 
-    # some dangerous mimetypes (we don't use "content-disposition: inline" for them when a user
-    # downloads such data, because the browser might execute e.g. Javascript contained
-    # in the HTML and steal your moin session cookie or do other nasty stuff)
-    ('mimetypes_xss_protect',
-     [
-       'text/html',
-       'application/x-shockwave-flash',
-       'application/xhtml+xml',
-     ],
-     '"content-disposition: inline" is not used for downloads of such data'),
+        ('supplementation_item_names', [u'Discussion', ],
+         "List of names of the supplementation (sub)items [Unicode]"),
 
-    ('refresh', None,
-     "refresh = (minimum_delay_s, targets_allowed) enables use of `#refresh 5 PageName` processing instruction, targets_allowed must be either `'internal'` or `'external'`"),
+        ('interwiki_preferred', [], "In dialogues, show those wikis at the top of the list [list of Unicode]."),
+        ('sistersites', [], "list of tuples `('WikiName', 'sisterpagelist_fetch_url')`"),
 
-    ('siteid', 'MoinMoin', None),  # XXX just default to some existing module name to
-                                   # make plugin loader etc. work for now
-  )),
+        ('trail_size', 5,
+         "Number of items in the trail of recently visited items"),
+
+        ('item_views', [
+            # (endpointname, label, check_item_exists
+            ('frontend.show_item', L_('Show'), L_('Show'), False, ),
+            ('frontend.download_item', L_('Download'), L_('Download'), True, ),
+            ('frontend.history', L_('History'), L_('Revision History'), True, ),
+            # note: when rendering a non-existing item, you'll be offered to
+            # create it (in the content area), so we do not offer "Modify":
+            ('frontend.modify_item', L_('Modify'), L_('Edit or Upload'), True, ),
+            ('special.supplementation', None, None, False, ),
+            ('frontend.index', L_('Index'), L_('List sub-items'), False, ),
+            ('special.comments', L_('Comments'), L_('Hide comments'), True, ),
+            ('special.transclusions', L_('Transclusions'), L_('Show transclusions'), True, ),
+            ('frontend.highlight_item', L_('Highlight'), L_('Show with Syntax-Highlighting'), True, ),
+            ('frontend.show_item_meta', L_('Meta'), L_('Display Metadata'), True, ),
+            ('frontend.quicklink_item', None, L_('Create or remove a navigation link to this item'), False, ),
+            ('frontend.subscribe_item', None, L_('Switch notifications about item changes on or off'), False, ),
+            ('frontend.rename_item', L_('Rename'), L_('Rename this item'), True, ),
+            ('frontend.delete_item', L_('Delete'), L_('Delete this item'), True, ),
+            ('frontend.destroy_item', L_('Destroy'), L_('Completely destroy this item'), True, ),
+            ('frontend.backrefs', L_('Referrers'), L_('What refers here?'), False, ),
+            ('frontend.sitemap', L_('Site Map'), L_('Local Site Map of this item'), True, ),
+            ('frontend.similar_names', L_('Similar'), L_('Items with similar names'), False, ),
+        ], 'list of edit bar entries (list of tuples (endpoint, label))'),
+
+        ('show_hosts', True,
+         "if True, show host names and IPs. Set to False to hide them."),
+        ('show_interwiki', False,
+         "if True, let the theme display your interwiki name"),
+        ('show_names', True,
+         "if True, show user names in the revision history and on Recent``Changes. Set to False to hide them."),
+        ('show_section_numbers', False,
+         'show section numbers in headings by default'),
+        ('show_rename_redirect', False, "if True, offer creation of redirect pages when renaming wiki pages"),
+
+        ('template_dirs', [], "list of directories with templates that will override theme and base templates."),
+    )),
+    # ==========================================================================
+    'editor': ('Editor', None, (
+        ('item_license', u'', 'if set, show the license item within the editor. [Unicode]'),
+        #('edit_locking', 'warn 10', "Editor locking policy: `None`, `'warn <timeout in minutes>'`, or `'lock <timeout in minutes>'`"),
+        ('edit_ticketing', True, None),
+    )),
+    # ==========================================================================
+    'paging': ('Paging', None, (
+        ('results_per_page', 50, "Number of results to be shown on a single page in pagination"),
+    )),
+    # ==========================================================================
+    'data': ('Data Storage', None, (
+        ('data_dir', './data/', "Path to the data directory."),
+        ('plugin_dirs', [], "Plugin directories."),
+
+        ('interwiki_map', {},
+         "Dictionary of wiki_name -> wiki_url"),
+        ('namespace_mapping', None,
+         "A list of tuples, each tuple containing: Namespace identifier, backend name. " +
+         "E.g.: [('', 'default')), ]. Please see HelpOnStorageConfiguration for further reference."),
+        ('backend_mapping', None,
+         "A dictionary that maps backend names to backends. " +
+         "E.g.: {'default': Backend(), }. Please see HelpOnStorageConfiguration for further reference."),
+        ('acl_mapping', None,
+         "This needs to point to a list of tuples, each tuple containing: name prefix, acl protection to be applied to matching items. " +
+         "E.g.: [('', dict(default='All:read,write,create')), ]. Please see HelpOnStorageConfiguration for further reference."),
+        ('create_storage', False, "Create (initialize) the storage backends before trying to use them."),
+        ('create_index', False, "Create (initialize) the index before trying to use them."),
+        ('destroy_storage', False, "Destroy (empty) the storage backends after using them."),
+        ('destroy_index', False, "Destroy (empty) the index after using it."),
+    )),
+    # ==========================================================================
+    'items': ('Special Item Names', None, (
+        ('item_root', u'Home', "Name of the root item (aka 'front page'). [Unicode]"),
+
+        # the following regexes should match the complete name when used in free text
+        # the group 'all' shall match all, while the group 'key' shall match the key only
+        # e.g. FooGroup -> group 'all' ==  FooGroup, group 'key' == Foo
+        # moin's code will add ^ / $ at beginning / end when needed
+        ('item_dict_regex', ur'(?P<all>(?P<key>\S+)Dict)',
+         'Item names exactly matching this regex are regarded as items containing variable dictionary definitions [Unicode]'),
+        ('item_group_regex', ur'(?P<all>(?P<key>\S+)Group)',
+         'Item names exactly matching this regex are regarded as items containing group definitions [Unicode]'),
+    )),
+    # ==========================================================================
+    'user': ('User Preferences', None, (
+        ('user_defaults', {
+            NAME: [],
+            DISPLAY_NAME: None,
+            EMAIL: None,
+            OPENID: None,
+            CSS_URL: None,
+            MAILTO_AUTHOR: False,
+            EDIT_ON_DOUBLECLICK: True,
+            SCROLL_PAGE_AFTER_EDIT: True,
+            SHOW_COMMENTS: False,
+            WANT_TRIVIAL: False,
+            ENC_PASSWORD: u'',  # empty value == invalid hash
+            DISABLED: False,
+            BOOKMARKS: {},
+            QUICKLINKS: [],
+            SUBSCRIBED_ITEMS: [],
+            EMAIL_SUBSCRIBED_EVENTS: [
+                # XXX PageChangedEvent.__name__
+                # XXX PageRenamedEvent.__name__
+                # XXX PageDeletedEvent.__name__
+                # XXX PageCopiedEvent.__name__
+                # XXX PageRevertedEvent.__name__
+            ],
+            THEME_NAME: None,  # None -> use cfg.theme_default
+            EDIT_ROWS: 0,
+            RESULTS_PER_PAGE: 0,
+            LOCALE: None,  # None -> do browser language detection, otherwise just use this locale
+            TIMEZONE: None,  # None -> use cfg.timezone_default
+        }, 'Default attributes of the user object'),
+    )),
+    # ==========================================================================
+    'various': ('Various', None, (
+        ('bang_meta', True, 'if True, enable {{{!NoWikiName}}} markup'),
+
+        ('config_check_enabled', False, "if True, check configuration for unknown settings."),
+
+        ('timezone_default', u'UTC', "Default time zone."),
+        ('locale_default', u'en_US', "Default locale for user interface and content."),
+
+        ('log_remote_addr', True,
+         "if True, log the remote IP address (and maybe hostname)."),
+        ('log_reverse_dns_lookups', True,
+         "if True, do a reverse DNS lookup on page SAVE. If your DNS is broken, set this to False to speed up SAVE."),
+
+        # some dangerous mimetypes (we don't use "content-disposition: inline" for them when a user
+        # downloads such data, because the browser might execute e.g. Javascript contained
+        # in the HTML and steal your moin session cookie or do other nasty stuff)
+        ('mimetypes_xss_protect', [
+            'text/html',
+            'application/x-shockwave-flash',
+            'application/xhtml+xml',
+        ], '"content-disposition: inline" is not used for downloads of such data'),
+
+        ('refresh', None, "refresh = (minimum_delay_s, targets_allowed) enables use of `#refresh 5 PageName` processing instruction, targets_allowed must be either `'internal'` or `'external'`"),
+        ('siteid', 'MoinMoin', None),  # XXX just default to some existing module name to
+                                       # make plugin loader etc. work for now
+    )),
 }
 
 #
@@ -564,45 +550,38 @@
 #
 #
 options = {
-    'acl': ('Access Control Lists',
-    'ACLs control who may do what.',
-    (
-      ('functions', u'',
-       'Access Control List for functions.'),
-      ('rights_contents', ACL_RIGHTS_CONTENTS,
-       'Valid tokens for right sides of content ACL entries.'),
-      ('rights_functions', ACL_RIGHTS_FUNCTIONS,
-       'Valid tokens for right sides of function ACL entries.'),
+    'acl': ('Access Control Lists', 'ACLs control who may do what.', (
+        ('functions', u'', 'Access Control List for functions.'),
+        ('rights_contents', ACL_RIGHTS_CONTENTS, 'Valid tokens for right sides of content ACL entries.'),
+        ('rights_functions', ACL_RIGHTS_FUNCTIONS, 'Valid tokens for right sides of function ACL entries.'),
     )),
 
     'ns': ('Storage Namespaces',
     "Storage namespaces can be defined for all sorts of data. All items sharing a common namespace as prefix" +
     "are then stored within the same backend. The common prefix for all data is ''.",
     (
-      ('content', '/', "All content is by default stored below /, hence the prefix is ''."),  # Not really necessary. Just for completeness.
-      ('user_profile', 'UserProfile/', 'User profiles (i.e. user data, not their homepage) are stored in this namespace.'),
-      ('user_homepage', 'User/', 'All user homepages are stored below this namespace.'),
+        ('content', '/', "All content is by default stored below /, hence the prefix is ''."),  # Not really necessary. Just for completeness.
+        ('user_profile', 'UserProfile/', 'User profiles (i.e. user data, not their homepage) are stored in this namespace.'),
+        ('user_homepage', 'User/', 'All user homepages are stored below this namespace.'),
     )),
 
     'user': ('User', None, (
-      ('email_unique', True,
-       "if True, check email addresses for uniqueness and don't accept duplicates."),
-      ('email_verification', False,
-       "if True, require a new user to verify his or her email address before the first login."),
+        ('email_unique', True,
+         "if True, check email addresses for uniqueness and don't accept duplicates."),
+        ('email_verification', False,
+         "if True, require a new user to verify his or her email address before the first login."),
 
-      ('homewiki', u'Self',
-       "interwiki name of the wiki where the user home pages are located [Unicode] - useful if you have ''many'' users. You could even link to nonwiki \"user pages\" if the wiki username is in the target URL."),
-      ('use_gravatar', False, "if True, gravatar.com will be used to find User's avatar")
+        ('homewiki', u'Self',
+         "interwiki name of the wiki where the user home pages are located [Unicode] - useful if you have ''many'' users. You could even link to nonwiki \"user pages\" if the wiki username is in the target URL."),
+        ('use_gravatar', False, "if True, gravatar.com will be used to find User's avatar")
     )),
 
-    'mail': ('Mail',
-        'These settings control outgoing and incoming email from and to the wiki.',
-    (
-      ('from', None, "Used as From: address for generated mail. [Unicode]"),
-      ('username', None, "Username for SMTP server authentication (None = don't use auth)."),
-      ('password', None, "Password for SMTP server authentication (None = don't use auth)."),
-      ('smarthost', None, "Address of SMTP server to use for sending mail (None = don't use SMTP server)."),
-      ('sendmail', None, "sendmail command to use for sending mail (None = don't use sendmail)"),
+    'mail': ('Mail', 'These settings control outgoing and incoming email from and to the wiki.', (
+        ('from', None, "Used as From: address for generated mail. [Unicode]"),
+        ('username', None, "Username for SMTP server authentication (None = don't use auth)."),
+        ('password', None, "Password for SMTP server authentication (None = don't use auth)."),
+        ('smarthost', None, "Address of SMTP server to use for sending mail (None = don't use SMTP server)."),
+        ('sendmail', None, "sendmail command to use for sending mail (None = don't use sendmail)"),
     )),
 }
 
--- a/MoinMoin/conftest.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/conftest.py	Sun Mar 03 07:44:25 2013 -0700
@@ -19,10 +19,11 @@
 from __future__ import absolute_import, division
 
 # exclude some directories from py.test test discovery, pathes relative to this file
-collect_ignore = ['static',  # same
-                  '../wiki',  # no tests there
-                  '../instance',  # tw likes to use this for wiki data (non-revisioned)
-                 ]
+collect_ignore = [
+    'static',  # same
+    '../wiki',  # no tests there
+    '../instance',  # tw likes to use this for wiki data (non-revisioned)
+]
 import atexit
 import os
 import sys
--- a/MoinMoin/constants/contenttypes.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/constants/contenttypes.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,9 +11,11 @@
 CHARSET = 'utf-8'
 
 # Parser to use mimetype text
-PARSER_TEXT_MIMETYPE = ('plain', 'csv', 'rst', 'docbook', 'latex', 'tex', 'html', 'css',
-                       'xml', 'python', 'perl', 'php', 'ruby', 'javascript',
-                       'cplusplus', 'java', 'pascal', 'diff', 'gettext', 'xslt', 'creole', )
+PARSER_TEXT_MIMETYPE = [
+    'plain', 'csv', 'rst', 'docbook', 'latex', 'tex', 'html', 'css',
+    'xml', 'python', 'perl', 'php', 'ruby', 'javascript',
+    'cplusplus', 'java', 'pascal', 'diff', 'gettext', 'xslt', 'creole',
+]
 
 CONTENTTYPE_USER = u'application/x.moin.userprofile'
 CONTENTTYPE_DEFAULT = u'application/octet-stream'
--- a/MoinMoin/constants/keys.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/constants/keys.py	Sun Mar 03 07:44:25 2013 -0700
@@ -20,11 +20,6 @@
 # some metadata key constants:
 ACL = "acl"
 
-# This says: I am a system item
-IS_SYSITEM = "is_syspage"
-# This says: original sysitem as contained in release: <release>
-SYSITEM_VERSION = "syspage_version"
-
 # keys for storing group and dict information
 # group of user names, e.g. for ACLs:
 USERGROUP = "usergroup"
--- a/MoinMoin/constants/misc.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/constants/misc.py	Sun Mar 03 07:44:25 2013 -0700
@@ -23,7 +23,7 @@
     \u202E   # RLM
     """,
     re.UNICODE | re.VERBOSE
-    )
+)
 
 CLEAN_INPUT_TRANSLATION_MAP = {
     # these chars will be replaced by blanks
@@ -31,18 +31,18 @@
     ord(u'\r'): u' ',
     ord(u'\n'): u' ',
 }
-for c in u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f' \
-          '\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f':
+for c in u'\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0b\x0c\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f':
     # these chars will be removed
     CLEAN_INPUT_TRANSLATION_MAP[ord(c)] = None
 del c
 
 # Other stuff
-URI_SCHEMES = ['http', 'https', 'ftp', 'file',
-               'mailto', 'nntp', 'news',
-               'ssh', 'telnet', 'irc', 'ircs', 'xmpp', 'mumble',
-               'webcal', 'ed2k', 'apt', 'rootz',
-               'gopher',
-               'notes',
-               'rtp', 'rtsp', 'rtcp',
-              ]
+URI_SCHEMES = [
+    'http', 'https', 'ftp', 'file',
+    'mailto', 'nntp', 'news',
+    'ssh', 'telnet', 'irc', 'ircs', 'xmpp', 'mumble',
+    'webcal', 'ed2k', 'apt', 'rootz',
+    'gopher',
+    'notes',
+    'rtp', 'rtsp', 'rtcp',
+]
--- a/MoinMoin/converter/_args.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_args.py	Sun Mar 03 07:44:25 2013 -0700
@@ -37,8 +37,7 @@
         return len(self.positional) + len(self.keyword)
 
     def __repr__(self):
-        return '<{0}({1!r}, {2!r})>'.format(self.__class__.__name__,
-                self.positional, self.keyword)
+        return '<{0}({1!r}, {2!r})>'.format(self.__class__.__name__, self.positional, self.keyword)
 
     def items(self):
         """
--- a/MoinMoin/converter/_tests/test__args.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test__args.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,6 +10,7 @@
 
 from MoinMoin.converter._args import *
 
+
 def test_Arguments___init__():
     positional = []
     keyword = {}
@@ -21,6 +22,7 @@
     assert keyword == a.keyword
     assert keyword is not a.keyword
 
+
 def test_Arguments___contains__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
@@ -32,6 +34,7 @@
     assert 'both' in a
     assert 'none' not in a
 
+
 def test_Arguments___getitem__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
@@ -47,6 +50,7 @@
     pytest.raises(IndexError, a.__getitem__, 2)
     pytest.raises(KeyError, a.__getitem__, 'none')
 
+
 def test_Arguments___len__():
     positional = ['positional', 'both']
     keyword = {'keyword': None, 'both': None}
@@ -55,6 +59,7 @@
 
     assert len(a) == 4
 
+
 def test_Arguments_items():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}
@@ -69,6 +74,7 @@
     assert ('keyword', True) in l
     assert ('both', False) in l
 
+
 def test_Arguments_keys():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}
@@ -81,6 +87,7 @@
     assert 'keyword' in l
     assert 'both' in l
 
+
 def test_Arguments_values():
     positional = ['positional', 'both']
     keyword = {'keyword': True, 'both': False}
--- a/MoinMoin/converter/_tests/test__args_wiki.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test__args_wiki.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,27 +8,30 @@
 
 from MoinMoin.converter._args_wiki import *
 
+
 def test():
     yield (do,
-        ur'both positional both=foo keyword=bar',
-        [u'both', u'positional'],
-        {u'both': u'foo', u'keyword': u'bar'})
+           ur'both positional both=foo keyword=bar',
+           [u'both', u'positional'],
+           {u'both': u'foo', u'keyword': u'bar'})
 
     yield (do,
-        ur'a-b a_b a-c=foo a_c=bar',
-        [u'a-b', u'a_b'],
-        {u'a-c': u'foo', u'a_c': u'bar'})
+           ur'a-b a_b a-c=foo a_c=bar',
+           [u'a-b', u'a_b'],
+           {u'a-c': u'foo', u'a_c': u'bar'})
 
     yield (do,
-        ur'''"a b\tc\nd" k="a b\tc\nd"''',
-        [u'a b\tc\nd'],
-        {u'k': u'a b\tc\nd'})
+           ur'''"a b\tc\nd" k="a b\tc\nd"''',
+           [u'a b\tc\nd'],
+           {u'k': u'a b\tc\nd'})
+
 
 def test_parse():
     a = parse(ur''''a b\tc\nd',k="a b\tc\nd"''')
     assert a.positional == [u'a b\tc\nd']
     assert a.keyword == {u'k': u'a b\tc\nd'}
 
+
 def do(wiki, positional, keyword):
     a = parse(wiki)
     assert a.positional == positional
--- a/MoinMoin/converter/_tests/test_creole_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_creole_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -221,15 +221,15 @@
                 '<page><body><p><code>nowiki</code> <code>nowiki</code></p></body></page>'),
             # XXX: Is <page> correct?
             (u'{{{\n#!\nwiki\n}}}',
-               '<page><body><page><body><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body><p>wiki</p></body></page></body></page>'),
             (u'{{{\n#!(style="background-color: red")\nwiki\n}}}',
-               '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
             (u'{{{\n#!creole\nwiki\n}}}',
-               '<page><body><page><body><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body><p>wiki</p></body></page></body></page>'),
             (u'{{{\n#!creole(style="background-color: red")\nwiki\n}}}',
-               '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
             (u'{{{\n#!text/plain\ntext\n}}}',
-               u'<page><body><part content-type="text/plain"><body>text</body></part></body></page>'),
+                u'<page><body><part content-type="text/plain"><body>text</body></part></body></page>'),
         ]
         for i in data:
             yield (self.do, ) + i
--- a/MoinMoin/converter/_tests/test_docbook_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_docbook_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -12,10 +12,7 @@
 
 import pytest
 
-try:
-    from lxml import etree
-except:
-    pytest.skip("lxml module required to run test for docbook_in converter.")
+etree = pytest.importorskip('lxml.etree')
 
 from emeraldtree.tree import *
 
@@ -24,6 +21,7 @@
 
 from MoinMoin.converter.docbook_in import *
 
+
 class Base(object):
     input_namespaces = ns_all = u'xmlns="{0}" xmlns:xlink="{1}"'.format(docbook.namespace, xlink.namespace)
     output_namespaces = {
@@ -66,6 +64,7 @@
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath_query, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()
@@ -73,37 +72,37 @@
     def test_base(self):
         data = [
             ('<article><para>Test</para></article>',
-              # <page><body><div html:class="db-article"><p>Test</p></div></body></page>
-             '/page/body/div[@html:class="db-article"][p="Test"]'),
+                # <page><body><div html:class="db-article"><p>Test</p></div></body></page>
+                '/page/body/div[@html:class="db-article"][p="Test"]'),
             ('<article><simpara>Test</simpara></article>',
-            # <page><body><div html:class="article"><p>Test</p></div></body></page>
-             '/page/body/div[p="Test"]'),
+                # <page><body><div html:class="article"><p>Test</p></div></body></page>
+                '/page/body/div[p="Test"]'),
             ('<article><formalpara><title>Title</title><para>Test</para></formalpara></article>',
-            # <page><body><div html:class="article"><p html:title="Title">Test</p></div></body></page>
-            '/page/body/div/p[text()="Test"][@html:title="Title"]'),
+                # <page><body><div html:class="article"><p html:title="Title">Test</p></div></body></page>
+                '/page/body/div/p[text()="Test"][@html:title="Title"]'),
             ('<article><sect1><title>Heading 1</title> <para>First Paragraph</para></sect1></article>',
-            # <page><body><div html:class="article"><h outline-level="1">Heading 1</h><p>First Paragraph</p></div></body></page>
-             '/page/body/div[./h[@outline-level="1"][text()="Heading 1"]][./p[text()="First Paragraph"]]'),
+                # <page><body><div html:class="article"><h outline-level="1">Heading 1</h><p>First Paragraph</p></div></body></page>
+                '/page/body/div[./h[@outline-level="1"][text()="Heading 1"]][./p[text()="First Paragraph"]]'),
             # Test for conversion with unicode char
             (u'<article><para>안녕 유빈</para></article>',
-            # <page><body><div html:class="article"><p>안녕 유빈</p></div></body></page>
-             u'/page/body/div[p="안녕 유빈"]'),
+                # <page><body><div html:class="article"><p>안녕 유빈</p></div></body></page>
+                u'/page/body/div[p="안녕 유빈"]'),
             # Ignored tags
             ('<article><info><title>Title</title><author>Author</author></info><para>text</para></article>',
-            # <page><body><div html:class="article"><p>text</p></div></body></page>
-            '/page/body/div[p="text"]'),
+                # <page><body><div html:class="article"><p>text</p></div></body></page>
+                '/page/body/div[p="text"]'),
             # XML attributes: We support all the xml standard attributes
             ('<article><para xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</para></article>',
-            # <page><body><div html:class="article"><p xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></div></body></page>
-            '/page/body/div/p[@xml:base="http://base.tld"][@xml:id="id"][@xml:lang="en"][text()="Text"]'),
+                # <page><body><div html:class="article"><p xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></div></body></page>
+                '/page/body/div/p[@xml:base="http://base.tld"][@xml:id="id"][@xml:lang="en"][text()="Text"]'),
             # ANCHOR --> SPAN
             ('<article><para>bla bla<anchor xml:id="point_1" />bla bla</para></article>',
-            # <page><body><div html:class="article"><p>bla bla<span class="db-anchor" xml:id="point_1" />bla bla</p></div></body></page>
-            '/page/body/div/p/span[@html:class="db-anchor"][@xml:id="point_1"]'),
+                # <page><body><div html:class="article"><p>bla bla<span class="db-anchor" xml:id="point_1" />bla bla</p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-anchor"][@xml:id="point_1"]'),
             # BOOK Document
             ('<book><para>Test</para></book>',
-            # <page><body><div html:class="db-book"><p>Test</p></div></body></page>
-            '/page/body/div[@html:class="db-book"][p="Test"]'),
+                # <page><body><div html:class="db-book"><p>Test</p></div></body></page>
+                '/page/body/div[@html:class="db-book"][p="Test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -112,15 +111,15 @@
         data = [
             # Test simple numbered section conversion into headings.
             ('<article><sect1><title>Heading 1</title> <para>First</para><sect2><title>Heading 2</title><para>Second</para></sect2></sect1></article>',
-            # <page><body><table-of-content><div html:class="article"><h outline-level="1">Heading 1</h><p>First</p><h outline-level="2">Heading 2</h><p>Second</p></div></body></page>
-             '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2"]][p[2][text()="Second"]]'),
+                # <page><body><table-of-content><div html:class="article"><h outline-level="1">Heading 1</h><p>First</p><h outline-level="2">Heading 2</h><p>Second</p></div></body></page>
+                '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2"]][p[2][text()="Second"]]'),
             ('<article><section><title>Heading 1</title> <para>First</para><section><title>Heading 2</title><para>Second</para></section></section></article>',
-            # <page><body><table-of-content><div html:class="article"><h outline-level="1">Heading 1</h><p>First</p><h outline-level="2">Heading 2</h><p>Second</p></div></body></page>
-             '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2"]][p[2][text()="Second"]]'),
+                # <page><body><table-of-content><div html:class="article"><h outline-level="1">Heading 1</h><p>First</p><h outline-level="2">Heading 2</h><p>Second</p></div></body></page>
+                '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2"]][p[2][text()="Second"]]'),
             # Test complex recursive section conversion into headings.
             ('<article><section><title>Heading 1 A</title><para>First</para><section><title>Heading 2 A</title><para>Second</para><section><title>Heading 3 A</title><para>Third</para></section></section></section><section><title>Heading 1 B</title><para>Fourth</para></section></article>',
-            # <page><body><table-of-content /><div html:class="article"><h outline-level="1">Heading 1 A</h><p>First</p><h outline-level="2">Heading 2 A</h><p>Second</p><h outline-level="3">Heading 3 A</h><p>Third</p><h outline-level="1">Heading 1 B</h><p>Fourth</p></div></body></page>
-             '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1 A"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2 A"]][p[2][text()="Second"]][h[3][@outline-level="3"][text()="Heading 3 A"]][p[3][text()="Third"]][h[4][@outline-level="1"][text()="Heading 1 B"]][p[4][text()="Fourth"]]'),
+                # <page><body><table-of-content /><div html:class="article"><h outline-level="1">Heading 1 A</h><p>First</p><h outline-level="2">Heading 2 A</h><p>Second</p><h outline-level="3">Heading 3 A</h><p>Third</p><h outline-level="1">Heading 1 B</h><p>Fourth</p></div></body></page>
+                '/page/body[table-of-content]/div[h[1][@outline-level="1"][text()="Heading 1 A"]][p[1][text()="First"]][h[2][@outline-level="2"][text()="Heading 2 A"]][p[2][text()="Second"]][h[3][@outline-level="3"][text()="Heading 3 A"]][p[3][text()="Third"]][h[4][@outline-level="1"][text()="Heading 1 B"]][p[4][text()="Fourth"]]'),
         ]
 
         for i in data:
@@ -130,64 +129,63 @@
         data = [
             # ITEMIZED LIST --> unordered list
             ('<article><itemizedlist><listitem>Unordered Item 1</listitem><listitem>Unordered Item 2</listitem></itemizedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generate="unordered"><list-item><list-item-body>Unordered Item 1</list-item-body></list-item><list-item><list-item-body>Unordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Unordered Item 1"]][list-item[2]/list-item-body[text()="Unordered Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="unordered"><list-item><list-item-body>Unordered Item 1</list-item-body></list-item><list-item><list-item-body>Unordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Unordered Item 1"]][list-item[2]/list-item-body[text()="Unordered Item 2"]]'),
             # ORDERED LIST --> ordered list
             ('<article><orderedlist><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with upperalpha numeration --> ordered list with upper-alpha list-style-type
             ('<article><orderedlist numeration="upperalpha"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-
             # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="upper-alpha"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="upper-alpha"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
+                '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="upper-alpha"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with loweralpha numeration --> ordered list with lower-alpha list-style-type
             ('<article><orderedlist numeration="loweralpha"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="lower-alpha"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="lower-alpha"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="lower-alpha"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="lower-alpha"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with upperroman numeration --> ordered list with upper-roman list-style-type
             ('<article><orderedlist numeration="upperroman"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="upper-roman"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="upper-roman"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="upper-roman"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="upper-roman"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # ORDERED LIST with lowerroman numeration --> ordered list with lower-roman list-style-type
             ('<article><orderedlist numeration="lowerroman"><listitem>Ordered Item 1</listitem><listitem>Ordered Item 2</listitem></orderedlist></article>',
-            # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="lower-roman"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="lower-roman"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generage="ordered" list-style-type="lower-roman"><list-item><list-item-body>Ordered Item 1</list-item-body></list-item><list-item><list-item-body>Ordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][@list-style-type="lower-roman"][list-item[1]/list-item-body[text()="Ordered Item 1"]][list-item[2]/list-item-body[text()="Ordered Item 2"]]'),
             # VARIABLE LIST --> list
             ('<article><variablelist><varlistentry><term>Term 1</term><listitem>Definition 1</listitem></varlistentry><varlistentry><term>Term 2</term><listitem>Definition 2</listitem></varlistentry></variablelist></article>',
-            # <page><body><div html:class="article"><list><list-item><list-item-label>Termm 1</list-item-label><list-item-body>Definition 1</list-item-body></list-item><list-item><list-item-label>Term 2</list-item-label><list-item-body>Definition 2</list-item-body></list-item></list></div></body></page>
-            '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body="Definition 1"]][list-item[2][list-item-label="Term 2"][list-item-body="Definition 2"]]'),
+                # <page><body><div html:class="article"><list><list-item><list-item-label>Termm 1</list-item-label><list-item-body>Definition 1</list-item-body></list-item><list-item><list-item-label>Term 2</list-item-label><list-item-body>Definition 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body="Definition 1"]][list-item[2][list-item-label="Term 2"][list-item-body="Definition 2"]]'),
             # PROCEDURE --> ordered list (with arabic numeration)
             ('<article><procedure><step>First Step</step><step>Second Step</step></procedure></article>',
-            # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body>Second Step</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list-item[2]/list-item-body[text()="Second Step"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body>Second Step</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list-item[2]/list-item-body[text()="Second Step"]]'),
             # PROCEDURE --> ordered list (with arabic numeration) (with stepalternative)
             ('<article><procedure><step>First Step</step><stepalternatives>Second Step</stepalternatives></procedure></article>',
-            # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body>Second Step</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list-item[2]/list-item-body[text()="Second Step"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body>Second Step</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list-item[2]/list-item-body[text()="Second Step"]]'),
             # PROCEDURE with SUBSTEPS
             ('<article><procedure><step>First Step</step><substeps><step>Second Step</step></substeps></procedure></article>',
-            # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body><list item-label-generate="ordered">Second Step</list-item-body></list-item></list></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list[@item-label-generate="ordered"]/list-item/list-item-body[text()="Second Step"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body>First Step</list-item-body></list-item><list-item><list-item-body><list item-label-generate="ordered">Second Step</list-item-body></list-item></list></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[text()="First Step"]][list[@item-label-generate="ordered"]/list-item/list-item-body[text()="Second Step"]]'),
             # GLOSS LIST --> Definition list
             ('<article><glosslist><glossentry><glossterm>Term 1</glossterm><glossdef><para>Definition 1</para></glossdef></glossentry><glossentry><glossterm>Term 2</glossterm><glossdef><para>Definition 2</para></glossdef></glossentry></glosslist></article>',
-            # <page><body><div html:class="article"><list><list-item><list-item-label>Termm 1</list-item-label><list-item-body>Definition 1</list-item-body></list-item><list-item><list-item-label>Term 2</list-item-label><list-item-body>Definition 2</list-item-body></list-item></list></div></body></page>
-            '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body[p="Definition 1"]]][list-item[2][list-item-label="Term 2"][list-item-body[p="Definition 2"]]]'),
+                # <page><body><div html:class="article"><list><list-item><list-item-label>Termm 1</list-item-label><list-item-body>Definition 1</list-item-body></list-item><list-item><list-item-label>Term 2</list-item-label><list-item-body>Definition 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body[p="Definition 1"]]][list-item[2][list-item-label="Term 2"][list-item-body[p="Definition 2"]]]'),
             # SEGMENTED LIST --> Definition List
             ('<article><segmentedlist><segtitle>Term 1</segtitle><segtitle>Term 2</segtitle><segtitle>Term 3</segtitle><seglistitem><seg>Def 1:1</seg><seg>Def 1:2</seg><seg>Def 1:3</seg></seglistitem><seglistitem><seg>Def 2:1</seg><seg>Def 2:2</seg><seg>Def 2:3</seg></seglistitem></segmentedlist></article>',
-              '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body="Def 1:1"]][list-item[2][list-item-label="Term 2"][list-item-body="Def 1:2"]][list-item[3][list-item-label="Term 3"][list-item-body="Def 1:3"]][list-item[4][list-item-label="Term 1"][list-item-body="Def 2:1"]][list-item[5][list-item-label="Term 2"][list-item-body="Def 2:2"]][list-item[6][list-item-label="Term 3"][list-item-body="Def 2:3"]]'),
+                '/page/body/div/list[list-item[1][list-item-label="Term 1"][list-item-body="Def 1:1"]][list-item[2][list-item-label="Term 2"][list-item-body="Def 1:2"]][list-item[3][list-item-label="Term 3"][list-item-body="Def 1:3"]][list-item[4][list-item-label="Term 1"][list-item-body="Def 2:1"]][list-item[5][list-item-label="Term 2"][list-item-body="Def 2:2"]][list-item[6][list-item-label="Term 3"][list-item-body="Def 2:3"]]'),
             # SIMPLE LIST --> unordered list
             ('<article><simplelist><member>Item 1</member><member>Item 2</member></simplelist></article>',
-            # <page><body><div html:class="article"><list item-label-generate="unordered"><list-item><list-item-body>Unordered Item 1</list-item-body></list-item><list-item><list-item-body>Unordered Item 2</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]]'),
+                # <page><body><div html:class="article"><list item-label-generate="unordered"><list-item><list-item-body>Unordered Item 1</list-item-body></list-item><list-item><list-item-body>Unordered Item 2</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]]'),
             # Q and A set with defaultlabel = number --> ordered list
             ("<article><qandaset defaultlabel='number'><qandaentry><question><para>Question 1</para></question><answer><para>Answer 1</para></answer></qandaentry><qandaentry><question><para>Question 2</para></question><answer><para>Answer 2</para></answer></qandaentry></qandaset></article> ",
-            # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body><p>Question1</p><p>Answer 1</p></list-item-body></list-item><list-item><list-item-body><p>Question 2</p><p>Answer 2</p></list-item-body></list-item></div></body></page>
-             '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[p[1][text()="Question 1"]][p[2][text()="Answer 1"]]][list-item[2]/list-item-body[p[1][text()="Question 2"]][p[2][text()="Answer 2"]]]'),
+                # <page><body><div html:class="article"><list item-label-generate="ordered"><list-item><list-item-body><p>Question1</p><p>Answer 1</p></list-item-body></list-item><list-item><list-item-body><p>Question 2</p><p>Answer 2</p></list-item-body></list-item></div></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"][list-item[1]/list-item-body[p[1][text()="Question 1"]][p[2][text()="Answer 1"]]][list-item[2]/list-item-body[p[1][text()="Question 2"]][p[2][text()="Answer 2"]]]'),
             # Q and A set with defaultlabel = qanda --> definition list, with Q: and A: for the label
             ("<article><qandaset defaultlabel='qanda'><qandaentry><question><para>Question 1</para></question><answer><para>Answer 1</para></answer></qandaentry><qandaentry><question><para>Question 2</para></question><answer><para>Answer 2</para></answer></qandaentry></qandaset></article> ",
-            # <page><body><div html:class="article"><list><list-item><list-item-label>Q: </list-item-label><list-item-body>Question 1</list-item-body></list-item><list-item><list-item-label>A: </list-item-label><list-item-body>Answer 1</list-item-body></list-item><list-item><list-item-label>Q: </list-item-label><list-item-body>Question 2</list-item-body></list-item><list-item><list-item-label>A: </list-item-label><list-item-body>Answer 2</list-item-body></list-item>
-              '/page/body/div/list[list-item[1][list-item-label="Q:"][list-item-body="Question 1"]][list-item[2][list-item-label="A:"][list-item-body="Answer 1"]][list-item[3][list-item-label="Q:"][list-item-body="Question 2"]][list-item[4][list-item-label="A:"][list-item-body="Answer 2"]]'),
+                # <page><body><div html:class="article"><list><list-item><list-item-label>Q: </list-item-label><list-item-body>Question 1</list-item-body></list-item><list-item><list-item-label>A: </list-item-label><list-item-body>Answer 1</list-item-body></list-item><list-item><list-item-label>Q: </list-item-label><list-item-body>Question 2</list-item-body></list-item><list-item><list-item-label>A: </list-item-label><list-item-body>Answer 2</list-item-body></list-item>
+                '/page/body/div/list[list-item[1][list-item-label="Q:"][list-item-body="Question 1"]][list-item[2][list-item-label="A:"][list-item-body="Answer 1"]][list-item[3][list-item-label="Q:"][list-item-body="Question 2"]][list-item[4][list-item-label="A:"][list-item-body="Answer 2"]]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -195,22 +193,22 @@
     def test_table(self):
         data = [
             ('<article><table><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table></article>',
-            # <page><body><div html:class="article"><table><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-row></table-cell></table></div></body></page>
-             '/page/body/div/table[./table-header/table-row[table-cell="Header"]][./table-footer/table-row[table-cell="Footer"]][./table-body/table-row[table-cell="Cell"]]'),
+                # <page><body><div html:class="article"><table><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-row></table-cell></table></div></body></page>
+                '/page/body/div/table[./table-header/table-row[table-cell="Header"]][./table-footer/table-row[table-cell="Footer"]][./table-body/table-row[table-cell="Cell"]]'),
             ('<article><table><tbody><tr><td colspan="2">Cell</td></tr></tbody></table></article>',
-            # <page><body><div html:class="article"><table><table-body><table-row><table-cell number-columns-spanned="2">Cell</table-cell></table-row></table-body></table></div></body></page>
-             '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-columns-spanned="2"]'),
+                # <page><body><div html:class="article"><table><table-body><table-row><table-cell number-columns-spanned="2">Cell</table-cell></table-row></table-body></table></div></body></page>
+                '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-columns-spanned="2"]'),
             ('<article><table><tbody><tr><td rowspan="2">Cell</td></tr></tbody></table></article>',
-            # <page><body><div html:class="article"><table><table-body><table-row><table-cell number-rows-spanned="2">Cell</table-cell></table-row></table-body></table></div></body></page>
-             '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-rows-spanned="2"]'),
+                # <page><body><div html:class="article"><table><table-body><table-row><table-cell number-rows-spanned="2">Cell</table-cell></table-row></table-body></table></div></body></page>
+                '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-rows-spanned="2"]'),
             # Simple db.cals.table
             ('<article><table xml:id="ex.calstable"><tgroup cols="2"><thead><row><entry>a1</entry><entry>a2</entry></row></thead><tfoot><row><entry>f1</entry><entry>f2</entry></row></tfoot><tbody><row><entry>b1</entry><entry>b2</entry></row></tbody></tgroup></table></article>',
-            # <page><body><div html:class="article"><table><table-header><table-row><table-cell>a1</table-cell><table-cell>a2</table-cell></table-row></table-header><table-footer><table-row><table-cell>f1</table-cell><table-cell>f2</table-cell></table-row></table-footer><table-body><table-row><table-cell>b1</table-row><table-cell>b2</table-row></table-cell></table></div></body></page>
-             '/page/body/div/table[./table-header/table-row[table-cell="a1"][table-cell="a2"]][./table-footer/table-row[table-cell="f1"][table-cell="f2"]][./table-body/table-row[table-cell="b1"][table-cell="b2"]]'),
+                # <page><body><div html:class="article"><table><table-header><table-row><table-cell>a1</table-cell><table-cell>a2</table-cell></table-row></table-header><table-footer><table-row><table-cell>f1</table-cell><table-cell>f2</table-cell></table-row></table-footer><table-body><table-row><table-cell>b1</table-row><table-cell>b2</table-row></table-cell></table></div></body></page>
+                '/page/body/div/table[./table-header/table-row[table-cell="a1"][table-cell="a2"]][./table-footer/table-row[table-cell="f1"][table-cell="f2"]][./table-body/table-row[table-cell="b1"][table-cell="b2"]]'),
             # db.cals.table with entry table.
             ('<article><table xml:id="ex.calstable"><tgroup cols="1"><thead><row><entry>a1</entry></row></thead><tfoot><row><entry>f1</entry></row></tfoot><tbody><row><entrytbl cols="1"><tbody><row><entry>s1</entry></row></tbody></entrytbl></row></tbody></tgroup></table></article>',
-            # <page><body><div html:class="article"><table><table-header><table-row><table-cell>a1</table-cell></table-row></table-header><table-footer><table-row><table-cell>f1</table-cell></table-row></table-footer><table-body><table-row><table-cell><table><table-body><table-row><table-cell>s1</table-cell></table-row></table-body></table></table-row></table-cell></table></div></body></page>
-             '/page/body/div/table[./table-header/table-row[table-cell="a1"]][./table-footer/table-row[table-cell="f1"]][./table-body/table-row[table-cell/table/table-body/table-row[table-cell="s1"]]]'),
+                # <page><body><div html:class="article"><table><table-header><table-row><table-cell>a1</table-cell></table-row></table-header><table-footer><table-row><table-cell>f1</table-cell></table-row></table-footer><table-body><table-row><table-cell><table><table-body><table-row><table-cell>s1</table-cell></table-row></table-body></table></table-row></table-cell></table></div></body></page>
+                '/page/body/div/table[./table-header/table-row[table-cell="a1"]][./table-footer/table-row[table-cell="f1"]][./table-body/table-row[table-cell/table/table-body/table-row[table-cell="s1"]]]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -218,39 +216,39 @@
     def test_misc(self):
         data = [
             ('<article><para>Text Para<footnote><para>Text Footnote</para></footnote></para></article>',
-            # <page><body><div html:class="article"><p>Text Para<note note-class="footnote"><note-body><p>Text Footnote</p></note-body></note></p></div></body></page>
-             '/page/body/div/p[text()="Text Para"]/note[@note-class="footnote"]/note-body/p[text()="Text Footnote"]'),
+                # <page><body><div html:class="article"><p>Text Para<note note-class="footnote"><note-body><p>Text Footnote</p></note-body></note></p></div></body></page>
+                '/page/body/div/p[text()="Text Para"]/note[@note-class="footnote"]/note-body/p[text()="Text Footnote"]'),
             ('<article><para><quote>text</quote></para></article>',
-            # <page><body><div html:class="article"><p><quote>text</quote></para></article>
-            '/page/body/div/p[quote="text"]'),
+                # <page><body><div html:class="article"><p><quote>text</quote></para></article>
+                '/page/body/div/p[quote="text"]'),
             # Test span for inline element
             ('<article><para><abbrev>ABBREV</abbrev></para></article>',
-            # <page><body><div html:class="article"><p><span class="db-abbrev">ABBREV</span></p></div></body></page>
-             '/page/body/div/p/span[@html:class="db-abbrev"][text()="ABBREV"]'),
+                # <page><body><div html:class="article"><p><span class="db-abbrev">ABBREV</span></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-abbrev"][text()="ABBREV"]'),
             # Test div for block element
             ('<article><acknowledgements><para>Text</para></acknowledgements></article>',
-            # <page><body><div html:class="article"><div html:class="db-acknowledgements"><p>Text</p></div></div></body></page>
-            '/page/body/div/div[@html:class="db-acknowledgements"][p="Text"]'),
+                # <page><body><div html:class="article"><div html:class="db-acknowledgements"><p>Text</p></div></div></body></page>
+                '/page/body/div/div[@html:class="db-acknowledgements"][p="Text"]'),
             # Test for <informalequation>
             ('<article><informalequation><para>E = mc^2</para></informalequation></article>',
-            # <page><body><div html:class="article"><div html:class="db-equation"><p>E = mc^2</p></div></div></body></page>
-             '/page/body/div/div[@html:class="db-equation"][p="E = mc^2"]'),
+                # <page><body><div html:class="article"><div html:class="db-equation"><p>E = mc^2</p></div></div></body></page>
+                '/page/body/div/div[@html:class="db-equation"][p="E = mc^2"]'),
             # Test for <informalexample>
             ('<article><informalexample><para>example</para></informalexample></article>',
-            # <page><body><div html:class="article"><div html:class="db-example"><p>example</p></div></div></body></page>
-             '/page/body/div/div[@html:class="db-example"][p="example"]'),
+                # <page><body><div html:class="article"><div html:class="db-example"><p>example</p></div></div></body></page>
+                '/page/body/div/div[@html:class="db-example"][p="example"]'),
             # Test for <sbr />
             ('<article><cmdsynopsis><para>Line 1<sbr />Line 2</para></cmdsynopsis></article>',
-            # <page><body><div html:class="article"><div html:class="db-cmdsynopsis"><p>Line 1<line-break />Line 2</p></div></div></body></page>
-            '/page/body/div/div[@html:class="db-cmdsynopsis"]/p/line-break'),
+                # <page><body><div html:class="article"><div html:class="db-cmdsynopsis"><p>Line 1<line-break />Line 2</p></div></div></body></page>
+                '/page/body/div/div[@html:class="db-cmdsynopsis"]/p/line-break'),
             # Test for <tag> element with class and namespace attribute
             ('<article><para><tag class="attribute" namespace="namespace">TAG</tag></para></article>',
-            # <page><body><div html:class="article"><p><span class="db-tag-attribute">{namespace}TAG</span></p></div></article>
-            '/page/body/div/p/span[@html:class="db-tag-attribute"][text()="{namespace}TAG"]'),
+                # <page><body><div html:class="article"><p><span class="db-tag-attribute">{namespace}TAG</span></p></div></article>
+                '/page/body/div/p/span[@html:class="db-tag-attribute"][text()="{namespace}TAG"]'),
             # Test for <tag> element without class and namespace attribute
             ('<article><para><tag>TAG</tag></para></article>',
-            # <page><body><div html:class="article"><p><span class="db-tag">TAG</span></p></div></article>
-            '/page/body/div/p/span[@html:class="db-tag"][text()="TAG"]'),
+                # <page><body><div html:class="article"><p><span class="db-tag">TAG</span></p></div></article>
+                '/page/body/div/p/span[@html:class="db-tag"][text()="TAG"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -259,24 +257,24 @@
         data = [
             # Normal link, with conversion of all the xlink attributes
             ('<article><para><link xlink:href="uri:test" xlink:title="title">link</link></para></article>',
-            # <page><body><div html:class="article"><p><a xlink:href="uri:test" xlink:title="title">link</a></p></div></body></page>
-             '/page/body/div/p/a[@xlink:href="uri:test"][@xlink:title="title"][text()="link"]'),
+                # <page><body><div html:class="article"><p><a xlink:href="uri:test" xlink:title="title">link</a></p></div></body></page>
+                '/page/body/div/p/a[@xlink:href="uri:test"][@xlink:title="title"][text()="link"]'),
             # Old link from DocBook v.4.X for backward compatibility
             ('<article><para><ulink url="url:test">link</ulink></para></article>',
-            # <page><body><div html:class="article"><p><a xlink:href="url:test">link</a></p></div></body></page>
-             '/page/body/div/p/a[@xlink:href="url:test"][text()="link"]'),
+                # <page><body><div html:class="article"><p><a xlink:href="url:test">link</a></p></div></body></page>
+                '/page/body/div/p/a[@xlink:href="url:test"][text()="link"]'),
             # Normal link, with linkend attribute
             ('<article><para><link linkend="anchor">link</link></para></article>',
-            # <page><body><div html:class="article"><p><a xlink:href="#anchor">link</a></p></div></body></page>
-             '/page/body/div/p/a[@xlink:href="#anchor"][text()="link"]'),
+                # <page><body><div html:class="article"><p><a xlink:href="#anchor">link</a></p></div></body></page>
+                '/page/body/div/p/a[@xlink:href="#anchor"][text()="link"]'),
             # OLINK
             ('<article><para><olink targetdoc="uri" targetptr="anchor">link</olink></para></article>',
-            # <page><body><div html:class="article"><para><a xlink:href="uri#anchor">link</a></para></div></body></page>
-             '/page/body/div/p/a[@xlink:href="uri#anchor"][text()="link"]'),
+                # <page><body><div html:class="article"><para><a xlink:href="uri#anchor">link</a></para></div></body></page>
+                '/page/body/div/p/a[@xlink:href="uri#anchor"][text()="link"]'),
             # Link w/ javascript: scheme
             ('<article><para><ulink url="javascript:alert(\'xss\')">link</ulink></para></article>',
-            # <page><body><div html:class="article"><p><a xlink:href="url:test">link</a></p></div></body></page>
-             '/page/body/div/p/a[@xlink:href=""][text()="link"]'),
+                # <page><body><div html:class="article"><p><a xlink:href="url:test">link</a></p></div></body></page>
+                '/page/body/div/p/a[@xlink:href=""][text()="link"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -284,39 +282,39 @@
     def test_code(self):
         data = [
             ('<article><screen>Text</screen></article>',
-            # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
-             '/page/body/div[blockcode="Text"]'),
+                # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
+                '/page/body/div[blockcode="Text"]'),
             # Test for <screen> with CDATA
             ('<article><screen><![CDATA[Text]]></screen></article>',
-            # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
-             '/page/body/div[blockcode="Text"]'),
+                # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
+                '/page/body/div[blockcode="Text"]'),
             # PROGRAMLISTING --> BLOCKCODE
             ('<article><programlisting>Text</programlisting></article>',
-            # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
-             '/page/body/div[blockcode="Text"]'),
+                # <page><body><div html:class="article"><blockcode>Text</blockcode></div></body></page>
+                '/page/body/div[blockcode="Text"]'),
             # LITERAL --> CODE
             ('<article><para>text<literal>literal</literal></para></article>',
-            # <page><body><div html:class="article"><p>text<code>literal</code></p></div></body></page>
-             '/page/body/div/p[text()="text"][code="literal"]'),
+                # <page><body><div html:class="article"><p>text<code>literal</code></p></div></body></page>
+                '/page/body/div/p[text()="text"][code="literal"]'),
             ('<article><blockquote><attribution>author</attribution>text</blockquote></article>',
-            # <page><body><div html:class="article"><blockquote source="author">text</blockquote></div></body></page>
-            '/page/body/div/blockquote[@source="author"][text()="text"]'),
+                # <page><body><div html:class="article"><blockquote source="author">text</blockquote></div></body></page>
+                '/page/body/div/blockquote[@source="author"][text()="text"]'),
             # CODE --> CODE
             ('<article><para><code>Text</code></para></article>',
-            # <page><body><div html:class="article"><p><code>Text</code></p></article>
-            '/page/body/div/p[code="Text"]'),
+                # <page><body><div html:class="article"><p><code>Text</code></p></article>
+                '/page/body/div/p[code="Text"]'),
             # COMPUTEROUTPUT --> CODE
             ('<article><para><computeroutput>Text</computeroutput></para></article>',
-            # <page><body><div html:class="article"><p><code>Text</code></p></article>
-            '/page/body/div/p[code="Text"]'),
+                # <page><body><div html:class="article"><p><code>Text</code></p></article>
+                '/page/body/div/p[code="Text"]'),
             # MARKUP --> CODE
             ('<article><para><markup>Text</markup></para></article>',
-            # <page><body><div html:class="article"><p><code>Text</code></p></article>
-            '/page/body/div/p[code="Text"]'),
+                # <page><body><div html:class="article"><p><code>Text</code></p></article>
+                '/page/body/div/p[code="Text"]'),
             # LITERALLAYOUT --> BLOCKCODE
             ('<article><literallayout>Text</literallayout></article>',
-             # <page><body><div html:class="article"><blockcode html:class="db-literallayout">Text</blockcode></div></body></page>
-             '/page/body/div/blockcode[text()="Text"][@html:class="db-literallayout"]'),
+                # <page><body><div html:class="article"><blockcode html:class="db-literallayout">Text</blockcode></div></body></page>
+                '/page/body/div/blockcode[text()="Text"][@html:class="db-literallayout"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -325,20 +323,20 @@
         data = [
             # Test for image object
             ('<article><para><inlinemediaobject><imageobject><imagedata fileref="test.png"/></imageobject></inlinemediaobject></para></article>',
-            # <page><body><div html:class="article"><p><object xlink:href="test.png" type='image/' /></p></div></body></page>
-            '/page/body/div/p/span[@html:class="db-inlinemediaobject"]/object[@xlink:href="test.png"][@type="image/"]'),
+                # <page><body><div html:class="article"><p><object xlink:href="test.png" type='image/' /></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-inlinemediaobject"]/object[@xlink:href="test.png"][@type="image/"]'),
             # Test for audio object
             ('<article><para><inlinemediaobject><audioobject><audiodata fileref="test.wav"/></audioobject></inlinemediaobject></para></article>',
-            # <page><body><div html:class="article"><p><object xlink:href="test.wav" type='audio/' /></p></div></body></page>
-            '/page/body/div/p/span[@html:class="db-inlinemediaobject"]/object[@xlink:href="test.wav"][@type="audio/"]'),
+                # <page><body><div html:class="article"><p><object xlink:href="test.wav" type='audio/' /></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-inlinemediaobject"]/object[@xlink:href="test.wav"][@type="audio/"]'),
             # Test for video object
             ('<article><para><mediaobject><videoobject><videodata fileref="test.avi"/></videoobject></mediaobject></para></article>',
-            # <page><body><div html:class="article"><p><object xlink:href="test.avi" type='video/' /></p></div></body></page>
-             '/page/body/div/p/div[@html:class="db-mediaobject"]/object[@xlink:href="test.avi"][@type="video/"]'),
+                # <page><body><div html:class="article"><p><object xlink:href="test.avi" type='video/' /></p></div></body></page>
+                '/page/body/div/p/div[@html:class="db-mediaobject"]/object[@xlink:href="test.avi"][@type="video/"]'),
             # Test for image object with different imagedata
             ('<article><mediaobject><imageobject><imagedata fileref="figures/eiffeltower.eps" format="EPS"/></imageobject><imageobject><imagedata fileref="figures/eiffeltower.png" format="PNG"/></imageobject><textobject><phrase>The Eiffel Tower</phrase> </textobject><caption><para>Designed by Gustave Eiffel in 1889, The Eiffel Tower is one of the most widely recognized buildings in the world.</para>  </caption></mediaobject></article>',
-            # <page><body><div html:class="article"><div html:class="db-mediaobject"><object xlink:href="figures/eiffeltowe.png" /></div></div></body></page>
-            '/page/body/div/div[@html:class="db-mediaobject"]/object[@xlink:href="figures/eiffeltower.png"][@type="image/png"]'),
+                # <page><body><div html:class="article"><div html:class="db-mediaobject"><object xlink:href="figures/eiffeltowe.png" /></div></div></body></page>
+                '/page/body/div/div[@html:class="db-mediaobject"]/object[@xlink:href="figures/eiffeltower.png"][@type="image/png"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -347,24 +345,24 @@
         data = [
             # EMPHASIS --> EMPHASIS
             ('<article><para>text<emphasis>emphasis</emphasis></para></article>',
-            # <page><body><div html:class="article"><p>text<emphasis>emphasis</emphasis></p></div></body></page>
-             '/page/body/div/p[text()="text"][emphasis="emphasis"]'),
+                # <page><body><div html:class="article"><p>text<emphasis>emphasis</emphasis></p></div></body></page>
+                '/page/body/div/p[text()="text"][emphasis="emphasis"]'),
             # EMPHASIS role='strong' --> STRONG
             ('<article><para>text<emphasis role="strong">strong</emphasis></para></article>',
-            # <page><body><div html:class="article"><p>text<strong>strong</strong></p></div></body></page>
-             '/page/body/div/p[text()="text"][strong="strong"]'),
+                # <page><body><div html:class="article"><p>text<strong>strong</strong></p></div></body></page>
+                '/page/body/div/p[text()="text"][strong="strong"]'),
             # SUBSCRIPT --> SPAN baseline-shift = 'sub'
             ('<article><para><subscript>sub</subscript>script</para></article>',
-            # <page><body><div html:class="article"><p>script<span baseline-shift="sub">sub</span></p></div></body></page>
-             '/page/body/div/p[text()="script"]/span[@baseline-shift="sub"][text()="sub"]'),
+                # <page><body><div html:class="article"><p>script<span baseline-shift="sub">sub</span></p></div></body></page>
+                '/page/body/div/p[text()="script"]/span[@baseline-shift="sub"][text()="sub"]'),
             # SUPERSCRIPT --> SPAN baseline-shift = 'super'
             ('<article><para><superscript>super</superscript>script</para></article>',
-            # <page><body><div html:class="article"><p>script<span baseline-shift="super">super</span></p></div></body></page>
-             '/page/body/div/p[text()="script"]/span[@baseline-shift="super"][text()="super"]'),
+                # <page><body><div html:class="article"><p>script<span baseline-shift="super">super</span></p></div></body></page>
+                '/page/body/div/p[text()="script"]/span[@baseline-shift="super"][text()="super"]'),
             # PHRASE --> SPAN
             ('<article><para><phrase>text</phrase></para></article>',
-            # <page><body><div html:class="article"><p><span>text</span></p></div></body></page>
-             '/page/body/div/p[span="text"]'),
+                # <page><body><div html:class="article"><p><span>text</span></p></div></body></page>
+                '/page/body/div/p[span="text"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -373,24 +371,24 @@
         data = [
             # Test for caution admonition
             ('<article><caution><para>text</para></caution></article>',
-            # <page><body><div html:class="article"><admonition type='caution'><p>text<p></admonition></div></body></page>
-            '/page/body/div/admonition[@type="caution"][p="text"]'),
+                # <page><body><div html:class="article"><admonition type='caution'><p>text<p></admonition></div></body></page>
+                '/page/body/div/admonition[@type="caution"][p="text"]'),
             # Test for important admonition
             ('<article><important><para>text</para></important></article>',
-            # <page><body><div html:class="article"><admonition type='important'><p>text<p></admonition></div></body></page>
-            '/page/body/div/admonition[@type="important"][p="text"]'),
+                # <page><body><div html:class="article"><admonition type='important'><p>text<p></admonition></div></body></page>
+                '/page/body/div/admonition[@type="important"][p="text"]'),
             # Test for note admonition
             ('<article><note><para>text</para></note></article>',
-            # <page><body><div html:class="article"><admonition type='note'><p>text<p></admonition></div></body></page>
-            '/page/body/div/admonition[@type="note"][p="text"]'),
+                # <page><body><div html:class="article"><admonition type='note'><p>text<p></admonition></div></body></page>
+                '/page/body/div/admonition[@type="note"][p="text"]'),
             # Test for tip admonition
             ('<article><tip><para>text</para></tip></article>',
-            # <page><body><div html:class="article"><admonition type='tip'><p>text<p></admonition></div></body></page>
-            '/page/body/div/admonition[@type="tip"][p="text"]'),
+                # <page><body><div html:class="article"><admonition type='tip'><p>text<p></admonition></div></body></page>
+                '/page/body/div/admonition[@type="tip"][p="text"]'),
             # Test for warning admonition
             ('<article><warning><para>text</para></warning></article>',
-            # <page><body><div html:class="article"><admonition type='warning'><p>text<p></admonition></div></body></page>
-            '/page/body/div/admonition[@type="warning"][p="text"]'),
+                # <page><body><div html:class="article"><admonition type='warning'><p>text<p></admonition></div></body></page>
+                '/page/body/div/admonition[@type="warning"][p="text"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -398,14 +396,14 @@
     def test_trademark(self):
         data = [
             ('<article><para><trademark class="copyright">MoinMoin</trademark></para></article>',
-             # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin&copy;</span></p></div></body></page>
-             '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin&copy;"]'),
+                # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin&copy;</span></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin&copy;"]'),
             ('<article><para><trademark class="service">MoinMoin</trademark></para></article>',
-             # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin<span baseline-shift="super">SM</span></span></p></div></body></page>
-             '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin"]/span[@baseline-shift="super"][text()="SM"]'),
+                # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin<span baseline-shift="super">SM</span></span></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin"]/span[@baseline-shift="super"][text()="SM"]'),
             ('<article><para><trademark>MoinMoin</trademark></para></article>',
-             # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin</span></p></div></body></page>
-             '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin"]'),
+                # <page><body><div html:class="article"><p><span class="db-trademark">MoinMoin</span></p></div></body></page>
+                '/page/body/div/p/span[@html:class="db-trademark"][text()="MoinMoin"]'),
         ]
         for i in data:
             yield(self.do, ) + i
@@ -414,10 +412,10 @@
         data = [
             # Error: Xml not correctly formatted
             ('<article><para>Text</para>',
-             '/page/body/part/error'),
+                '/page/body/part/error'),
             # Error: Root Element is not correct
             ('<link xlink:href="uri">link</link>',
-             '/page/body/part/error'),
+                '/page/body/part/error'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -426,7 +424,7 @@
         data = [
             # Error: Missing namespace
             ('<article><para>Text</para></article>',
-             '/page/body/part/error'),
+                '/page/body/part/error'),
         ]
         for i in data:
             yield (self.do_nonamespace, ) + i
--- a/MoinMoin/converter/_tests/test_docbook_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_docbook_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,10 +11,7 @@
 
 import pytest
 
-try:
-    from lxml import etree
-except:
-    pytest.skip("lxml module required to run test for docbook_out converter.")
+etree = pytest.importorskip('lxml.etree')
 
 from emeraldtree.tree import *
 
@@ -23,6 +20,7 @@
 
 from MoinMoin.converter.docbook_out import *
 
+
 class Base(object):
     input_namespaces = ns_all = 'xmlns="{0}" xmlns:page="{1}" xmlns:html="{2}" xmlns:xlink="{3}" xmlns:xml="{4}"'.format(moin_page.namespace, moin_page.namespace, html.namespace, xlink.namespace, xml.namespace)
     output_namespaces = {
@@ -56,32 +54,33 @@
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()
 
     def test_base(self):
         data = [
-           # NB: All the output contain the <info> section, but for a better
-           #     readability, I did not wrote it in the snippet except this one
-           ('<page><body><p>Test</p></body></page>',
-            # <article><info><title>Untitled</title></info><simpara>Test</simpara></article>
-              '/article[./info[title="Untitled"]][simpara="Test"]'),
-           # ADMONITION type --> type
-           ('<page><body><admonition page:type="warning"><p>Text</p></admonition></body></page>',
-            # <article><warning><simpara>Text</simpara></warning></article>
-            '/article/warning[simpara="Text"]'),
-           # Unknown admonition
-           ('<page><body><admonition page:type="none"><p>Text</p></admonition></body></page>',
-            '/article[simpara="Text"]'),
-           # XML attributes: we support all the xml standard attributes
-           ('<page><body><p xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>',
-            # <article><simpara xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>
-            '/article/simpara[@xml:base="http://base.tld"][@xml:id="id"][@xml:lang="en"][text()="Text"]'),
-           # Para with title
-           ('<page><body><p html:title="Title">Text</p></body></page>',
-            # <article><simpara xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>
-            '/article/para[text()="Text"][title="Title"]'),
+            # NB: All the output contain the <info> section, but for a better
+            #     readability, I did not wrote it in the snippet except this one
+            ('<page><body><p>Test</p></body></page>',
+                # <article><info><title>Untitled</title></info><simpara>Test</simpara></article>
+                '/article[./info[title="Untitled"]][simpara="Test"]'),
+            # ADMONITION type --> type
+            ('<page><body><admonition page:type="warning"><p>Text</p></admonition></body></page>',
+                # <article><warning><simpara>Text</simpara></warning></article>
+                '/article/warning[simpara="Text"]'),
+            # Unknown admonition
+            ('<page><body><admonition page:type="none"><p>Text</p></admonition></body></page>',
+                '/article[simpara="Text"]'),
+            # XML attributes: we support all the xml standard attributes
+            ('<page><body><p xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>',
+                # <article><simpara xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>
+                '/article/simpara[@xml:base="http://base.tld"][@xml:id="id"][@xml:lang="en"][text()="Text"]'),
+            # Para with title
+            ('<page><body><p html:title="Title">Text</p></body></page>',
+                # <article><simpara xml:base="http://base.tld" xml:id="id" xml:lang="en">Text</p></body></page>
+                '/article/para[text()="Text"][title="Title"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -89,7 +88,7 @@
     def test_title(self):
         data = [
             ('<page><body><h page:outline-level="1">Heading 1</h><p>First</p><h page:outline-level="2">Heading 2</h><p>Second</p></body></page>',
-             '/article/sect1[title="Heading 1"][simpara="First"]/sect2[title="Heading 2"][simpara="Second"]'),
+                '/article/sect1[title="Heading 1"][simpara="First"]/sect2[title="Heading 2"][simpara="Second"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -98,32 +97,32 @@
         data = [
             # Simple unordered list
             ('<page><body><list page:item-label-generate="unordered"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><itemizedlist><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></itemizedlist></article>
-             '/article/itemizedlist[listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><itemizedlist><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></itemizedlist></article>
+                '/article/itemizedlist[listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple ordered list (use default arabic numeration)
             ('<page><body><list page:item-label-generate="ordered"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><orderedlist numeration="arabic"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
-             '/article/orderedlist[@numeration="arabic"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><orderedlist numeration="arabic"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
+                '/article/orderedlist[@numeration="arabic"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple ordered list with upper-alpha numeration
             ('<page><body><list page:item-label-generate="ordered" page:list-style-type="upper-alpha"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><orderedlist numeration="upperalpha"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
-             '/article/orderedlist[@numeration="upperalpha"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><orderedlist numeration="upperalpha"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
+                '/article/orderedlist[@numeration="upperalpha"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple ordered list with lower-alpha numeration
             ('<page><body><list page:item-label-generate="ordered" page:list-style-type="lower-alpha"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><orderedlist numeration="loweralpha"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
-             '/article/orderedlist[@numeration="loweralpha"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><orderedlist numeration="loweralpha"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
+                '/article/orderedlist[@numeration="loweralpha"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple ordered list with upper-roman numeration
             ('<page><body><list page:item-label-generate="ordered" page:list-style-type="upper-roman"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><orderedlist numeration="upperroman"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
-             '/article/orderedlist[@numeration="upperroman"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><orderedlist numeration="upperroman"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
+                '/article/orderedlist[@numeration="upperroman"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple ordered list with lower-roman numeration
             ('<page><body><list page:item-label-generate="ordered" page:list-style-type="lower-roman"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item></list></body></page>',
-             # <article><orderedlist numeration="lowerroman"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
-             '/article/orderedlist[@numeration="lowerroman"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
+                # <article><orderedlist numeration="lowerroman"><listitem><simpara>Item 1</simpara></listitem><listitem><simpara>Item 2</simpara></listitem></orderedlist></article>
+                '/article/orderedlist[@numeration="lowerroman"][listitem[1]/simpara[text()="Item 1"]][listitem[2]/simpara[text()="Item 2"]]'),
             # Simple definition list
             ('<page><body><list><list-item><list-item-label>First Term</list-item-label><list-item-body>First Definition</list-item-body></list-item><list-item><list-item-label>Second Term</list-item-label><list-item-body>Second Definition</list-item-body></list-item></list></body></page>',
-             # <article><variablelist><varlistentry><term>First Term</term><listitem><simpara>First Definition</simpara></listitem></varlistentry><varlistentry><term>Second term</term><listitem><simpara>Second Definition</simpara></listitem></varlistentry></variablelist></article>
-             '/article/variablelist[varlistentry[1][./term[text()="First Term"]][./listitem/simpara[text()="First Definition"]]][varlistentry[2][./term[text()="Second Term"]][./listitem/simpara[text()="Second Definition"]]]')
+                # <article><variablelist><varlistentry><term>First Term</term><listitem><simpara>First Definition</simpara></listitem></varlistentry><varlistentry><term>Second term</term><listitem><simpara>Second Definition</simpara></listitem></varlistentry></variablelist></article>
+                '/article/variablelist[varlistentry[1][./term[text()="First Term"]][./listitem/simpara[text()="First Definition"]]][varlistentry[2][./term[text()="Second Term"]][./listitem/simpara[text()="Second Definition"]]]')
         ]
 
         for i in data:
@@ -134,16 +133,16 @@
             # All the table output caption, just wrote a test and snippet
             # for the two first tests.
             ('<page><body><table><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-cell></table-row></table-body></table></body></page>',
-            # <article><table><caption>Table 0</caption><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table>
+                # <article><table><caption>Table 0</caption><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table>
                 '/article/table[caption="Table 0"][thead/tr[td="Header"]][tfoot/tr[td="Footer"]][tbody/tr[td="Cell"]]'),
             ('<page><body><table html:title="Title"><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-cell></table-row></table-body></table></body></page>',
-            # <article><table><caption>Title</caption><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table>
+                # <article><table><caption>Title</caption><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table>
                 '/article/table[caption="Title"][thead/tr[td="Header"]][tfoot/tr[td="Footer"]][tbody/tr[td="Cell"]]'),
             ('<page><body><table><table-body><table-row><table-cell page:number-columns-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>',
-             # <article><table><tbody><tr><td colspan="2">Cell</td></tr></tbody></table></article>
+                # <article><table><tbody><tr><td colspan="2">Cell</td></tr></tbody></table></article>
                 '/article/table/tbody/tr/td[@colspan="2"][text()="Cell"]'),
             ('<page><body><table><table-body><table-row><table-cell page:number-rows-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>',
-            # <article><table><tbody><tr><td rowspan="2">Cell</td></tr></tbody></table></article>
+                # <article><table><tbody><tr><td rowspan="2">Cell</td></tr></tbody></table></article>
                 '/article/table/tbody/tr/td[@rowspan="2"][text()="Cell"]'),
         ]
         for i in data:
@@ -153,53 +152,52 @@
         data = [
             # Footnote conversion
             ('<page><body><p>Text simpara<note page:note-class="footnote"><note-body>Text Footnote</note-body></note></p></body></page>',
-             # <article><simpara>Text simpara<footnote>Text Footnote</footnote></simpara></article>
-             '/article/simpara[text()="Text simpara"]/footnote[simpara="Text Footnote"]'),
+                # <article><simpara>Text simpara<footnote>Text Footnote</footnote></simpara></article>
+                '/article/simpara[text()="Text simpara"]/footnote[simpara="Text Footnote"]'),
             # Link conversion
             ('<page><body><p><a xlink:href="uri:test" xlink:title="title">link</a></p></body></page>',
-              # <article><simpara><link xlink:href="uri:test" xlink:title="title">link</link></simpara></article>
-              '/article/simpara/link[@xlink:href="uri:test"][@xlink:title="title"][text()="link"]'),
+                # <article><simpara><link xlink:href="uri:test" xlink:title="title">link</link></simpara></article>
+                '/article/simpara/link[@xlink:href="uri:test"][@xlink:title="title"][text()="link"]'),
             # Blockcode conversion into <screen> with CDATA
             ('<page><body><blockcode>Text</blockcode></body></page>',
-              # <article><screen><![CDATA[Text]]></screen></article>
-             '/article[screen="<![CDATA[Text]]>"]'),
+                # <article><screen><![CDATA[Text]]></screen></article>
+                '/article[screen="<![CDATA[Text]]>"]'),
             # Code conversion into <literal>
             ('<page><body><p><code>Text</code></p></body></page>',
-              # <article><simpara><literal>Text</literal></simpara></article>
-             '/article/simpara[literal="Text"]'),
+                # <article><simpara><literal>Text</literal></simpara></article>
+                '/article/simpara[literal="Text"]'),
             # SPAN --> PHRASE
             ('<page><body><p><span>Text</span></p></body></page>',
-              # <article><simpara><phrase>Text</phrase></simpara></article>
-             '/article/simpara[phrase="Text"]'),
+                # <article><simpara><phrase>Text</phrase></simpara></article>
+                '/article/simpara[phrase="Text"]'),
             # SPAN baseline-shift=sub --> subscript
             ('<page><body><p>sub<span page:baseline-shift="sub">sub</span>script</p></body></page>',
-             # <article><simpara>script<subscript>sub</subscript></simpara></article>
-             '/article/simpara[text()="script"][subscript="sub"]'),
+                # <article><simpara>script<subscript>sub</subscript></simpara></article>
+                '/article/simpara[text()="script"][subscript="sub"]'),
             # SPAN baseline-shift=super --> superscript
             ('<page><body><p>sub<span page:baseline-shift="super">super</span>script</p></body></page>',
-             # <article><simpara>script</simpara><superscript>super</superscript></article>
-             '/article/simpara[text()="script"][superscript="super"]'),
+                # <article><simpara>script</simpara><superscript>super</superscript></article>
+                '/article/simpara[text()="script"][superscript="super"]'),
             # STRONG --> EMPHASIS role='strong'
             ('<page><body><p>text<strong>strong</strong></p></body></page>',
-             # <article><simpara>text<emphasis role="strong">strong</emphasis></simpara>
-             '/article/simpara[text()="text"]/emphasis[@role="strong"][text()="strong"]'),
+                # <article><simpara>text<emphasis role="strong">strong</emphasis></simpara>
+                '/article/simpara[text()="text"]/emphasis[@role="strong"][text()="strong"]'),
             # EMPHASIS --> EMPHASIS
             ('<page><body><p>text<emphasis>emphasis</emphasis></p></body></page>',
-             # <article><simpara>text<emphasis>emphasis</emphasis></simpara>
-             '/article/simpara[text()="text"][emphasis="emphasis"]'),
+                # <article><simpara>text<emphasis>emphasis</emphasis></simpara>
+                '/article/simpara[text()="text"][emphasis="emphasis"]'),
             # LINE-BREAK --> SBR
             ('<page><body><p>Line 1<line-break />Line 2</p></body></page>',
-             #<article><simpara>Line 1<sbr />Line 2</simpara></article>
-             '/article/simpara[text()="Line 1"]/sbr'),
+                # <article><simpara>Line 1<sbr />Line 2</simpara></article>
+                '/article/simpara[text()="Line 1"]/sbr'),
             # QUOTE --> QUOTE
             ('<page><body><p>Text<quote>quotation</quote></p></body></page>',
-             # <article><simpara>Text<quote>quotation</quote></simpara></body></page>
-             '/article/simpara[text()="Text"][quote="quotation"]'),
+                # <article><simpara>Text<quote>quotation</quote></simpara></body></page>
+                '/article/simpara[text()="Text"][quote="quotation"]'),
             # BLOCKQUOTE --> BLOCKQUOTE
             ('<page><body><blockquote page:source="Socrates">One thing only I know, and that is that I know nothing.</blockquote></body></page>',
-             # <article><blockquote><attribution>Socrates</attribution><simpara>One thing ... nothing</simpara></blockquote></article>
-             '/article/blockquote[attribution="Socrates"][simpara="One thing only I know, and that is that I know nothing."]'),
-
+                # <article><blockquote><attribution>Socrates</attribution><simpara>One thing ... nothing</simpara></blockquote></article>
+                '/article/blockquote[attribution="Socrates"][simpara="One thing only I know, and that is that I know nothing."]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -207,14 +205,14 @@
     def test_object(self):
         data = [
             ('<page><body><p><object xlink:href="pics.png" page:type="image/" /></p></body></page>',
-             # <article><simpara><inlinemediaobject><imageobject><imagedata fileref="pics.png"></imageobject></inlinemediaobject></simpara></article>
-             '/article/simpara/inlinemediaobject/imageobject/imagedata[@fileref="pics.png"]'),
+                # <article><simpara><inlinemediaobject><imageobject><imagedata fileref="pics.png"></imageobject></inlinemediaobject></simpara></article>
+                '/article/simpara/inlinemediaobject/imageobject/imagedata[@fileref="pics.png"]'),
             ('<page><body><p><object xlink:href="sound.wav" page:type="audio/" /></p></body></page>',
-             # <article><simpara><inlinemediaobject><audioobject><audiodata fileref="sound.wav"></audioobject></inlinemediaobject></simpara></article>
-             '/article/simpara/inlinemediaobject/audioobject/audiodata[@fileref="sound.wav"]'),
+                # <article><simpara><inlinemediaobject><audioobject><audiodata fileref="sound.wav"></audioobject></inlinemediaobject></simpara></article>
+                '/article/simpara/inlinemediaobject/audioobject/audiodata[@fileref="sound.wav"]'),
             ('<page><body><p><object xlink:href="video.ogg" page:type="video/" /></p></body></page>',
-             # <article><simpara><inlinemediaobject><videoobject><videodata fileref="video.ogg"></videoobject></inlinemediaobject></simpara></article>
-             '/article/simpara/inlinemediaobject/videoobject/videodata[@fileref="video.ogg"]'),
+                # <article><simpara><inlinemediaobject><videoobject><videodata fileref="video.ogg"></videoobject></inlinemediaobject></simpara></article>
+                '/article/simpara/inlinemediaobject/videoobject/videodata[@fileref="video.ogg"]'),
         ]
         for i in data:
             yield (self.do, ) + i
--- a/MoinMoin/converter/_tests/test_html_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_html_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,10 +10,8 @@
 import StringIO
 
 import pytest
-try:
-    from lxml import etree
-except:
-    pytest.skip("lxml module required to run test for html_in converter.")
+
+etree = pytest.importorskip('lxml.etree')
 
 from emeraldtree.tree import *
 
@@ -21,6 +19,7 @@
 logging = log.getLogger(__name__)
 from MoinMoin.converter.html_in import *
 
+
 class Base(object):
     namespaces = {
         moin_page.namespace: '',
@@ -49,6 +48,7 @@
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(path, namespaces=self.namespaces_xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()
@@ -70,12 +70,12 @@
             ('<div><p>Test</p></div>',
              # <page><body><p>Test</p></page></body>
              '/page/body[p="Test"]'),
-             # Test attributes conversion
-             ('<div><p class="class text" style="style text" title="title text">Test</p></div>',
+            # Test attributes conversion
+            ('<div><p class="class text" style="style text" title="title text">Test</p></div>',
              # <page><body><p html:class="class text" html:style="style text" html:title="title text">Test</p></body></page>
              '/page/body/p[@html:class="class text"][@html:style="style text"][@html:title="title text"][text()="Test"]'),
-             # Test id
-             ('<div><p id="first">Text<strong id="second">strong</strong></p></div>',
+            # Test id
+            ('<div><p id="first">Text<strong id="second">strong</strong></p></div>',
              # <page><body><p xml:id="first">Text<strong xml:id="second">strong</strong></p></div>
              '/page/body/p[@xml:id="first"][text()="Text"]/strong[@xml:id="second"][text()="strong"]'),
         ]
@@ -85,11 +85,11 @@
     def test_title(self):
         data = [
             ('<html><h2>Test</h2></html>',
-            # <page><body><h outline-level="2">Test</h></body></page>
-              '/page/body/h[text()="Test"][@outline-level=2]'),
+                # <page><body><h outline-level="2">Test</h></body></page>
+                '/page/body/h[text()="Test"][@outline-level=2]'),
             ('<html><h6>Test</h6></html>',
-            # <page><body><h outline-level="6">Test</h></body></page>
-              '/page/body/h[text()="Test"][@outline-level=6]'),
+                # <page><body><h outline-level="6">Test</h></body></page>
+                '/page/body/h[text()="Test"][@outline-level=6]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -97,17 +97,17 @@
     def test_basic_style(self):
         data = [
             ('<html><p><em>Test</em></p></html>',
-             # <page><body><p><emphasis>Test</emphasis></body></page>
-              '/page/body/p[emphasis="Test"]'),
+                # <page><body><p><emphasis>Test</emphasis></body></page>
+                '/page/body/p[emphasis="Test"]'),
             ('<html><p><i>Test</i></p></html>',
-             # <page><body><p><emphasis>Test</emphasis></body></page>
-              '/page/body/p[emphasis="Test"]'),
+                # <page><body><p><emphasis>Test</emphasis></body></page>
+                '/page/body/p[emphasis="Test"]'),
             ('<html><p><strong>Test</strong></p></html>',
-             # <page><body><p><strong>Test</strong></p></body></page>
-              '/page/body/p[strong="Test"]'),
+                # <page><body><p><strong>Test</strong></p></body></page>
+                '/page/body/p[strong="Test"]'),
             ('<html><p><b>Test</b></p></html>',
-             # <page><body><p><strong>Test</strong></p></body></page>
-              '/page/body/p[strong="Test"]'),
+                # <page><body><p><strong>Test</strong></p></body></page>
+                '/page/body/p[strong="Test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -115,32 +115,32 @@
     def test_span(self):
         data = [
             ('<html><p><sub>sub</sub>script</p></html>',
-             # <page><body><p><span baseline-shift="sub">sub</span></p></body></page>
-             '/page/body/p/span[text()="sub"][@baseline-shift="sub"]'),
+                # <page><body><p><span baseline-shift="sub">sub</span></p></body></page>
+                '/page/body/p/span[text()="sub"][@baseline-shift="sub"]'),
             ('<html><p><sup>super</sup>script</p></html>',
-             # <page><body><p><span baseline-shift="super">super</span></p></body></page>
-             '/page/body/p/span[text()="super"][@baseline-shift="super"]'),
+                # <page><body><p><span baseline-shift="super">super</span></p></body></page>
+                '/page/body/p/span[text()="super"][@baseline-shift="super"]'),
             ('<html><p><u>underline</u></p></html>',
-             # <page><body><p><span text-decoration="underline">underline</span></p></body></page>
-             '/page/body/p/span[text()="underline"][@text-decoration="underline"]'),
+                # <page><body><p><span text-decoration="underline">underline</span></p></body></page>
+                '/page/body/p/span[text()="underline"][@text-decoration="underline"]'),
             ('<html><p><big>Test</big></p></html>',
-             # <page><body><p><span font-size="120%">Test</span></p></body></page>
-              '/page/body/p/span[text()="Test"][@font-size="120%"]'),
+                # <page><body><p><span font-size="120%">Test</span></p></body></page>
+                '/page/body/p/span[text()="Test"][@font-size="120%"]'),
             ('<html><p><small>Test</small></p></html>',
-             # <page><body><p><span font-size="85%">Test</span></p></body></page>
-              '/page/body/p/span[text()="Test"][@font-size="85%"]'),
+                # <page><body><p><span font-size="85%">Test</span></p></body></page>
+                '/page/body/p/span[text()="Test"][@font-size="85%"]'),
             ('<html><p><ins>underline</ins></p></html>',
-             # <page><body><p><span text-decoration="underline">underline</span></p></body></page>
-             '/page/body/p/span[text()="underline"][@text-decoration="underline"]'),
+                # <page><body><p><span text-decoration="underline">underline</span></p></body></page>
+                '/page/body/p/span[text()="underline"][@text-decoration="underline"]'),
             ('<html><p><del>Test</del></p></html>',
-             # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
-             '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
+                # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
+                '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
             ('<html><p><s>Test</s></p></html>',
-             # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
-             '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
+                # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
+                '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
             ('<html><p><strike>Test</strike></p></html>',
-             # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
-             '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
+                # <page><body><p><span text-decoration="line-through">Test</span></p></body></page>
+                '/page/body/p/span[text()="Test"][@text-decoration="line-through"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -148,20 +148,20 @@
     def test_span_html_element(self):
         data = [
             ('<html><p><abbr>Text</abbr></p></html>',
-             # <page><body><span html:class="html-abbr">Text</span></body></page>
-             '/page/body/p/span[text()="Text"][@html:class="html-abbr"]'),
+                # <page><body><span html:class="html-abbr">Text</span></body></page>
+                '/page/body/p/span[text()="Text"][@html:class="html-abbr"]'),
             ('<html><p><acronym>Text</acronym></p></html>',
-             # <page><body><span html:class="html-acronym">Text</span></body></page>
-             '/page/body/p/span[text()="Text"][@html:class="html-acronym"]'),
+                # <page><body><span html:class="html-acronym">Text</span></body></page>
+                '/page/body/p/span[text()="Text"][@html:class="html-acronym"]'),
             ('<html><p><address>Text</address></p></html>',
-             # <page><body><span html:class="html-address">Text</span></body></page>
-             '/page/body/p/span[text()="Text"][@html:class="html-address"]'),
+                # <page><body><span html:class="html-address">Text</span></body></page>
+                '/page/body/p/span[text()="Text"][@html:class="html-address"]'),
             ('<html><p><dfn>Text</dfn></p></html>',
-             # <page><body><span html:class="html-dfn">Text</span></body></page>
-             '/page/body/p/span[text()="Text"][@html:class="html-dfn"]'),
+                # <page><body><span html:class="html-dfn">Text</span></body></page>
+                '/page/body/p/span[text()="Text"][@html:class="html-dfn"]'),
             ('<html><p><kbd>Text</kbd></p></html>',
-             # <page><body><span html:class="html-kbd">Text</span></body></page>
-             '/page/body/p/span[text()="Text"][@html:class="html-kbd"]'),
+                # <page><body><span html:class="html-kbd">Text</span></body></page>
+                '/page/body/p/span[text()="Text"][@html:class="html-kbd"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -169,13 +169,13 @@
     def test_link(self):
         data = [
             ('<html><p><a href="uri:test">Test</a></p></html>',
-              # <page><body><p><a xlink:href>Test</a></p></body></page>
-              '/page/body/p/a[text()="Test"][@xlink:href="uri:test"]'),
+                # <page><body><p><a xlink:href>Test</a></p></body></page>
+                '/page/body/p/a[text()="Test"][@xlink:href="uri:test"]'),
             ('<html><base href="http://www.base-url.com/" /><body><div><p><a href="myPage.html">Test</a></p></div></body></html>',
-              # <page><body><div><p><a xlink:href="http://www.base-url.com/myPage.html">Test</a></p></div></body></page>
-              '/page/body/div/p/a[@xlink:href="http://www.base-url.com/myPage.html"]'),
+                # <page><body><div><p><a xlink:href="http://www.base-url.com/myPage.html">Test</a></p></div></body></page>
+                '/page/body/div/p/a[@xlink:href="http://www.base-url.com/myPage.html"]'),
             ('<html><p><a href="javascript:alert(\'hi\')">Test</a></p></html>',
-              # <page><body><p>Test</p></body></page>
+                # <page><body><p>Test</p></body></page>
                 '/page/body/p/[text()="Test"]'),
         ]
         for i in data:
@@ -184,17 +184,17 @@
     def test_code(self):
         data = [
             ('<html><div><code>Code</code></div></html>',
-             # <page><body><div><code>Code</code></div></body></page>
-             '/page/body/div[code="Code"]'),
+                # <page><body><div><code>Code</code></div></body></page>
+                '/page/body/div[code="Code"]'),
             ('<html><div><samp>Code</samp></div></html>',
-             # <page><body><div><code>Code</code></div></body></page>
-             '/page/body/div[code="Code"]'),
+                # <page><body><div><code>Code</code></div></body></page>
+                '/page/body/div[code="Code"]'),
             ('<html><pre>Code</pre></html>',
-             # <page><body><blockcode>Code</blockcode></body></page>
-              '/page/body[blockcode="Code"]'),
+                # <page><body><blockcode>Code</blockcode></body></page>
+                '/page/body[blockcode="Code"]'),
             ('<html><p><tt>Code</tt></p></html>',
-             # <page><body><p><code>Code</code></p></body></page>
-              '/page/body/p[code="Code"]'),
+                # <page><body><p><code>Code</code></p></body></page>
+                '/page/body/p[code="Code"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -202,11 +202,11 @@
     def test_quote(self):
         data = [
             ('<html><div><p><quote>Inline quote</quote></p></div></html>',
-            # <page><body><div><p><quote>Inline quote</quote></p></body></page>
-             '/page/body/div/p[quote="Inline quote"]'),
+                # <page><body><div><p><quote>Inline quote</quote></p></body></page>
+                '/page/body/div/p[quote="Inline quote"]'),
             ('<html><div><blockquote>Block quote</blockquote></div></html>',
-            # <page><body><div><blockquote>Block quote</blockquote></body></page>
-             '/page/body/div[blockquote="Block quote"]'),
+                # <page><body><div><blockquote>Block quote</blockquote></body></page>
+                '/page/body/div[blockquote="Block quote"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -214,32 +214,32 @@
     def test_list(self):
         data = [
             ('<html><div><ul><li>Item</li></ul></div></html>',
-            # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="unordered"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="unordered"]/list-item[list-item-body="Item"]'),
             ('<html><div><ol><li>Item</li></ol></div></html>',
-            # <page><body><div><list item-label-generate="ordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="ordered"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="ordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="ordered"]/list-item[list-item-body="Item"]'),
             ('<html><div><ol type="A"><li>Item</li></ol></div></html>',
-            # <page><body><div><list item-label-generate="ordered" list-style-type="upper-alpha"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="upper-alpha"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="ordered" list-style-type="upper-alpha"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="upper-alpha"]/list-item[list-item-body="Item"]'),
             ('<html><div><ol type="I"><li>Item</li></ol></div></html>',
-            # <page><body><div><list item-label-generate="ordered" list-style-type="upper-roman"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="upper-roman"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="ordered" list-style-type="upper-roman"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="upper-roman"]/list-item[list-item-body="Item"]'),
             ('<html><div><ol type="a"><li>Item</li></ol></div></html>',
-            # <page><body><div><list item-label-generate="ordered" list-style-type="lower-alpha"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="lower-alpha"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="ordered" list-style-type="lower-alpha"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="lower-alpha"]/list-item[list-item-body="Item"]'),
             ('<html><div><ol type="i"><li>Item</li></ol></div></html>',
-            # <page><body><div><list item-label-generate="ordered" list-style-type="lower-roman"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="lower-roman"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="ordered" list-style-type="lower-roman"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="ordered" and @list-style-type="lower-roman"]/list-item[list-item-body="Item"]'),
             ('<html><div><dl><dt>Label</dt><dd>Item</dd></dl></div></html>',
-            # <page><body><div><list><list-item><list-item-label>Label</list-item-label><list-item-body>Item</list-item-body></list-item></list></div></body></page>
-             '/page/body/div/list/list-item[list-item-label="Label"][list-item-body="Item"]'),
+                # <page><body><div><list><list-item><list-item-label>Label</list-item-label><list-item-body>Item</list-item-body></list-item></list></div></body></page>
+                '/page/body/div/list/list-item[list-item-label="Label"][list-item-body="Item"]'),
             ('<html><div><dir><li>Item</li></dir></div></html>',
-            # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
-              '/page/body/div/list[@item-label-generate="unordered"]/list-item[list-item-body="Item"]'),
+                # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/div/list[@item-label-generate="unordered"]/list-item[list-item-body="Item"]'),
             ('<div><ul><li>Item 1</li><li>Item 2</li><li>Item 3</li></ul></div>',
-            # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item><list-item><list-item-body>Item 3</list-item-body></list-item></list></div></page></body></page>
-             '/page/body/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]][list-item[3]/list-item-body[text()="Item 3"]]'),
+                # <page><body><div><list item-label-generate="unordered"><list-item><list-item-body>Item 1</list-item-body></list-item><list-item><list-item-body>Item 2</list-item-body></list-item><list-item><list-item-body>Item 3</list-item-body></list-item></list></div></page></body></page>
+                '/page/body/list[@item-label-generate="unordered"][list-item[1]/list-item-body[text()="Item 1"]][list-item[2]/list-item-body[text()="Item 2"]][list-item[3]/list-item-body[text()="Item 3"]]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -247,11 +247,11 @@
     def test_object(self):
         data = [
             ('<html><div><img src="uri:test" /></div></html>',
-             # <page><body><div><object xlink:href="uri:test" /></div></body></page>
-              '/page/body/div/object/@xlink:href="uri:test"'),
+                # <page><body><div><object xlink:href="uri:test" /></div></body></page>
+                '/page/body/div/object/@xlink:href="uri:test"'),
             ('<html><div><object data="href"></object></div></html>',
-             # <page><body><div><object xlink:href="href" /></div></body></page>
-              '/page/body/div/object/@xlink:href="href"'),
+                # <page><body><div><object xlink:href="href" /></div></body></page>
+                '/page/body/div/object/@xlink:href="href"'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -259,14 +259,14 @@
     def test_table(self):
         data = [
             ('<html><div><table><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table></div></html>',
-            # <page><body><div><table><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-cell></table-row></table-body></table></div></body></page>
-             '/page/body/div/table[./table-header/table-row[table-cell="Header"]][./table-footer/table-row[table-cell="Footer"]][./table-body/table-row[table-cell="Cell"]]'),
+                # <page><body><div><table><table-header><table-row><table-cell>Header</table-cell></table-row></table-header><table-footer><table-row><table-cell>Footer</table-cell></table-row></table-footer><table-body><table-row><table-cell>Cell</table-cell></table-row></table-body></table></div></body></page>
+                '/page/body/div/table[./table-header/table-row[table-cell="Header"]][./table-footer/table-row[table-cell="Footer"]][./table-body/table-row[table-cell="Cell"]]'),
             ('<html><div><table><tbody><tr><td colspan="2">Cell</td></tr></tbody></table></div></html>',
-            # <page><body><div><table><table-body><table-row><table-cell number-columns-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>
-             '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-columns-spanned="2"]'),
+                # <page><body><div><table><table-body><table-row><table-cell number-columns-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>
+                '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-columns-spanned="2"]'),
             ('<html><div><table><tbody><tr><td rowspan="2">Cell</td></tr></tbody></table></div></html>',
-            # <page><body><div><table><table-body><table-row><table-cell number-rows-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>
-             '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-rows-spanned="2"]'),
+                # <page><body><div><table><table-body><table-row><table-cell number-rows-spanned="2">Cell</table-cell></table-row></table-body></table></body></page>
+                '/page/body/div/table/table-body/table-row/table-cell[text()="Cell"][@number-rows-spanned="2"]'),
         ]
         for i in data:
             yield (self.do, ) + i
--- a/MoinMoin/converter/_tests/test_html_in_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_html_in_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -13,10 +13,8 @@
 import re
 
 import pytest
-try:
-    from lxml import etree
-except:
-    pytest.skip("lxml module required to run test for html_in_out converter.")
+
+etree = pytest.importorskip('lxml.etree')
 
 from MoinMoin import log
 logging = log.getLogger(__name__)
@@ -25,6 +23,7 @@
 from MoinMoin.converter.html_out import Converter as HTML_OUT
 from MoinMoin.util.tree import html, moin_page, xlink
 
+
 class Base(object):
 
     namespaces = {
@@ -51,6 +50,7 @@
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(path))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv_html_dom = HTML_IN()
@@ -85,13 +85,13 @@
     def test_basic_style(self):
         data = [
             ('<html><p><em>Test</em></p></html>',
-              '/div/p[em="Test"]'),
+                '/div/p[em="Test"]'),
             ('<html><p><i>Test</i></p></html>',
-              '/div/p[em="Test"]'),
+                '/div/p[em="Test"]'),
             ('<html><p><strong>Test</strong></p></html>',
-              '/div/p[strong="Test"]'),
+                '/div/p[strong="Test"]'),
             ('<html><p><b>Test</b></p></html>',
-              '/div/p[strong="Test"]'),
+                '/div/p[strong="Test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -99,23 +99,23 @@
     def test_span(self):
         data = [
             ('<html><p><sub>sub</sub>script</p></html>',
-             '/div/p[sub="sub"]'),
+                '/div/p[sub="sub"]'),
             ('<html><p><sup>super</sup>script</p></html>',
-             '/div/p[sup="super"]'),
+                '/div/p[sup="super"]'),
             ('<html><p><u>underline</u></p></html>',
-             '/div/p[ins="underline"]'),
+                '/div/p[ins="underline"]'),
             ('<html><p><big>Test</big></p></html>',
-              '/div/p/span[@class="moin-big"][text()="Test"]'),
+                '/div/p/span[@class="moin-big"][text()="Test"]'),
             ('<html><p><small>Test</small></p></html>',
-              '/div/p/span[@class="moin-small"][text()="Test"]'),
+                '/div/p/span[@class="moin-small"][text()="Test"]'),
             ('<html><p><ins>underline</ins></p></html>',
-             '/div/p[ins="underline"]'),
+                '/div/p[ins="underline"]'),
             ('<html><p><del>Test</del></p></html>',
-             '/div/p[del="Test"]'),
+                '/div/p[del="Test"]'),
             ('<html><p><s>Test</s></p></html>',
-             '/div/p[del="Test"]'),
+                '/div/p[del="Test"]'),
             ('<html><p><strike>Test</strike></p></html>',
-             '/div/p[del="Test"]'),
+                '/div/p[del="Test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -123,15 +123,15 @@
     def test_span_html_element(self):
         data = [
             ('<html><p><abbr>Text</abbr></p></html>',
-             '/div/p/span[@class="html-abbr"][text()="Text"]'),
+                '/div/p/span[@class="html-abbr"][text()="Text"]'),
             ('<html><p><acronym>Text</acronym></p></html>',
-             '/div/p/span[@class="html-acronym"][text()="Text"]'),
+                '/div/p/span[@class="html-acronym"][text()="Text"]'),
             ('<html><p><address>Text</address></p></html>',
-             '/div/p/span[@class="html-address"][text()="Text"]'),
+                '/div/p/span[@class="html-address"][text()="Text"]'),
             ('<html><p><dfn>Text</dfn></p></html>',
-             '/div/p/span[@class="html-dfn"][text()="Text"]'),
+                '/div/p/span[@class="html-dfn"][text()="Text"]'),
             ('<html><p><kbd>Text</kbd></p></html>',
-             '/div/p/span[@class="html-kbd"][text()="Text"]'),
+                '/div/p/span[@class="html-kbd"][text()="Text"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -139,7 +139,7 @@
     def test_link(self):
         data = [
             ('<html><p><a href="uri:test">Test</a></p></html>',
-              '/div/p/a[text()="Test"][@href="uri:test"]'),
+                '/div/p/a[text()="Test"][@href="uri:test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -147,13 +147,13 @@
     def test_code(self):
         data = [
             ('<html><div><code>Code</code></div></html>',
-             '/div/div[code="Code"]'),
+                '/div/div[code="Code"]'),
             ('<html><div><samp>Code</samp></div></html>',
-             '/div/div[code="Code"]'),
+                '/div/div[code="Code"]'),
             ('<html><pre>Code</pre></html>',
-              '/div[pre="Code"]'),
+                '/div[pre="Code"]'),
             ('<html><p><tt>Code</tt></p></html>',
-              '/div/p[code="Code"]'),
+                '/div/p[code="Code"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -161,28 +161,28 @@
     def test_list(self):
         data = [
             ('<html><div><ul><li>Item</li></ul></div></html>',
-              '/div/div/ul[li="Item"]'),
+                '/div/div/ul[li="Item"]'),
             ('<html><div><ol><li>Item</li></ol></div></html>',
-              '/div/div/ol[li="Item"]'),
+                '/div/div/ol[li="Item"]'),
             ('<html><div><ol type="A"><li>Item</li></ol></div></html>',
-              '/div/div/ol[@class="moin-upperalpha-list"][li="Item"]'),
+                '/div/div/ol[@class="moin-upperalpha-list"][li="Item"]'),
             ('<html><div><ol type="I"><li>Item</li></ol></div></html>',
-              '/div/div/ol[@class="moin-upperroman-list"][li="Item"]'),
+                '/div/div/ol[@class="moin-upperroman-list"][li="Item"]'),
             ('<html><div><ol type="a"><li>Item</li></ol></div></html>',
-              '/div/div/ol[@class="moin-loweralpha-list"][li="Item"]'),
+                '/div/div/ol[@class="moin-loweralpha-list"][li="Item"]'),
             ('<html><div><ol type="i"><li>Item<li></ol></div></html>',
-              '/div/div/ol[@class="moin-lowerroman-list"][li="Item"]'),
+                '/div/div/ol[@class="moin-lowerroman-list"][li="Item"]'),
             ('<html><div><dl><dt>Label</dt><dd>Item</dd></dl></div></html>',
-             '/div/div/dl[dt="Label"][dd="Item"]'),
+                '/div/div/dl[dt="Label"][dd="Item"]'),
             ('<html><div><dir><li>Item</li></dir></div></html>',
-              '/div/div/ul[li="Item"]'),
+                '/div/div/ul[li="Item"]'),
             ('<div><ul><li>Item 1</li><p>Pouet</p><li>Item 2</li><li>Item 3</li></ul></div>',
-             '/div/ul[li[1]="Item 1"][li[2]="Item 2"][li[3]="Item 3"]'),
-             #Test for bug with line return and spaces
+                '/div/ul[li[1]="Item 1"][li[2]="Item 2"][li[3]="Item 3"]'),
+            #Test for bug with line return and spaces
             ('<div><ul><li>\n Item 1</li>\n<li>\n Item 2</li>\n<li>\n Item 3</li>\n</ul></div>',
-             '/div/ul[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'),
+                '/div/ul[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'),
             ('<div><ol><li>\n Item 1</li>\n<li>\n Item 2</li>\n<li>\n Item 3</li>\n</ol></div>',
-             '/div/ol[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'),
+                '/div/ol[li[1]="\n Item 1"][li[2]="\n Item 2"][li[3]="\n Item 3"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -192,7 +192,7 @@
             #('<html><div><img src="uri:test" /></div></html>',
             #  '/page/body/div/object/@xlink:href="uri:test"'),
             ('<html><div><object data="href"></object></div></html>',
-              '/div/div/div/object[@data="href"]'),
+                '/div/div/div/object[@data="href"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -200,14 +200,14 @@
     def test_table(self):
         data = [
             ('<html><div><table><thead><tr><td>Header</td></tr></thead><tfoot><tr><td>Footer</td></tr></tfoot><tbody><tr><td>Cell</td></tr></tbody></table></div></html>',
-             '/div/div/table[./thead/tr[td="Header"]][./tfoot/tr[td="Footer"]][./tbody/tr[td="Cell"]]'),
+                '/div/div/table[./thead/tr[td="Header"]][./tfoot/tr[td="Footer"]][./tbody/tr[td="Cell"]]'),
             ('<html><div><table><tbody><tr><td colspan="2">Cell</td></tr></tbody></table></div></html>',
-             '/div/div/table/tbody/tr/td[text()="Cell"][@colspan="2"]'),
+                '/div/div/table/tbody/tr/td[text()="Cell"][@colspan="2"]'),
             ('<html><div><table><tbody><tr><td rowspan="2">Cell</td></tr></tbody></table></div></html>',
-             '/div/div/table/tbody/tr/td[text()="Cell"][@rowspan="2"]'),
+                '/div/div/table/tbody/tr/td[text()="Cell"][@rowspan="2"]'),
             # Test for bug with newline between cell
             ('<div><table>\n<tbody>\n<tr>\n<td>\n Cell 1:1</td>\n<td>\n Cell 1:2</td>\n</tr>\n<tr>\n<td>\n Cell 2:1</td>\n<td>\n Cell 2:2</td>\n</tr>\n</tbody>\n</table></div>',
-              '/div/table/tbody[tr[1][td[1]="\n Cell 1:1"][td[2]="\n Cell 1:2"]][tr[2][td[1]="\n Cell 2:1"][td[2]="\n Cell 2:2"]]'),
+                '/div/table/tbody[tr[1][td[1]="\n Cell 1:1"][td[2]="\n Cell 1:2"]][tr[2][td[1]="\n Cell 2:1"][td[2]="\n Cell 2:2"]]'),
         ]
         for i in data:
             yield (self.do, ) + i
--- a/MoinMoin/converter/_tests/test_html_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_html_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,10 +11,8 @@
 import StringIO
 
 import pytest
-try:
-    from lxml import etree
-except:
-    pytest.skip("lxml module required to run test for html_out converter.")
+
+etree = pytest.importorskip('lxml.etree')
 
 from emeraldtree.tree import *
 
@@ -23,6 +21,7 @@
 
 from MoinMoin.converter.html_out import *
 
+
 class Base(object):
     input_namespaces = ns_all = 'xmlns="{0}" xmlns:page="{1}" xmlns:html="{2}" xmlns:xlink="{3}" xmlns:xml="{4}"'.format(moin_page.namespace, moin_page.namespace, html.namespace, xlink.namespace, xml.namespace)
     output_namespaces = {
@@ -51,6 +50,7 @@
         tree = etree.parse(StringIO.StringIO(string_to_parse))
         assert (tree.xpath(xpath))
 
+
 class TestConverter(Base):
     def setup_class(self):
         self.conv = Converter()
@@ -105,10 +105,10 @@
         data = [
             # Basic Links
             ('<page:page><page:body><page:a xlink:href="uri:test">Test</page:a></page:body></page:page>',
-              '/div/a[text()="Test"][@href="uri:test"]'),
+                '/div/a[text()="Test"][@href="uri:test"]'),
             # Links with xml:base
             ('<page xml:base="http://base.tld/"><body><p><a xlink:href="page.html">Test</a></p></body></page>',
-              '/div/p/a[@href="http://base.tld/page.html"][text()="Test"]'),
+                '/div/p/a[@href="http://base.tld/page.html"][text()="Test"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -180,7 +180,7 @@
             ('<page><body><object xlink:href="href.png" page:type="image/png"/></body></page>',
                 '/div/img[@src="href.png"]'),
             ('<page xml:base="http://base.tld/"><body><object xlink:href="href.png" page:type="image/png"/></body></page>',
-              '/div/img[@src="http://base.tld/href.png"]'),
+                '/div/img[@src="http://base.tld/href.png"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -202,9 +202,9 @@
     def test_style(self):
         data = [
             ('<page><body><p style="font-size: 1em">Text</p></body></page>',
-              '/div/p[@style="font-size: 1em"][text()="Text"]'),
+                '/div/p[@style="font-size: 1em"][text()="Text"]'),
             ('<page><body><p style="color: black; font-size: 1em">Text</p></body></page>',
-              '/div/p[@style="color: black; font-size: 1em"][text()="Text"]'),
+                '/div/p[@style="color: black; font-size: 1em"][text()="Text"]'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -229,6 +229,7 @@
         for i in data:
             yield (self.do, ) + i
 
+
 class TestConverterPage(Base):
     def setup_class(self):
         self.conv = ConverterPage()
--- a/MoinMoin/converter/_tests/test_include.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_include.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,6 +11,7 @@
 from MoinMoin.constants.keys import CONTENTTYPE
 from MoinMoin._tests import wikiconfig, update_item
 
+
 class TestInclude(object):
     class Config(wikiconfig.Config):
         """
@@ -131,12 +132,14 @@
         update_item(u'page2', {CONTENTTYPE: u'text/x.moin.wiki'}, u"")
         rendered = Item.create(u'page1').content._render_data()
         assert '<p>text <span class="moin-transclusion" data-href="/page2"></span> text</p>' in rendered
+
     def test_InlineIncludeCreole(self):
         # transclude single paragraph as inline using creole parser
         update_item(u'creole', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'creole item')
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.creole;charset=utf-8'}, u'before {{creole}} after')
         rendered = Item.create(u'page1').content._render_data()
         assert '<p>before <span class="moin-transclusion" data-href="/creole">creole item</span> after</p>' in rendered
+
     def test_InlineIncludeWithinMarkup(self):
         # transclude single line item within italic and bold markup
         update_item(u'page1', {CONTENTTYPE: u'text/x.moin.wiki'}, u"Normal ''italic '''bold {{page2}} bold''' italic'' normal")
--- a/MoinMoin/converter/_tests/test_link.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_link.py	Sun Mar 03 07:44:25 2013 -0700
@@ -15,6 +15,7 @@
 from MoinMoin.converter.link import *
 from MoinMoin.util.iri import Iri
 
+
 class TestConverterExternOutput(object):
     def setup_class(self):
         self.conv = ConverterExternOutput()
--- a/MoinMoin/converter/_tests/test_moinwiki19_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_moinwiki19_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -32,7 +32,7 @@
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">mailto:foo@bar.baz</a></p></body></page>'),
             (u'foo@bar.baz',
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">foo@bar.baz</a></p></body></page>'),
-            (u'foo@bar', # 1.9 requires domain
+            (u'foo@bar',  # 1.9 requires domain
                 '<page><body><p>foo@bar</p></body></page>'),
         ]
         for i in data:
--- a/MoinMoin/converter/_tests/test_moinwiki_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_moinwiki_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -91,7 +91,7 @@
 
     def test_heading(self):
         data = [
-            (u'=Not_a_Heading=', # this is for better moin 1.x compatibility
+            (u'=Not_a_Heading=',  # this is for better moin 1.x compatibility
                 '<page><body><p>=Not_a_Heading=</p></body></page>'),
             (u'= Heading 1 =',
                 '<page><body><h outline-level="1">Heading 1</h></body></page>'),
@@ -257,20 +257,20 @@
                 '<page><body><p /></body></page>'),
             # XXX: Is <page> correct?
             (u'{{{#!\nwiki\n}}}',
-               '<page><body><page><body><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body><p>wiki</p></body></page></body></page>'),
             (u'{{{#!(style="background-color: red")\nwiki\n}}}',
-               '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
             (u'{{{#!wiki\nwiki\n}}}',
-               '<page><body><page><body><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body><p>wiki</p></body></page></body></page>'),
             (u'{{{#!wiki(style="background-color: red")\nwiki\n}}}',
-               '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body style="background-color: red"><p>wiki</p></body></page></body></page>'),
             # TODO: Backward compatibility
             (u'{{{#!wiki red/solid\nwiki\n}}}',
-               '<page><body><page><body class="red solid"><p>wiki</p></body></page></body></page>'),
+                '<page><body><page><body class="red solid"><p>wiki</p></body></page></body></page>'),
             (u'{{{#!text/plain\ntext\n}}}',
-               u'<page><body><part content-type="text/plain"><body>text</body></part></body></page>'),
+                u'<page><body><part content-type="text/plain"><body>text</body></part></body></page>'),
             (u'{{{#!text/x.moin.creole\ntext\n}}}',
-               u'<page><body><part content-type="text/x.moin.creole"><body>text</body></part></body></page>'),
+                u'<page><body><part content-type="text/x.moin.creole"><body>text</body></part></body></page>'),
         ]
         for i in data:
             yield (self.do, ) + i
@@ -284,6 +284,7 @@
         ]
         for i in data:
             yield (self.do, ) + i
+
     def test_interwiki(self):
         data = [
             (u'[[MoinMoin:RecentChanges]]',
@@ -308,7 +309,7 @@
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">mailto:foo@bar.baz</a></p></body></page>'),
             (u'[[mailto:foo@bar.baz|write me]]',
                 '<page><body><p><a xlink:href="mailto:foo@bar.baz">write me</a></p></body></page>'),
-            (u'[[mailto:foo.bar_baz@bar.baz]]', # . and _ are special characters commonly allowed by email systems
+            (u'[[mailto:foo.bar_baz@bar.baz]]',  # . and _ are special characters commonly allowed by email systems
                 '<page><body><p><a xlink:href="mailto:foo.bar_baz@bar.baz">mailto:foo.bar_baz@bar.baz</a></p></body></page>'),
         ]
         for i in data:
--- a/MoinMoin/converter/_tests/test_moinwiki_in_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_moinwiki_in_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -128,7 +128,7 @@
             yield (self.do, ) + i
 
     def test_page(self):
-        pytest.skip("please help fixing moin wiki round trip tests") # XXX TODO
+        pytest.skip("please help fixing moin wiki round trip tests")  # XXX TODO
         data = [
             (u"""
 This page aims to introduce the most important elements of MoinMoin``'s syntax at a glance, showing first the markup verbatim and then how it is rendered by the wiki engine. Additionally, you'll find links to the relative help pages. Please note that some of the features depend on your configuration.
--- a/MoinMoin/converter/_tests/test_registry.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_registry.py	Sun Mar 03 07:44:25 2013 -0700
@@ -43,7 +43,7 @@
                 (type_moin_document, Type('application/x-xhtml-moin-page'), HtmlOutConverterPage),
                 (type_moin_document, type_moin_wiki, MoinwikiOutConverter),
                 (type_moin_document, Type('x-moin/format;name=wiki'), MoinwikiOutConverter),
-            ]:
+        ]:
             conv = default_registry.get(type_input, type_output)
             assert isinstance(conv, ExpectedClass)
 
@@ -53,7 +53,7 @@
                 (dict(includes='expandall'), IncludeConverter),
                 (dict(links='extern'), LinkConverterExternOutput),
                 (dict(items='refs'), LinkConverterItemRefs),
-            ]:
+        ]:
             conv = default_registry.get(type_moin_document, type_moin_document, **kwargs)
             assert isinstance(conv, ExpectedClass)
 
--- a/MoinMoin/converter/_tests/test_rst_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_rst_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -49,7 +49,7 @@
             (u'1. a\n2. b\n\nA. c\n\na. A\n\n   3. B\n\n   4. C\n\n', '<page><body><list item-label-generate="ordered"><list-item><list-item-body><p>a</p></list-item-body></list-item><list-item><list-item-body><p>b</p></list-item-body></list-item></list><list item-label-generate="ordered" list-style-type="upper-alpha"><list-item><list-item-body><p>c</p></list-item-body></list-item></list><list item-label-generate="ordered" list-style-type="lower-alpha"><list-item><list-item-body><p>A</p><list item-label-generate="ordered"><list-item><list-item-body><p>B</p></list-item-body></list-item><list-item><list-item-body><p>C</p></list-item-body></list-item></list></list-item-body></list-item></list></body></page>'),
             (u'* A\n\n   - B\n\n      + C\n\n   - D\n\n* E', '<page><body><list item-label-generate="unordered"><list-item><list-item-body><p>A</p><list><list-item><list-item-body><list item-label-generate="unordered"><list-item><list-item-body><p>B</p><list><list-item><list-item-body><list item-label-generate="unordered"><list-item><list-item-body><p>C</p></list-item-body></list-item></list></list-item-body></list-item></list></list-item-body></list-item><list-item><list-item-body><p>D</p></list-item-body></list-item></list></list-item-body></list-item></list></list-item-body></list-item><list-item><list-item-body><p>E</p></list-item-body></list-item></list></body></page>'),
             (u'what\n      def\n\nhow\n      to', '<page><body><list><list-item><list-item-label>what</list-item-label><list-item-body><p>def</p></list-item-body></list-item><list-item><list-item-label>how</list-item-label><list-item-body><p>to</p></list-item-body></list-item></list></body></page>')
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -62,7 +62,7 @@
    :scale: 50
    :alt: alternate text""", '<page><body><object alt="images/biohazard.png" height="100" scale="50" width="200" xlink:href="images/biohazard.png" /></body></page>'),
             (u'abc |a| cba\n\n.. |a| image:: test.png', '<page><body><p>abc <object alt="test.png" xlink:href="test.png" /> cba</p></body></page>'),
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -70,7 +70,7 @@
         data = [
             (u'Chapter 1 Title\n===============\n\nSection 1.1 Title\n-----------------\n\nSubsection 1.1.1 Title\n~~~~~~~~~~~~~~~~~~~~~~\n\nSection 1.2 Title\n-----------------\n\nChapter 2 Title\n===============\n', '<page><body><h outline-level="2">Chapter 1 Title</h><h outline-level="3">Section 1.1 Title</h><h outline-level="4">Subsection 1.1.1 Title</h><h outline-level="3">Section 1.2 Title</h><h outline-level="2">Chapter 2 Title</h></body></page>'),
             (u'================\n Document Title\n================\n\n----------\n Subtitle\n----------\n\nSection Title\n=============', '<page><body><h outline-level="1">Document Title</h><h outline-level="2">Subtitle</h><h outline-level="2">Section Title</h></body></page>')
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -78,7 +78,7 @@
         data = [
             (u'Abra [1]_\n\n.. [1] arba', '<page><body><p>Abra <note note-class="footnote"><note-body>arba</note-body></note></p></body></page>'),
             (u'Abra [#]_\n\n.. [#] arba', '<page><body><p>Abra <note note-class="footnote"><note-body>arba</note-body></note></p></body></page>'),
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -86,7 +86,7 @@
         data = [
             (u'Abra test_ arba\n\n.. _test: http://python.org', '<page><body><p>Abra <a xlink:href="http://python.org">test</a> arba</p></body></page>'),
             (u'Abra test__ arba\n\n.. __: http://python.org', '<page><body><p>Abra <a xlink:href="http://python.org">test</a> arba</p></body></page>')
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -99,7 +99,7 @@
             (u'.. contents::\n  :depth: 1\n', '<page><body><table-of-content outline-level="1" /></body></page>'),
             (u'.. parser:: python test=test\n  import test\n  test.s = 11', '<page><body><part content-type="x-moin/format;name=python"><arguments><argument name="test">test</argument></arguments>import test\ntest.s = 11</part></body></page>'),
             (u'.. include:: RecentChanges', '<page><body><part content-type="x-moin/macro;name=Include"><arguments><argument>RecentChanges</argument></arguments>&lt;&lt;Include(RecentChanges)&gt;&gt;</part></body></page>'),
-            ]
+        ]
         for i in data:
             yield (self.do, ) + i
 
@@ -153,4 +153,5 @@
         out = self.conv(input, 'text/x-rst;charset=utf-8', **args)
         assert self.serialize(out) == output
 
+
 coverage_modules = ['MoinMoin.converter.rst_in']
--- a/MoinMoin/converter/_tests/test_rst_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_rst_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -67,7 +67,7 @@
         data = [
             (u"<page:table><page:table-body><page:table-row><page:table-cell>A</page:table-cell><page:table-cell>B</page:table-cell><page:table-cell page:number-rows-spanned=\"2\">D</page:table-cell></page:table-row><page:table-row><page:table-cell page:number-cols-spanned=\"2\">C</page:table-cell></page:table-row></page:table-body></page:table>", "+-+-+-+\n|A|B|D|\n+-+-+ +\n|C  | |\n+---+-+\n\n"),
             (u"<page:table><page:table-body><page:table-row><page:table-cell><page:strong>A</page:strong></page:table-cell><page:table-cell><page:strong>B</page:strong></page:table-cell><page:table-cell><page:strong>C</page:strong></page:table-cell></page:table-row><page:table-row><page:table-cell><page:p>1</page:p></page:table-cell><page:table-cell>2</page:table-cell><page:table-cell>3</page:table-cell></page:table-row></page:table-body></page:table>", u"+-----+-----+-----+\n|**A**|**B**|**C**|\n+-----+-----+-----+\n|1    |2    |3    |\n+-----+-----+-----+\n\n"),
-             (u'<page:page><page:body><page:table><page:table-header><page:table-row><page:table-cell><page:p>AAAAAAAAAAAAAAAAAA</page:p></page:table-cell><page:table-cell><page:p>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</page:p></page:table-cell></page:table-row></page:table-header><page:table-body><page:table-row><page:table-cell page:number-rows-spanned=\"2\"><page:p>cell spanning 2 rows</page:p></page:table-cell><page:table-cell><page:p>cell in the 2nd column</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell><page:p>cell in the 2nd column of the 2nd row</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell page:number-cols-spanned=\"2\"><page:p>test</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell page:number-cols-spanned=\"2\"><page:p>test</page:p></page:table-cell></page:table-row></page:table-body></page:table></page:body></page:page>', """+--------------------+-------------------------------------+
+            (u'<page:page><page:body><page:table><page:table-header><page:table-row><page:table-cell><page:p>AAAAAAAAAAAAAAAAAA</page:p></page:table-cell><page:table-cell><page:p>BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB</page:p></page:table-cell></page:table-row></page:table-header><page:table-body><page:table-row><page:table-cell page:number-rows-spanned=\"2\"><page:p>cell spanning 2 rows</page:p></page:table-cell><page:table-cell><page:p>cell in the 2nd column</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell><page:p>cell in the 2nd column of the 2nd row</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell page:number-cols-spanned=\"2\"><page:p>test</page:p></page:table-cell></page:table-row><page:table-row><page:table-cell page:number-cols-spanned=\"2\"><page:p>test</page:p></page:table-cell></page:table-row></page:table-body></page:table></page:body></page:page>', """+--------------------+-------------------------------------+
 |AAAAAAAAAAAAAAAAAA  |BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB  |
 +====================+=====================================+
 |cell spanning 2 rows|cell in the 2nd column               |
@@ -179,4 +179,5 @@
         for i in data:
             yield (self.do, ) + i
 
+
 coverage_modules = ['MoinMoin.converter.rst_out']
--- a/MoinMoin/converter/_tests/test_smiley.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/_tests/test_smiley.py	Sun Mar 03 07:44:25 2013 -0700
@@ -34,8 +34,8 @@
     '2 at once': (
         '<page><body><p>:-) :-(</p></body></page>',
         '/page/body/p'
-            '[span[1][@class="moin-text-icon moin-smile"]]'
-            '[span[2][@class="moin-text-icon moin-sad"]]'),
+        '[span[1][@class="moin-text-icon moin-smile"]]'
+        '[span[2][@class="moin-text-icon moin-sad"]]'),
     'strong': (
         '<page><body><p><strong>:-)</strong></p></body></page>',
         '/page/body/p/strong/span[@class="moin-text-icon moin-smile"]'),
--- a/MoinMoin/converter/archive_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/archive_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -58,7 +58,7 @@
             contents = [(self.process_size(size),
                          self.process_datetime(dt),
                          self.process_name(name),
-                        ) for size, dt, name in contents]
+            ) for size, dt, name in contents]
             table = self.build_dom_table(contents, head=[_("Size"), _("Timestamp"), _("Name")], cls='zebra')
             body = moin_page.body(children=(table, ))
             return moin_page.page(children=(body, ))
--- a/MoinMoin/converter/creole_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/creole_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -126,8 +126,7 @@
         $
     """
 
-    def block_macro_repl(self, _iter_content, stack, macro, macro_name,
-            macro_args=None, macro_text=None):
+    def block_macro_repl(self, _iter_content, stack, macro, macro_name, macro_args=None, macro_text=None):
         """Handles macros using the placeholder syntax."""
         stack.clear()
 
@@ -363,8 +362,7 @@
         )
     """
 
-    def inline_macro_repl(self, stack, macro, macro_name,
-            macro_args=None, macro_text=None):
+    def inline_macro_repl(self, stack, macro, macro_name, macro_args=None, macro_text=None):
         """Handles macros using the placeholder syntax."""
 
         if macro_args:
--- a/MoinMoin/converter/docbook_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/docbook_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -136,7 +136,7 @@
                       'simplesect', 'subtitle', 'synopsis',
                       'synopfragment', 'task', 'taskprerequisites',
                       'taskrelated', 'tasksummary', 'title',
-                     ])
+    ])
 
     # DocBook has admonition as individual element, but the DOM Tree
     # has only one element for it, so we will convert all the DocBook
@@ -145,18 +145,23 @@
 
     # DocBook can handle three kind of media: audio, image, video. Here
     # is an helper dictionary to process such of element.
-    media_tags = {'audioobject': (['wav', 'mp3', 'ogg'],
-                                 'audiodata',
-                                 'audio/',
-                                 ),
-                  'imageobject': (['gif', 'png', 'jpg', 'png'],
-                                 'imagedata',
-                                 'image/',
-                                 ),
-                  'videoobject': (['ogg', 'avi', 'mp4'],
-                                 'videodata',
-                                 'video/',
-                                 )}
+    media_tags = {
+        'audioobject': (
+            ['wav', 'mp3', 'ogg'],
+            'audiodata',
+            'audio/',
+        ),
+        'imageobject': (
+            ['gif', 'png', 'jpg', 'png'],
+            'imagedata',
+            'image/',
+        ),
+        'videoobject': (
+            ['ogg', 'avi', 'mp4'],
+            'videodata',
+            'video/',
+        )
+    }
 
     # DocBook tags which can be convert directly to a DOM Tree element
     simple_tags = {'code': moin_page.code,
@@ -249,7 +254,7 @@
         a given element.
         """
         new_children = []
-        depth = depth + 1
+        depth += 1
         for child in element:
             if isinstance(child, ET.Element):
                 r = self.visit(child, depth)
@@ -288,8 +293,7 @@
         """
         result = {}
         for key, value in element.attrib.iteritems():
-            if key.uri == xml \
-              and key.name in ['id', 'base', 'lang']:
+            if key.uri == xml and key.name in ['id', 'base', 'lang']:
                 result[key] = value
         if result:
             # We clear standard_attribute, if ancestror attribute
@@ -395,11 +399,9 @@
                     caption = self.do_children(child, depth + 1)[0]
                 if child.tag.name == 'textobject':
                     text_object = child
-        return self.visit_data_element(object_element, depth, object_data,
-            text_object, caption)
+        return self.visit_data_element(object_element, depth, object_data, text_object, caption)
 
-    def visit_data_element(self, element, depth, object_data,
-                           text_object, caption):
+    def visit_data_element(self, element, depth, object_data, text_object, caption):
         """
         We will try to return an object element based on the
         object_data. If it is not possible, we return a paragraph
@@ -744,8 +746,8 @@
         """
         self.is_section = True
         if depth > self.section_depth:
-            self.section_depth = self.section_depth + 1
-            self.heading_level = self.heading_level + 1
+            self.section_depth += 1
+            self.heading_level += 1
         elif depth < self.section_depth:
             self.heading_level = self.heading_level - (self.section_depth - depth)
             self.section_depth = depth
@@ -782,14 +784,14 @@
             if isinstance(child, ET.Element):
                 if child.tag.name == 'seg':
                     label_tag = ET.Element(moin_page('list-item-label'),
-                            attrib={}, children=labels[counter % len(labels)])
+                                           attrib={}, children=labels[counter % len(labels)])
                     body_tag = ET.Element(moin_page('list-item-body'),
-                            attrib={}, children=self.visit(child, depth))
+                                          attrib={}, children=self.visit(child, depth))
                     item_tag = ET.Element(moin_page('list-item'),
-                            attrib={}, children=[label_tag, body_tag])
+                                          attrib={}, children=[label_tag, body_tag])
                     item_tag = (item_tag, )
                     new.extend(item_tag)
-                    counter = counter + 1
+                    counter += 1
                 else:
                     r = self.visit(child)
                     if r is None:
@@ -825,8 +827,7 @@
                     labels.extend(r)
                 else:
                     if child.tag.name == 'seglistitem':
-                        r = self.visit_docbook_seglistitem(child,
-                            labels, depth)
+                        r = self.visit_docbook_seglistitem(child, labels, depth)
                     else:
                         r = self.visit(child)
                     if r is None:
@@ -925,8 +926,7 @@
         attrib = {}
         children = []
         if class_attribute:
-            attrib[html('class')] = ''.join(['db-tag-',
-                                        class_attribute])
+            attrib[html('class')] = ''.join(['db-tag-', class_attribute])
         else:
             attrib[html('class')] = 'db-tag'
         if namespace_attribute:
@@ -944,7 +944,7 @@
         trademark_entities = {'copyright': '&copy;',
                               'registred': '&reg;',
                               'trade': '&trade;',
-                             }
+        }
         trademark_class = element.get('class')
         children = self.do_children(element, depth)
         if trademark_class in trademark_entities:
@@ -1146,8 +1146,7 @@
         children.append(self.visit(element, depth))
         # We show the table of content only if it is not empty
         if self.is_section:
-            children.insert(0, self.new(moin_page('table-of-content'),
-                                    attrib={}, children={}))
+            children.insert(0, self.new(moin_page('table-of-content'), attrib={}, children={}))
         body = self.new(moin_page.body, attrib={}, children=children)
         return self.new(moin_page.page, attrib=attrib, children=[body])
 
--- a/MoinMoin/converter/docbook_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/docbook_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -261,7 +261,7 @@
             if self.parent_section != 0:
                 section_tag = 'sect{0}'.format(self.parent_section)
                 section = ET.Element(docbook(section_tag), attrib={},
-                          children=self.section_children[self.current_section])
+                                     children=self.section_children[self.current_section])
                 self.section_children[self.parent_section].append(section)
                 self.current_section = int(depth)
 
@@ -385,7 +385,7 @@
         if not title:
             #TODO: Translation
             title = "Table {0}".format(self.table_counter)
-        self.table_counter = self.table_counter + 1
+        self.table_counter += 1
         caption = ET.Element(docbook('caption'), attrib={}, children=[title])
         children = [caption]
         children.extend(self.do_children(element))
@@ -515,5 +515,4 @@
 
 from . import default_registry
 from MoinMoin.util.mime import Type, type_moin_document
-default_registry.register(Converter._factory, type_moin_document,
-    Type('application/docbook+xml'))
+default_registry.register(Converter._factory, type_moin_document, Type('application/docbook+xml'))
--- a/MoinMoin/converter/html_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/html_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -33,7 +33,7 @@
     # Namespace of our input data
     html_namespace = {
         html.namespace: 'xhtml',
-        }
+    }
 
     # HTML tags which can be converted directly to the moin_page namespace
     symmetric_tags = set(['div', 'p', 'strong', 'code', 'quote', 'blockquote'])
@@ -43,16 +43,16 @@
 
     # HTML tags which can be convert without attributes in a different DOM tag
     simple_tags = {  # Emphasis
-                   'em': moin_page.emphasis, 'i': moin_page.emphasis,
-                   # Strong
-                   'b': moin_page.strong, 'strong': moin_page.strong,
-                   # Code and Blockcode
-                   'pre': moin_page.blockcode, 'tt': moin_page.code,
-                   'samp': moin_page.code,
-                   # Lists
-                   'dt': moin_page.list_item_label, 'dd': moin_page.list_item_body,
-                   # TODO : Some tags related to tables can be also simplify
-                  }
+        'em': moin_page.emphasis, 'i': moin_page.emphasis,
+        # Strong
+        'b': moin_page.strong, 'strong': moin_page.strong,
+        # Code and Blockcode
+        'pre': moin_page.blockcode, 'tt': moin_page.code,
+        'samp': moin_page.code,
+        # Lists
+        'dt': moin_page.list_item_label, 'dd': moin_page.list_item_body,
+        # TODO : Some tags related to tables can be also simplify
+    }
 
     # HTML Tag which does not have equivalence in the DOM Tree
     # But we keep the information using <span element>
@@ -65,7 +65,7 @@
                         'label', 'legend', 'link', 'map', 'menu', 'noframes', 'noscript',
                         'optgroup', 'option', 'param', 'script', 'select', 'style',
                         'textarea', 'title', 'var',
-                       ])
+    ])
 
     # standard_attributes are html attributes which are used
     # directly in the DOM tree, without any conversion
@@ -481,7 +481,7 @@
         for child in element:
             # We need one dt tag, and one dd tag, a have a pair
             if child.tag.name == 'dt' or child.tag.name == 'dd':
-                number_pair = number_pair + 1
+                number_pair += 1
 
             # The following code is similar to do_children method
             if isinstance(child, ET.Element):
--- a/MoinMoin/converter/html_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/html_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -197,8 +197,7 @@
         # Unknown element are just copied
         return self.new_copy(elem.tag, elem)
 
-    def visit_moinpage_a(self, elem,
-            _tag_html_a=html.a, _tag_html_href=html.href, _tag_xlink_href=xlink.href):
+    def visit_moinpage_a(self, elem, _tag_html_a=html.a, _tag_html_href=html.href, _tag_xlink_href=xlink.href):
         attrib = {}
         href = elem.get(_tag_xlink_href)
         if href:
@@ -617,12 +616,10 @@
                 headings = list(headings)
                 maxlevel = max(h[1] for h in headings)
                 headtogglelink = html.a(attrib={
-                                         html.class_: 'moin-showhide',
-                                         html.href_: '#',
-                                         html.onclick_:
-                                            "$('.moin-table-of-contents ol').toggle();return false;",
-                                     },
-                                     children=[('[+]'), ])
+                    html.class_: 'moin-showhide',
+                    html.href_: '#',
+                    html.onclick_: "$('.moin-table-of-contents ol').toggle();return false;",
+                }, children=['[+]', ])
                 elem_h = html.div(attrib={html.class_: 'moin-table-of-contents-heading'},
                                   children=[_('Contents'), headtogglelink])
                 elem.append(elem_h)
@@ -655,20 +652,16 @@
                         stack.pop()
                         stack_push(html.li({html.id_: 'li{0}'.format(id)}))
                     togglelink = html.a(attrib={
-                                         html.href_: "#",
-                                         html.onclick_:
-                                            "$('#li{0} ol').toggle();return false;".format(id),
-                                         html.class_: 'moin-showhide',
-                                     },
-                                     children=["[+]", ])
-                    elem_a = html.a(attrib={html.href: '#' + id},
-                                    children=[text, ])
+                        html.href_: "#",
+                        html.onclick_: "$('#li{0} ol').toggle();return false;".format(id),
+                        html.class_: 'moin-showhide',
+                    }, children=["[+]", ])
+                    elem_a = html.a(attrib={html.href: '#' + id}, children=[text, ])
                     stack_top_append(elem_a)
                     old_toggle = togglelink
         return ret
 
-    def visit(self, elem,
-            _tag_moin_page_page_href=moin_page.page_href):
+    def visit(self, elem, _tag_moin_page_page_href=moin_page.page_href):
         # TODO: Is this correct, or is <page> better?
         if elem.get(_tag_moin_page_page_href):
             self._special_stack.append(SpecialPage())
@@ -683,8 +676,7 @@
         else:
             return super(ConverterPage, self).visit(elem)
 
-    def visit_moinpage_h(self, elem,
-            _tag_html_id=html.id):
+    def visit_moinpage_h(self, elem, _tag_html_id=html.id):
         elem = super(ConverterPage, self).visit_moinpage_h(elem)
 
         id = elem.get(_tag_html_id)
--- a/MoinMoin/converter/include.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/include.py	Sun Mar 03 07:44:25 2013 -0700
@@ -107,16 +107,16 @@
 
 # elements generated by moin wiki markup that cannot have block children
 NO_BLOCK_CHILDREN = [
-        'p',
-        'span',  # /*comment*/, ~+big+~, ~-small-~ via classes comment, moin-big, moin-small
-        'emphasis',  # ''italic''
-        'strong',  # '''bold'''
-        'del',  # --(stroke)--
-        'ins',  # __underline__
-        # 'sub',  # ,,subscript,, # no markup allowed within subscripts
-        # 'sup',  # ^superscript^ # no markup allowed within superscripts
-        'a',  # [[SomeItem|{{logo.png}}]]
-        ]
+    'p',
+    'span',  # /*comment*/, ~+big+~, ~-small-~ via classes comment, moin-big, moin-small
+    'emphasis',  # ''italic''
+    'strong',  # '''bold'''
+    'del',  # --(stroke)--
+    'ins',  # __underline__
+    # 'sub',  # ,,subscript,, # no markup allowed within subscripts
+    # 'sup',  # ^superscript^ # no markup allowed within superscripts
+    'a',  # [[SomeItem|{{logo.png}}]]
+]
 
 
 class XPointer(list):
--- a/MoinMoin/converter/link.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/link.py	Sun Mar 03 07:44:25 2013 -0700
@@ -47,9 +47,8 @@
         # because it is also called in subclasses
         return self.traverse_tree(*args, **kw)
 
-    def traverse_tree(self, elem, page=None,
-            __tag_page_href=moin_page.page_href, __tag_link=_tag_xlink_href,
-            __tag_include=_tag_xinclude_href):
+    def traverse_tree(self, elem, page=None, __tag_page_href=moin_page.page_href,
+                      __tag_link=_tag_xlink_href, __tag_include=_tag_xinclude_href):
         """
         Traverses the tree and handles each element appropriately
         """
--- a/MoinMoin/converter/macro.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/macro.py	Sun Mar 03 07:44:25 2013 -0700
@@ -87,9 +87,7 @@
             # some standard text.
             logging.exception("Macro {0} raised an exception:".format(name))
             elem_error.append(_('<<%(macro_name)s: execution failed [%(error_msg)s] (see also the log)>>',
-                    macro_name=name,
-                    error_msg=unicode(e),
-                ))
+                              macro_name=name, error_msg=unicode(e), ))
 
         if len(elem_body):
             elem.append(elem_body)
--- a/MoinMoin/converter/markdown_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/markdown_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -75,16 +75,16 @@
 
     # HTML tags which can be convert without attributes in a different DOM tag
     simple_tags = {  # Emphasis
-                   'em': moin_page.emphasis, 'i': moin_page.emphasis,
-                   # Strong
-                   'b': moin_page.strong, 'strong': moin_page.strong,
-                   # Code and Blockcode
-                   'pre': moin_page.blockcode, 'tt': moin_page.code,
-                   'samp': moin_page.code,
-                   # Lists
-                   'dt': moin_page.list_item_label, 'dd': moin_page.list_item_body,
-                   # TODO : Some tags related to tables can be also simplify
-                  }
+        'em': moin_page.emphasis, 'i': moin_page.emphasis,
+        # Strong
+        'b': moin_page.strong, 'strong': moin_page.strong,
+        # Code and Blockcode
+        'pre': moin_page.blockcode, 'tt': moin_page.code,
+        'samp': moin_page.code,
+        # Lists
+        'dt': moin_page.list_item_label, 'dd': moin_page.list_item_body,
+        # TODO : Some tags related to tables can be also simplify
+    }
 
     # HTML Tag which does not have equivalence in the DOM Tree
     # But we keep the information using <span element>
@@ -97,7 +97,7 @@
                         'label', 'legend', 'link', 'map', 'menu', 'noframes', 'noscript',
                         'optgroup', 'option', 'param', 'script', 'select', 'style',
                         'textarea', 'title', 'var',
-                       ])
+    ])
 
     # standard_attributes are html attributes which are used
     # directly in the DOM tree, without any conversion
@@ -292,8 +292,7 @@
         elif element.tag == "ol":
             attrib[moin_page('item-label-generate')] = 'ordered'
 
-        return ET.Element(moin_page.list, attrib=attrib,
-                children=self.do_children(element))
+        return ET.Element(moin_page.list, attrib=attrib, children=self.do_children(element))
 
     def visit_a(self, element):
         key = xlink('href')
--- a/MoinMoin/converter/mediawiki_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/mediawiki_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -285,11 +285,10 @@
             yield match.group('text')
 
     def indent_repl(self, iter_content, stack, line,
-            indent, text, list_begin=None, list_definition=None,
-            list_definition_text=None, list_numbers=None,
-            list_bullet=None,
-            list_none=None):
-
+                    indent, text, list_begin=None, list_definition=None,
+                    list_definition_text=None, list_numbers=None,
+                    list_bullet=None,
+                    list_none=None):
         level = len(indent)
         list_type = 'unordered', 'none'
         if list_begin:
@@ -629,7 +628,7 @@
         return ret
 
     def inline_link_repl(self, stack, link, link_url=None, link_item=None,
-                            link_args=u'', external_link_url=None, alt_text=u''):
+                         link_args=u'', external_link_url=None, alt_text=u''):
         """Handle all kinds of links."""
         link_text = ''
         link_args_list = []
@@ -723,8 +722,8 @@
     """
 
     def inline_nowiki_repl(self, stack, nowiki, nowiki_text=None,
-            nowiki_text_pre=None, pre_args='',
-            nowiki_text_code=None, nowiki_text_tt=None):
+                           nowiki_text_pre=None, pre_args='',
+                           nowiki_text_code=None, nowiki_text_tt=None):
         text = None
 
         if nowiki_text is not None:
@@ -767,8 +766,8 @@
         block_comment,
         block_head,
         block_separator,
-       # block_macro,
-       # block_nowiki,
+        # block_macro,
+        # block_nowiki,
         block_text,
     )
     block_re = re.compile('|'.join(block), re.X | re.U | re.M)
@@ -779,13 +778,13 @@
         inline_link,
         inline_breakline,
         inline_blockquote,
-        #inline_macro,
+        # inline_macro,
         inline_nowiki,
-        #inline_object,
+        # inline_object,
         inline_emphstrong,
         inline_comment,
         inline_footnote,
-        #inline_size,
+        # inline_size,
         inline_strike,
         inline_subscript,
         inline_superscript,
@@ -833,18 +832,18 @@
             's',
             'sub',
             'sup',
-            ]
+        ]
 
         nowiki_tags = [
             'pre',
             'code',
             'tt',
             'nowiki',
-            ]
+        ]
 
         block_tags = [
             'blockquote',
-            ]
+        ]
 
         def __init__(self):
             self.opened_tags = []
@@ -879,7 +878,7 @@
 
         def __call__(self, line, tags=[]):
             tags = tags or self.opened_tags
-            match = re.match(r"(.*?)(\<.*\>.*)|(.*)", line)
+            match = re.match(r"(.*?)(<.*>.*)|(.*)", line)
             if match:
                 pre_text = match.group(1) or match.group(3)
                 # text may be None
--- a/MoinMoin/converter/moinwiki19_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/moinwiki19_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -83,8 +83,8 @@
     }
 
     def inline_freelink_repl(self, stack, freelink, freelink_bang=None,
-            freelink_interwiki_page=None, freelink_interwiki_ref=None,
-            freelink_page=None, freelink_email=None):
+                             freelink_interwiki_page=None, freelink_interwiki_ref=None,
+                             freelink_page=None, freelink_email=None):
         if freelink_bang:
             stack.top_append(freelink)
             return
@@ -110,8 +110,8 @@
                 return
 
             link = Iri(scheme='wiki',
-                    authority=freelink_interwiki_ref,
-                    path='/' + freelink_interwiki_page)
+                       authority=freelink_interwiki_ref,
+                       path='/' + freelink_interwiki_page)
             text = freelink_interwiki_page
 
         attrib[xlink.href] = link
--- a/MoinMoin/converter/moinwiki_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/moinwiki_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -261,8 +261,8 @@
             yield line
 
     def block_nowiki_repl(self, iter_content, stack, nowiki, nowiki_marker,
-            nowiki_interpret=None, nowiki_name=None, nowiki_args=None,
-            nowiki_args_old=None):
+                          nowiki_interpret=None, nowiki_name=None, nowiki_args=None,
+                          nowiki_args_old=None):
         stack.clear()
 
         nowiki_marker_len = len(nowiki_marker)
@@ -406,11 +406,11 @@
             yield match.group('text')
 
     def indent_repl(self, iter_content, stack, line,
-            indent, text, list_begin=None, list_definition=None,
-            list_definition_text=None, list_numbers=None,
-            list_alpha=None, list_roman=None, list_bullet=None,
-            list_start_number=None, list_start_roman=None, list_start_alpha=None,
-            list_none=None):
+                    indent, text, list_begin=None, list_definition=None,
+                    list_definition_text=None, list_numbers=None,
+                    list_alpha=None, list_roman=None, list_bullet=None,
+                    list_start_number=None, list_start_roman=None, list_start_alpha=None,
+                    list_none=None):
 
         level = len(indent)
 
@@ -698,14 +698,14 @@
     """ % dict(uri_schemes='|'.join(URI_SCHEMES))
 
     def inline_link_repl(self, stack, link, link_url=None, link_item=None,
-            link_text=None, link_args=None,
-            link_interwiki_site=None, link_interwiki_item=None):
+                         link_text=None, link_args=None,
+                         link_interwiki_site=None, link_interwiki_item=None):
         """Handle all kinds of links."""
         if link_interwiki_site:
             if is_known_wiki(link_interwiki_site):
                 link = Iri(scheme='wiki',
-                        authority=link_interwiki_site,
-                        path='/' + link_interwiki_item)
+                           authority=link_interwiki_site,
+                           path='/' + link_interwiki_item)
                 element = moin_page.a(attrib={xlink.href: link})
                 stack.push(element)
                 if link_text:
@@ -783,8 +783,7 @@
         )
     """
 
-    def inline_nowiki_repl(self, stack, nowiki, nowiki_text=None,
-            nowiki_text_backtick=None):
+    def inline_nowiki_repl(self, stack, nowiki, nowiki_text=None, nowiki_text_backtick=None):
         text = None
         if nowiki_text is not None:
             text = nowiki_text
@@ -888,7 +887,7 @@
         def add_attr_to_style(attrib, attr):
             attr = attr.strip().decode('unicode-escape')
             if not attr.endswith(';'):
-                attr = attr + ';'
+                attr += ';'
             if attrib.get(moin_page('style'), ""):
                 attrib[moin_page('style')] = attrib.get(moin_page('style'), "") + " " + attr
             else:
--- a/MoinMoin/converter/moinwiki_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/moinwiki_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -58,7 +58,7 @@
         (u'ordered', u'upper-roman'): u'I.',
         (u'unordered', None): u'*',
         (None, None): u'::',
-        }
+    }
 
     def __init__(self):
         pass
@@ -73,29 +73,31 @@
 
     supported_tag = {
         'moinpage': (
-                'a',
-                'blockcode',
-                'break_line',
-                'code',
-                'div',
-                'emphasis',
-                'h',
-                'list',
-                'list_item',
-                'list_item_label',
-                'list_item_body',
-                'p',
-                'page',
-                'separator',
-                'span',
-                'strong',
-                'object',
-                'table',
-                'table_header',
-                'teble_footer',
-                'table_body',
-                'table_row',
-                'table_cell')}
+            'a',
+            'blockcode',
+            'break_line',
+            'code',
+            'div',
+            'emphasis',
+            'h',
+            'list',
+            'list_item',
+            'list_item_label',
+            'list_item_body',
+            'p',
+            'page',
+            'separator',
+            'span',
+            'strong',
+            'object',
+            'table',
+            'table_header',
+            'teble_footer',
+            'table_body',
+            'table_row',
+            'table_cell',
+        )
+    }
 
     @classmethod
     def factory(cls, input, output, **kw):
@@ -240,8 +242,7 @@
         return Moinwiki.linebreak
 
     def open_moinpage_list(self, elem):
-        label_type = (elem.get(moin_page.item_label_generate, None),
-                        elem.get(moin_page.list_style_type, None))
+        label_type = elem.get(moin_page.item_label_generate, None), elem.get(moin_page.list_style_type, None)
         self.list_item_labels.append(
             Moinwiki.list_type.get(label_type, u''))
         self.list_level += 1
@@ -327,16 +328,14 @@
             else:
                 ret = self.open_children(elem) + Moinwiki.p
         elif self.status[-2] == 'table':
-            if self.last_closed and self.last_closed != 'table_cell'\
-                                and self.last_closed != 'table_row':
+            if self.last_closed and self.last_closed != 'table_cell' and self.last_closed != 'table_row':
                 ret = Moinwiki.linebreak + self.open_children(elem)
             else:
                 ret = self.open_children(elem)
         elif self.status[-2] == 'list':
-            if self.last_closed and self.last_closed != 'list_item'\
-                                and self.last_closed != 'list_item_header'\
-                                and self.last_closed != 'list_item_footer'\
-                                and self.last_closed != 'list_item_label':
+            if self.last_closed and (
+                self.last_closed != 'list_item' and self.last_closed != 'list_item_header' and
+                self.last_closed != 'list_item_footer' and self.last_closed != 'list_item_label'):
                 ret = Moinwiki.linebreak + self.open_children(elem)
             else:
                 ret = self.open_children(elem)
@@ -430,11 +429,10 @@
         if text_decoration == u'underline':
             return Moinwiki.underline + self.open_children(elem) + Moinwiki.underline
         if font_size:
-            return u"{0}{1}{2}".format(Moinwiki.larger_open if font_size == u"120%"
-                                           else Moinwiki.smaller_open,
-                                       self.open_children(elem),
-                                       Moinwiki.larger_close if font_size == u"120%"
-                                           else Moinwiki.smaller_close)
+            return u"{0}{1}{2}".format(
+                Moinwiki.larger_open if font_size == u"120%" else Moinwiki.smaller_open,
+                self.open_children(elem),
+                Moinwiki.larger_close if font_size == u"120%" else Moinwiki.smaller_close)
         if baseline_shift == u'super':
             return u'^{0}^'.format(u''.join(elem.itertext()))
         if baseline_shift == u'sub':
--- a/MoinMoin/converter/rst_in.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/rst_in.py	Sun Mar 03 07:44:25 2013 -0700
@@ -149,7 +149,7 @@
 
     def visit_bullet_list(self, node):
         self.open_moin_page_node(moin_page.list(
-                        attrib={moin_page.item_label_generate: u'unordered'}))
+            attrib={moin_page.item_label_generate: u'unordered'}))
 
     def depart_bullet_list(self, node):
         self.close_moin_page_node()
@@ -245,13 +245,15 @@
         self.close_moin_page_node()
 
     def visit_enumerated_list(self, node):
-        enum_style = {'arabic': None,
-                'loweralpha': u'lower-alpha',
-                'upperalpha': u'upper-alpha',
-                'lowerroman': u'lower-roman',
-                'upperroman': u'upper-roman'}
+        enum_style = {
+            'arabic': None,
+            'loweralpha': u'lower-alpha',
+            'upperalpha': u'upper-alpha',
+            'lowerroman': u'lower-roman',
+            'upperroman': u'upper-roman',
+        }
         new_node = moin_page.list(
-                attrib={moin_page.item_label_generate: u'ordered'})
+            attrib={moin_page.item_label_generate: u'ordered'})
         type = enum_style.get(node['enumtype'], None)
         if type:
             new_node.set(moin_page.list_style_type, type)
@@ -309,7 +311,7 @@
 
     def visit_footnote_reference(self, node):
         self.open_moin_page_node(moin_page.note(
-                            attrib={moin_page.note_class: u'footnote'}))
+            attrib={moin_page.note_class: u'footnote'}))
         new_footnote = moin_page.note_body()
         self.open_moin_page_node(new_footnote)
         self.footnotes[node.children[-1]] = new_footnote
@@ -400,9 +402,9 @@
             for name, value in named_args:
                 args.append(moin_page.argument(attrib={moin_page.name: name}, children=[value]))
             arguments = moin_page.arguments(children=args)
-            self.open_moin_page_node(moin_page.part(children=[arguments],
-                                                    attrib={moin_page.content_type:
-                                                                "x-moin/format;name={0}".format(parser.split(' ')[0])}))
+            self.open_moin_page_node(moin_page.part(
+                children=[arguments],
+                attrib={moin_page.content_type: "x-moin/format;name={0}".format(parser.split(' ')[0])}))
         else:
             self.open_moin_page_node(moin_page.blockcode())
 
@@ -444,9 +446,7 @@
             arguments = refuri[2:-2].split(u'(')[1][:-1].split(u',')
             self.open_moin_page_node(
                 moin_page.part(
-                    attrib={
-                        moin_page.content_type:
-                            "x-moin/macro;name={0}".format(macro_name)}))
+                    attrib={moin_page.content_type: "x-moin/macro;name={0}".format(macro_name)}))
             if arguments:
                 self.open_moin_page_node(moin_page.arguments())
                 for i in arguments:
@@ -619,7 +619,7 @@
 
 class Writer(writers.Writer):
 
-    supported = ('moin-x-document')
+    supported = ('moin-x-document', )
     config_section = 'MoinMoin writer'
     config_section_dependencies = ('writers', )
     output = None
@@ -699,8 +699,7 @@
     # reference hack (`<<SomeMacro>>`_). This however simply adds a node to the
     # document tree which is a reference, but through a much better user
     # interface.
-    def macro(self, name, arguments, options, content, lineno,
-                content_offset, block_text, state, state_machine):
+    def macro(self, name, arguments, options, content, lineno, content_offset, block_text, state, state_machine):
         # content contains macro to be called
         if len(content):
             # Allow either with or without brackets
@@ -718,8 +717,7 @@
     macro.required_arguments = 1
     macro.optional_arguments = 0
 
-    def table_of_content(self, name, arguments, options, content, lineno,
-                            content_offset, block_text, state, state_machine):
+    def table_of_content(self, name, arguments, options, content, lineno, content_offset, block_text, state, state_machine):
         text = ''
         for i in content:
             m = re.search(r':(\w+): (\w+)', i)
@@ -736,8 +734,7 @@
     table_of_content.required_arguments = 1
     table_of_content.optional_arguments = 0
 
-    def parser(self, name, arguments, options, content, lineo,
-                content_offset, block_text, state, state_machine):
+    def parser(self, name, arguments, options, content, lineo, content_offset, block_text, state, state_machine):
         block = literal_block()
         block['parser'] = content[0]
         block.children = [nodes.Text(u"\n".join(content[1:]))]
@@ -763,7 +760,7 @@
             try:
                 docutils_tree = core.publish_doctree(source=input)
             except utils.SystemMessage as inst:
-                string_numb = re.match(re.compile(r'<string>\:([0-9]*)\:\s*\(.*?\)\s*(.*)',
+                string_numb = re.match(re.compile(r'<string>:([0-9]*):\s*\(.*?\)\s*(.*)',
                                                   re.X | re.U | re.M | re.S), str(inst))
                 if string_numb:
                     str_num = string_numb.group(1)
--- a/MoinMoin/converter/rst_out.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/converter/rst_out.py	Sun Mar 03 07:44:25 2013 -0700
@@ -66,8 +66,7 @@
         self.table.append(row)
         if self.i > 0:
             if len(self.table[-2]) > self.j:
-                self.add_cell(self.table[-2][self.j][0],
-                                self.table[-2][self.j][1] - 1, Cell(''))
+                self.add_cell(self.table[-2][self.j][0], self.table[-2][self.j][1] - 1, Cell(''))
         return row
 
     def end_row(self):
@@ -97,8 +96,7 @@
         self.j += cs
         if self.i > 0:
             if len(self.table[-2]) > self.j:
-                self.add_cell(self.table[-2][self.j][0],
-                                self.table[-2][self.j][1] - 1, Cell(''))
+                self.add_cell(self.table[-2][self.j][0], self.table[-2][self.j][1] - 1, Cell(''))
         return
 
     def height(self):
@@ -233,7 +231,7 @@
         (u'ordered', u'upper-roman'): u'I.',
         (u'unordered', None): u'*',
         (None, None): u' ',
-        }
+    }
 
 
 class Converter(object):
@@ -245,29 +243,31 @@
 
     supported_tag = {
         'moinpage': (
-                'a',
-                'blockcode',
-                'break_line',
-                'code',
-                'div',
-                'emphasis',
-                'h',
-                'list',
-                'list_item',
-                'list_item_label',
-                'list_item_body',
-                'p',
-                'page',
-                'separator',
-                'span',
-                'strong',
-                'object',
-                'table',
-                'table_header',
-                'teble_footer',
-                'table_body',
-                'table_row',
-                'table_cell')}
+            'a',
+            'blockcode',
+            'break_line',
+            'code',
+            'div',
+            'emphasis',
+            'h',
+            'list',
+            'list_item',
+            'list_item_label',
+            'list_item_body',
+            'p',
+            'page',
+            'separator',
+            'span',
+            'strong',
+            'object',
+            'table',
+            'table_header',
+            'teble_footer',
+            'table_body',
+            'table_row',
+            'table_cell',
+        )
+    }
 
     @classmethod
     def factory(cls, input, output, **kw):
@@ -334,13 +334,13 @@
                         childrens_output.append(u'\n\n')
                 elif self.status[-1] == "list":
                     child =\
-                        re.sub(r"\n(.)", lambda m: u"\n{0}{1}".format(u' ' *
-                            (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), child)
+                        re.sub(r"\n(.)", lambda m: u"\n{0}{1}".format(
+                            u' ' * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), child)
                     if self.last_closed == "p":
-                        childrens_output.append(u'\n'
-                                + u' '
-                                * (len(''.join(self.list_item_labels))
-                                   + len(self.list_item_labels)))
+                        childrens_output.append(
+                            u'\n' + u' '
+                            * (len(''.join(self.list_item_labels)) +
+                               len(self.list_item_labels)))
                 elif self.status[-1] == "text":
                     if self.last_closed == "p":
                         childrens_output.append(self.define_references())
@@ -348,7 +348,7 @@
                 elif self.status[-2] == "list":
                     child =\
                         re.sub(r"\n(.)", lambda m: u"\n{0}{1}".format(u' ' *
-                            (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), child)
+                               (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), child)
                 childrens_output.append(child)
                 self.last_closed = 'text'
         self.delete_newlines = delete_newlines
@@ -386,7 +386,7 @@
                 return u"`{0}`__".format(text)
             else:
                 while text in [t for (t, h) in self.all_used_references]:
-                    text = text + u"~"
+                    text += u"~"
         self.used_references.append((text, href))
         self.all_used_references.append((text, href))
         #self.objects.append("\n\n.. _%s: %s\n\n" % (text, href))
@@ -396,8 +396,7 @@
         text = u''.join(elem.itertext())
         max_subpage_lvl = 3
         text = text.replace(u'\n', u'\n  '
-                                  + u' ' * (len(u''.join(self.list_item_labels))
-                                         + len(self.list_item_labels)))
+                            + u' ' * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)))
 
         if self.list_level >= 0:
             self.delete_newlines = True
@@ -410,8 +409,8 @@
                 if i:
                     self.output[-1] = self.output[-1][:i]
             """
-        return u"::\n\n  {0}{1}\n\n".format(u' ' *
-                    (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), text)
+        return u"::\n\n  {0}{1}\n\n".format(
+            u' ' * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), text)
 
     def open_moinpage_code(self, elem):
         ret = u"{0}{1}{2}".format(ReST.monospace, u''.join(elem.itertext()), ReST.monospace)
@@ -446,8 +445,7 @@
         return ReST.linebreak
 
     def open_moinpage_list(self, elem):
-        label_type = (elem.get(moin_page.item_label_generate, None),
-                        elem.get(moin_page.list_style_type, None))
+        label_type = elem.get(moin_page.item_label_generate, None), elem.get(moin_page.list_style_type, None)
         self.list_item_labels.append(
             ReST.list_type.get(label_type, u' '))
         self.list_level += 1
@@ -488,7 +486,7 @@
         if self.last_closed:
             ret = u'\n'
         ret += (u' ' * (len(u''.join(self.list_item_labels[:-1]))
-                       + len(self.list_item_labels[:-1]))
+                        + len(self.list_item_labels[:-1]))
                 + self.list_item_label)
         if self.list_item_labels[-1] in [u'1.', u'i.', u'I.', u'a.', u'A.']:
             self.list_item_labels[-1] = u'#.'
@@ -540,13 +538,13 @@
                 ret = self.open_children(elem) + ReST.p + set
         elif self.status[-1] == 'table':
             self.status.append('p')
-            if self.last_closed and self.last_closed != 'table_cell'\
-                                and self.last_closed != 'table_row'\
-                                and self.last_closed != 'table_header'\
-                                and self.last_closed != 'table_footer'\
-                                and self.last_closed != 'table_body'\
-                                and self.last_closed != 'line_break':
-          #                      and self.last_closed != 'p':
+            if self.last_closed and self.last_closed != 'table_cell' \
+                and self.last_closed != 'table_row' \
+                and self.last_closed != 'table_header' \
+                and self.last_closed != 'table_footer' \
+                and self.last_closed != 'table_body' \
+                and self.last_closed != 'line_break':
+                # and self.last_closed != 'p':
                 ret = ReST.linebreak + self.open_children(elem)
             elif self.last_closed == 'p' or self.last_closed == 'line_break':
                 ret = self.open_children(elem)
@@ -556,17 +554,17 @@
             self.status.append('p')
             if self.last_closed and self.last_closed == 'list_item_label':
                 ret = self.open_children(elem)
-            elif self.last_closed and self.last_closed != 'list_item'\
-                                and self.last_closed != 'list_item_header'\
-                                and self.last_closed != 'list_item_footer'\
-                                and self.last_closed != 'p':
+            elif self.last_closed and self.last_closed != 'list_item' \
+                and self.last_closed != 'list_item_header' \
+                and self.last_closed != 'list_item_footer' \
+                and self.last_closed != 'p':
                 ret = (ReST.linebreak + u' '
                                         * (len(u''.join(self.list_item_labels))
                                            + len(self.list_item_labels)) + self.open_children(elem))
             elif self.last_closed and self.last_closed == 'p':
                 #return ReST.p +\
                 ret = (u"\n" + u' ' * (len(u''.join(self.list_item_labels))
-                                    + len(self.list_item_labels)) + self.open_children(elem))
+                                       + len(self.list_item_labels)) + self.open_children(elem))
             else:
                 ret = self.open_children(elem)
             if not self.delete_newlines:
@@ -590,7 +588,7 @@
             if type[0] == u"x-moin/macro":
                 if len(elem) and iter(elem).next().tag.name == "arguments":
                     alt = u"<<{0}({1})>>".format(type[1].split(u'=')[1], u','.join(
-                            [u''.join(c.itertext()) for c in iter(elem).next() if c.tag.name == "argument"]))
+                        [u''.join(c.itertext()) for c in iter(elem).next() if c.tag.name == "argument"]))
                 else:
                     alt = u"<<{0}()>>".format(type[1].split(u'=')[1])
 
@@ -660,8 +658,8 @@
         table = repr(self.tablec)
         if self.status[-1] == "list":
             table =\
-                re.sub(r"\n(.)", lambda m: u"\n{0}{1}".format(u' ' *
-                        (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), u"\n" + table)
+                re.sub(r"\n(.)", lambda m: u"\n{0}{1}".format(
+                    u' ' * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels)), m.group(1)), u"\n" + table)
             return table + ReST.p
         return table + ReST.linebreak
 
@@ -689,11 +687,9 @@
 
     def open_moinpage_table_row(self, elem):
         self.table_rowclass = elem.attrib.get('class', u'')
-        self.table_rowclass = u' '.join([s for s in [self.table_rowsclass,
-                                                    self.table_rowclass] if s])
+        self.table_rowclass = u' '.join([s for s in [self.table_rowsclass, self.table_rowclass] if s])
         self.table_rowstyle = elem.attrib.get('style', u'')
-        self.table_rowstyle = u' '.join([s for s in [self.table_rowsstyle,
-                                                    self.table_rowstyle] if s])
+        self.table_rowstyle = u' '.join([s for s in [self.table_rowsstyle, self.table_rowstyle] if s])
         self.table.append([])
         self.tablec.add_row()
         ret = self.open_children(elem)
@@ -705,10 +701,8 @@
     def open_moinpage_table_cell(self, elem):
         table_cellclass = elem.attrib.get('class', u'')
         table_cellstyle = elem.attrib.get('style', u'')
-        number_cols_spanned\
-                = int(elem.get(moin_page.number_cols_spanned, 1))
-        number_rows_spanned\
-                = int(elem.get(moin_page.number_rows_spanned, 1))
+        number_cols_spanned = int(elem.get(moin_page.number_cols_spanned, 1))
+        number_rows_spanned = int(elem.get(moin_page.number_rows_spanned, 1))
 
         attrib = []
 
@@ -735,9 +729,7 @@
 
         attrib = ' '.join(attrib)
         """
-        self.table[-1].append((number_cols_spanned,
-                                number_rows_spanned,
-                                [self.open_children(elem)]))
+        self.table[-1].append((number_cols_spanned, number_rows_spanned, [self.open_children(elem)]))
         cell = self.table[-1][-1]
         self.tablec.add_cell(cell[0], cell[1], Cell(u''.join(cell[2])))
         return u''
@@ -755,12 +747,10 @@
         """
         ret = u''
         self.all_used_references.extend(self.used_references)
-        definitions = [u" " * (len(u''.join(self.list_item_labels))
-                                    + len(self.list_item_labels))
-                                  + u".. _{0}: {1}".format(t, h) for t, h in self.used_references]
-        definitions.extend(u" " * (len(u''.join(self.list_item_labels))
-                                     + len(self.list_item_labels))
-                                  + link for link in self.objects)
+        definitions = [u" " * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels))
+                       + u".. _{0}: {1}".format(t, h) for t, h in self.used_references]
+        definitions.extend(u" " * (len(u''.join(self.list_item_labels)) + len(self.list_item_labels))
+                           + link for link in self.objects)
         definition_block = u"\n\n".join(definitions)
 
         if definitions:
--- a/MoinMoin/datastruct/backends/_tests/test_config_dicts.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/datastruct/backends/_tests/test_config_dicts.py	Sun Mar 03 07:44:25 2013 -0700
@@ -26,4 +26,5 @@
         for result in test_keyiterator:
             assert result in expected
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.config_dicts']
--- a/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/datastruct/backends/_tests/test_wiki_dicts.py	Sun Mar 03 07:44:25 2013 -0700
@@ -13,6 +13,7 @@
 from MoinMoin.datastruct.backends import wiki_dicts
 from MoinMoin.constants.keys import SOMEDICT
 from MoinMoin._tests import become_trusted, update_item
+
 DATA = "This is a dict item."
 
 
@@ -40,4 +41,5 @@
         expected = {u'Two': u'2', u'One': u'1'}
         assert result == expected
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.wiki_dicts']
--- a/MoinMoin/datastruct/backends/_tests/test_wiki_groups.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/datastruct/backends/_tests/test_wiki_groups.py	Sun Mar 03 07:44:25 2013 -0700
@@ -106,4 +106,5 @@
         assert not has_rights_before, 'AnotherUser has no read rights because in the beginning he is not a member of a group item NewGroup'
         assert has_rights_after, 'AnotherUser must have read rights because after appenditem he is member of NewGroup'
 
+
 coverage_modules = ['MoinMoin.datastruct.backends.wiki_groups']
--- a/MoinMoin/forms.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/forms.py	Sun Mar 03 07:44:25 2013 -0700
@@ -12,8 +12,9 @@
 import re
 import datetime
 import json
+from operator import itemgetter
 
-from flatland import (Element, Form, String, Integer, Boolean, Enum, Dict, JoinedString, List, Array,
+from flatland import (Element, Form, String, Integer, Boolean, Enum as BaseEnum, Dict, JoinedString, List, Array,
                       DateTime as _DateTime)
 from flatland.util import class_cloner, Unspecified
 from flatland.validation import Validator, Present, IsEmail, ValueBetween, URLValidator, Converted, ValueAtLeast
@@ -27,6 +28,32 @@
 from MoinMoin.util.forms import FileStorage
 
 
+class Enum(BaseEnum):
+    """
+    An Enum with a convenience class method out_of.
+    """
+    @classmethod
+    def out_of(cls, choice_specs, sort_by=None):
+        """
+        A convenience class method to build Enum with extra data attached to
+        each valid value.
+
+        :param choice_specs: An iterable of tuples. The elements are collected
+                             into the choice_specs property; the tuples' first
+                             elements become the valid values of the Enum. e.g.
+                             for choice_specs = [(v1, ...), (v2, ...), ... ],
+                             the valid values are v1, v2, ...
+
+        :param sort_by: If not None, sort choice_specs by the sort_by'th
+                        element.
+        """
+        if sort_by is not None:
+            choice_specs = sorted(choice_specs, key=itemgetter(sort_by))
+        else:
+            choice_specs = list(choice_specs)
+        return cls.valued(*[e[0] for e in choice_specs]).with_properties(choice_specs=choice_specs)
+
+
 Text = String.with_properties(widget=WIDGET_TEXT)
 
 MultilineText = String.with_properties(widget=WIDGET_MULTILINE_TEXT)
@@ -99,11 +126,11 @@
     def u(self):
         return self.separator.join(child.u for child in self)
 
-Tags = MyJoinedString.of(String).with_properties(widget=WIDGET_TEXT).using(label=L_('Tags'), optional=True,
-                                                            separator=', ', separator_regex=re.compile(r'\s*,\s*'))
+Tags = MyJoinedString.of(String).with_properties(widget=WIDGET_TEXT).using(
+    label=L_('Tags'), optional=True, separator=', ', separator_regex=re.compile(r'\s*,\s*'))
 
-Names = MyJoinedString.of(String).with_properties(widget=WIDGET_TEXT).using(label=L_('Names'), optional=True,
-                                                            separator=', ', separator_regex=re.compile(r'\s*,\s*'))
+Names = MyJoinedString.of(String).with_properties(widget=WIDGET_TEXT).using(
+    label=L_('Names'), optional=True, separator=', ', separator_regex=re.compile(r'\s*,\s*'))
 
 Search = Text.using(default=u'', optional=True).with_properties(widget=WIDGET_SEARCH, placeholder=L_("Search Query"))
 
--- a/MoinMoin/i18n/_tests/test_i18n.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/i18n/_tests/test_i18n.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 from MoinMoin.i18n import _, L_, N_
 
+
 def test_user_attributes():
     test_locale = get_locale()
     assert test_locale == 'en'
@@ -16,6 +17,7 @@
     test_timezone = get_timezone()
     assert test_timezone == 'UTC'
 
+
 def test_text():
     # test for gettext
     result = _('test_text')
--- a/MoinMoin/items/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/items/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -46,14 +46,14 @@
 from MoinMoin.util.clock import timed
 from MoinMoin.forms import RequiredText, OptionalText, JSON, Tags
 from MoinMoin.constants.keys import (
-    NAME, NAME_OLD, NAME_EXACT, WIKINAME, MTIME, SYSITEM_VERSION, ITEMTYPE,
+    NAME, NAME_OLD, NAME_EXACT, WIKINAME, MTIME, ITEMTYPE,
     CONTENTTYPE, SIZE, ACTION, ADDRESS, HOSTNAME, USERID, COMMENT,
     HASH_ALGORITHM, ITEMID, REVID, DATAID, CURRENT, PARENTID
-    )
+)
 from MoinMoin.constants.contenttypes import CHARSET, CONTENTTYPE_NONEXISTENT
 from MoinMoin.constants.itemtypes import (
     ITEMTYPE_NONEXISTENT, ITEMTYPE_USERPROFILE, ITEMTYPE_DEFAULT,
-    )
+)
 
 from .content import content_registry, Content, NonExistentContent, Draw
 
@@ -308,7 +308,6 @@
     def meta_filter(self, meta):
         """ kill metadata entries that we set automatically when saving """
         kill_keys = [  # shall not get copied from old rev to new rev
-            SYSITEM_VERSION,
             NAME_OLD,
             # are automatically implanted when saving
             ITEMID, REVID, DATAID,
@@ -318,7 +317,7 @@
             MTIME,
             ACTION,
             ADDRESS, HOSTNAME, USERID,
-            ]
+        ]
         for key in kill_keys:
             meta.pop(key, None)
         return meta
--- a/MoinMoin/items/_tests/test_Content.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/items/_tests/test_Content.py	Sun Mar 03 07:44:25 2013 -0700
@@ -32,7 +32,7 @@
                 (u'text/plain;charset=utf-8', Text),
                 (u'image/tiff', Image),
                 (u'image/png', TransformableBitmapImage),
-            ]:
+        ]:
             content = Content.create(contenttype)
             assert isinstance(content, ExpectedClass)
 
@@ -64,6 +64,7 @@
         result2 = item1.content.get_templates(contenttype2)
         assert result2 == [item_name3]
 
+
 class TestTarItems(object):
     """
     tests for the container items
@@ -103,6 +104,7 @@
         item = Item.create(item_name, contenttype=u'application/x-tar')
         assert item.content.get_member('example1.txt').read() == filecontent
 
+
 class TestZipMixin(object):
     """ Test for zip-like items """
 
@@ -115,6 +117,7 @@
         with pytest.raises(NotImplementedError):
             item.content.put_member('example1.txt', filecontent, content_length, expected_members=members)
 
+
 class TestTransformableBitmapImage(object):
 
     def test__transform(self):
@@ -146,8 +149,8 @@
             # The assert statement works with both older and newer versions of Werkzeug
             # Probably not an intentional change on the werkzeug side, see issue:
             # https://github.com/mitsuhiko/werkzeug/issues/146
-            assert str(result).startswith('<img src="/+diffraw/image_Item?rev') or \
-                    str(result).startswith('<img src="/%2Bdiffraw/image_Item?rev')
+            assert (str(result).startswith('<img src="/+diffraw/image_Item?rev') or
+                    str(result).startswith('<img src="/%2Bdiffraw/image_Item?rev'))
         except ImportError:
             # no PIL
             pass
@@ -171,6 +174,7 @@
         except ImportError:
             pass
 
+
 class TestText(object):
 
     def test_data_conversion(self):
@@ -254,4 +258,5 @@
         assert u'<pre class="highlight">test_data\n' in result
         assert item2.content.data == ''
 
+
 coverage_modules = ['MoinMoin.items.content']
--- a/MoinMoin/items/_tests/test_Item.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/items/_tests/test_Item.py	Sun Mar 03 07:44:25 2013 -0700
@@ -24,6 +24,7 @@
     return [(IndexEntry(relname, Item.create('/'.join((basename, relname))).meta))
             for relname in relnames]
 
+
 def build_mixed_index(basename, spec):
     """
     Build a list of MixedIndexEntry by hand, useful as a test helper.
@@ -41,10 +42,10 @@
         assert isinstance(item, NonExistent)
         meta, data = item.meta, item.content.data
         assert meta == {
-                ITEMTYPE: ITEMTYPE_NONEXISTENT,
-                CONTENTTYPE: CONTENTTYPE_NONEXISTENT,
-                NAME: u'DoesNotExist',
-                }
+            ITEMTYPE: ITEMTYPE_NONEXISTENT,
+            CONTENTTYPE: CONTENTTYPE_NONEXISTENT,
+            NAME: u'DoesNotExist',
+        }
         assert data == ''
 
     def testCRUD(self):
@@ -65,7 +66,7 @@
         assert saved_data == data
 
         data = rev1_data = data * 10000
-        comment = comment + u' again'
+        comment += u' again'
         # save rev 1
         item._save(meta, data, comment=comment)
         # check save result
@@ -271,17 +272,16 @@
         assert item.content.data == u'another child'
 
     def test_rename_recursion_with_multiple_names_and_children(self):
-        update_item(u'Foo',
-                    {CONTENTTYPE: u'text/x.moin.wiki',
-                         NAME: [u'Other', u'Page', u'Foo']},
-                    u'Parent')
+        update_item(u'Foo', {
+            CONTENTTYPE: u'text/x.moin.wiki',
+            NAME: [u'Other', u'Page', u'Foo'],
+        }, u'Parent')
         update_item(u'Page/Child', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Child of Page')
         update_item(u'Other/Child2', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Child of Other')
-        update_item(u'Another',
-                    {CONTENTTYPE: u'text/x.moin.wiki',
-                     NAME: [u'Another', u'Page/Second']
-                         },
-                    u'Both')
+        update_item(u'Another', {
+            CONTENTTYPE: u'text/x.moin.wiki',
+            NAME: [u'Another', u'Page/Second'],
+        }, u'Both')
         update_item(u'Page/Second/Child', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Child of Second')
         update_item(u'Another/Child', {CONTENTTYPE: u'text/x.moin.wiki'}, u'Child of Another')
 
@@ -353,4 +353,5 @@
         assert item.meta['another_test_key'] == another_meta['another_test_key']
         assert item.content.data == another_data
 
+
 coverage_modules = ['MoinMoin.items']
--- a/MoinMoin/items/content.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/items/content.py	Sun Mar 03 07:44:25 2013 -0700
@@ -66,7 +66,7 @@
 from MoinMoin.constants.contenttypes import (
     GROUP_MARKUP_TEXT, GROUP_OTHER_TEXT, GROUP_IMAGE, GROUP_AUDIO, GROUP_VIDEO,
     GROUP_DRAWING, GROUP_OTHER, CONTENTTYPE_NONEXISTENT, CHARSET
-    )
+)
 from MoinMoin.constants.keys import NAME_EXACT, WIKINAME, CONTENTTYPE, SIZE, TAGS, HASH_ALGORITHM
 
 
@@ -200,8 +200,7 @@
             input_conv = reg.get(Type(self.contenttype), type_moin_document)
             if not input_conv:
                 raise TypeError("We cannot handle the conversion from {0} to the DOM tree".format(self.contenttype))
-            smiley_conv = reg.get(type_moin_document, type_moin_document,
-                    icon='smiley')
+            smiley_conv = reg.get(type_moin_document, type_moin_document, icon='smiley')
 
             # We can process the conversion
             links = Iri(scheme='wiki', authority='', path='/' + self.name)
@@ -964,9 +963,9 @@
 
         # We determine the different namespaces of the output form
         output_namespaces = {
-             docbook.namespace: '',
-             xlink.namespace: 'xlink',
-         }
+            docbook.namespace: '',
+            xlink.namespace: 'xlink',
+        }
 
         # We convert the result into a StringIO object
         # With the appropriate namespace
--- a/MoinMoin/items/ticket.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/items/ticket.py	Sun Mar 03 07:44:25 2013 -0700
@@ -20,7 +20,7 @@
 from MoinMoin.i18n import L_
 from MoinMoin.themes import render_template
 from MoinMoin.forms import (Form, OptionalText, OptionalMultilineText, SmallNatural, Tags,
-                            Reference, BackReference)
+                            Reference, BackReference, SelectSubmit)
 from MoinMoin.storage.middleware.protecting import AccessDenied
 from MoinMoin.constants.keys import ITEMTYPE, CONTENTTYPE, ITEMID, CURRENT
 from MoinMoin.constants.contenttypes import CONTENTTYPE_USER
@@ -66,7 +66,6 @@
     meta = TicketMetaForm
     backrefs = TicketBackRefForm
     message = OptionalMultilineText.using(label=L_("Message")).with_properties(rows=8, cols=80)
-    submit_label = L_("Update ticket")
 
     def _load(self, item):
         meta = item.prepare_meta_for_modify(item.meta)
@@ -76,6 +75,48 @@
             self['backrefs']._load(item)
 
 
+class TicketSubmitForm(TicketForm):
+    submit_label = L_("Submit ticket")
+
+    def _dump(self, item):
+        # initial metadata for Ticket-itemtyped item
+        meta = {
+            ITEMTYPE: item.itemtype,
+            # XXX support other markups
+            CONTENTTYPE: 'text/x.moin.wiki;charset=utf-8',
+            'closed': False,
+        }
+        return meta, message_markup(self['message'].value)
+
+
+class TicketUpdateForm(TicketForm):
+    submit = SelectSubmit.valued('update', 'update_negate_status')
+
+    def _load(self, item):
+        super(TicketUpdateForm, self)._load(item)
+        self['submit'].properties['labels'] = {
+            'update': L_('Update ticket'),
+            'update_negate_status':
+                L_('Update & reopen ticket') if item.meta.get('closed') else
+                L_('Update & close ticket')
+        }
+
+    def _dump(self, item):
+        # Since the metadata form for tickets is an incomplete one, we load the
+        # original meta and update it with those from the metadata editor
+        meta = item.meta_filter(item.prepare_meta_for_modify(item.meta))
+        meta.update(self['meta'].value)
+        if self['submit'].value == 'update_negate_status':
+            meta['closed'] = not meta.get('closed')
+
+        data = item.content.data_storage_to_internal(item.content.data)
+        message = self['message'].value
+        if message:
+            data += message_markup(message)
+
+        return meta, data
+
+
 # XXX Ideally we should generate DOM instead of moin wiki source. But
 # currently this is not very useful, since
 # * DOM cannot be stored directly, it has to be converted to some markup first
@@ -108,39 +149,29 @@
 
     def do_modify(self):
         is_new = isinstance(self.content, NonExistentContent)
+        closed = self.meta.get('closed')
+
+        Form = TicketSubmitForm if is_new else TicketUpdateForm
 
         if request.method in ['GET', 'HEAD']:
-            form = TicketForm.from_item(self)
+            form = Form.from_item(self)
         elif request.method == 'POST':
-            form = TicketForm.from_request(request)
+            form = Form.from_request(request)
             if form.validate():
-                meta = form['meta'].value
-                meta.update({
-                    ITEMTYPE: self.itemtype,
-                    # XXX support other markups
-                    CONTENTTYPE: 'text/x.moin.wiki;charset=utf-8',
-                })
-
-                data = u'' if is_new else self.content.data_storage_to_internal(self.content.data)
-                message = form['message'].value
-                if message:
-                    data += message_markup(message)
-
+                meta, data = form._dump(self)
                 try:
                     self.modify(meta, data)
                 except AccessDenied:
                     abort(403)
                 else:
                     return redirect(url_for('.show_item', item_name=self.name))
-        if is_new:
-            # XXX suppress the "foo doesn't exist. Create it?" dummy content
-            data_rendered = None
-            form.submit_label = L_('Submit ticket')
-        else:
-            data_rendered = Markup(self.content._render_data())
+
+        # XXX When creating new item, suppress the "foo doesn't exist. Create it?" dummy content
+        data_rendered = None if is_new else Markup(self.content._render_data())
 
         return render_template(self.modify_template,
                                is_new=is_new,
+                               closed=closed,
                                item_name=self.name,
                                data_rendered=data_rendered,
                                form=form,
--- a/MoinMoin/macro/Date.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/Date.py	Sun Mar 03 07:44:25 2013 -0700
@@ -24,7 +24,7 @@
         :returns: UNIX timestamp (UTC)
         """
         if (len(args) >= 19 and args[4] == '-' and args[7] == '-' and
-              args[10] == 'T' and args[13] == ':' and args[16] == ':'):
+            args[10] == 'T' and args[13] == ':' and args[16] == ':'):
             # we ignore any time zone offsets here, assume UTC,
             # and accept (and ignore) any trailing stuff
             try:
--- a/MoinMoin/macro/_tests/test_Anchor.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_Anchor.py	Sun Mar 03 07:44:25 2013 -0700
@@ -6,8 +6,10 @@
 """
 
 import pytest
+
 from MoinMoin.macro.Anchor import *
 
+
 def test_Macro():
     macro_obj = Macro()
     with pytest.raises(ValueError):
--- a/MoinMoin/macro/_tests/test_Date.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_Date.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,10 +8,11 @@
 import time
 from datetime import datetime
 
+import pytest
 from flask.ext.babel import format_date, format_datetime
 
 from MoinMoin.macro.Date import MacroDateTimeBase, Macro
-import pytest
+
 
 class TestMacroDateTimeBase(object):
     def test_parse_time(self):
@@ -27,6 +28,7 @@
             # things after next 10,000 years can't be predicted
             MacroDateTimeBase_obj.parse_time('12011-08-07T11:11:11')
 
+
 class TestMacro(object):
     def test_macro(self):
         macro_obj = Macro()
--- a/MoinMoin/macro/_tests/test_DateTime.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_DateTime.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,8 +8,10 @@
 import time
 from datetime import datetime
 
+import pytest
+
 from MoinMoin.macro.DateTime import *
-import pytest
+
 
 def test_Macro():
     """Test: DateTime.Macro """
--- a/MoinMoin/macro/_tests/test_GetText.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_GetText.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,6 +8,7 @@
 from MoinMoin.converter._args import Arguments
 from MoinMoin.macro.GetText import *
 
+
 def test_Macro():
     """ test for Macro.macro """
     macro_obj = Macro()
--- a/MoinMoin/macro/_tests/test_GetVal.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_GetVal.py	Sun Mar 03 07:44:25 2013 -0700
@@ -5,6 +5,7 @@
 Test for macro.GetVal
 """
 
+import pytest
 from flask import g as flaskg
 
 from MoinMoin.macro.GetVal import *
@@ -12,9 +13,10 @@
 from MoinMoin._tests import become_trusted, update_item
 from MoinMoin.conftest import init_test_app, deinit_test_app
 from MoinMoin._tests import wikiconfig
-import pytest
+
 DATA = "This is a dict item."
 
+
 class TestMacro(object):
     """ Test: GetVal.Macro """
 
--- a/MoinMoin/macro/_tests/test_Verbatim.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test_Verbatim.py	Sun Mar 03 07:44:25 2013 -0700
@@ -7,6 +7,7 @@
 
 from MoinMoin.macro.Verbatim import *
 
+
 def test_Macro():
     macro_obj = Macro()
     result = macro_obj.macro(u'test_text')
--- a/MoinMoin/macro/_tests/test__base.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/macro/_tests/test__base.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,6 +8,7 @@
 import pytest
 from MoinMoin.macro._base import *
 
+
 class TestMacroBase(object):
     """ Test for Macro base and related classes """
 
--- a/MoinMoin/mail/_tests/test_sendmail.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/mail/_tests/test_sendmail.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 from email.Charset import Charset, QP
 from email.Header import Header
+
 from MoinMoin.mail import sendmail
 from MoinMoin.constants.contenttypes import CHARSET
 
@@ -34,13 +35,14 @@
          'FirstnameLastname@example.net'),
         ('first.last@example.com', 'first.last@example.com'),
         ('first . last @ example . com', 'first.last@example.com'),
-        )
+    )
 
     def testDecodeSpamSafeMail(self):
         """mail.sendmail: decoding spam safe mail"""
         for coded, expected in self._tests:
             assert sendmail.decodeSpamSafeEmail(coded) == expected
 
+
 class TestencodeSpamSafeEmail(object):
     """mail.sendmail: testing spam safe mail"""
 
@@ -54,7 +56,7 @@
          'firstname DOT lastname AT example DOT net'),
         ('F.Lastname@example.net',
          'f DOT lastname AT example DOT net'),
-        )
+    )
 
     def testEncodeSpamSafeMail(self):
         """mail.sendmail: encoding mail address to spam safe mail"""
@@ -67,6 +69,7 @@
             expected = expected.replace(' AT ', ' AT SYCTE ')
             assert sendmail.encodeSpamSafeEmail(coded, 'SYCTE') == expected
 
+
 class TestEncodeAddress(object):
     """ Address encoding tests
 
@@ -127,4 +130,5 @@
         expected = str(address)
         assert sendmail.encodeAddress(address, self.charset) == expected
 
+
 coverage_modules = ['MoinMoin.mail.sendmail']
--- a/MoinMoin/mail/sendmail.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/mail/sendmail.py	Sun Mar 03 07:44:25 2013 -0700
@@ -39,7 +39,7 @@
     :returns: encoded address
     """
     assert isinstance(address, unicode)
-    composite = re.compile(r'(?P<phrase>.*?)(?P<blanks>\s*)\<(?P<addr>.*)\>', re.UNICODE)
+    composite = re.compile(r'(?P<phrase>.*?)(?P<blanks>\s*)<(?P<addr>.*)>', re.UNICODE)
     match = composite.match(address)
     if match:
         phrase = match.group('phrase')
@@ -96,7 +96,7 @@
     logging.debug("send mail, to: {0!r}".format(to))
 
     if not to and not cc and not bcc:
-        return (1, _("No recipients, nothing to do"))
+        return 1, _("No recipients, nothing to do")
 
     subject = subject.encode(CHARSET)
 
@@ -167,12 +167,12 @@
                     pass
         except smtplib.SMTPException as e:
             logging.exception("smtp mail failed with an exception.")
-            return (0, str(e))
+            return 0, str(e)
         except (os.error, socket.error) as e:
             logging.exception("smtp mail failed with an exception.")
             return (0, _("Connection to mailserver '%(server)s' failed: %(reason)s",
-                server=cfg.mail_smarthost,
-                reason=str(e)
+                    server=cfg.mail_smarthost,
+                    reason=str(e)
             ))
     else:
         try:
@@ -183,13 +183,13 @@
             sendmail_status = sendmailp.close()
             if sendmail_status:
                 logging.error("sendmail failed with status: {0!s}".format(sendmail_status))
-                return (0, str(sendmail_status))
+                return 0, str(sendmail_status)
         except:
             logging.exception("sendmail failed with an exception.")
-            return (0, _("Mail not sent"))
+            return 0, _("Mail not sent")
 
     logging.debug("Mail sent successfully")
-    return (1, _("Mail sent successfully"))
+    return 1, _("Mail sent successfully")
 
 
 def encodeSpamSafeEmail(email_address, obfuscation_text=''):
--- a/MoinMoin/script/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/script/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -48,8 +48,6 @@
     from MoinMoin.script.maint import modify_item
     manager.add_command("item-get", modify_item.GetItem())
     manager.add_command("item-put", modify_item.PutItem())
-    from MoinMoin.script.maint.modified_systemitems import Modified_SystemItems
-    manager.add_command("maint-modified-systemitems", Modified_SystemItems())
     from MoinMoin.script.migration.moin19.import19 import ImportMoin19
     manager.add_command("import19", ImportMoin19())
 
--- a/MoinMoin/script/account/resetpw.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/script/account/resetpw.py	Sun Mar 03 07:44:25 2013 -0700
@@ -50,11 +50,11 @@
         Option('--password', '-p', required=False, dest='password', type=unicode,
                help='New password for this account.'),
         Option('--all-users', '-a', required=False, dest='all_users', action='store_true', default=False,
-            help='Reset password for ALL users.'),
+               help='Reset password for ALL users.'),
         Option('--notify', '-N', required=False, dest='notify', action='store_true', default=False,
-            help='Notify user(s), send them an E-Mail with a password reset link.'),
+               help='Notify user(s), send them an E-Mail with a password reset link.'),
         Option('--verbose', '-v', required=False, dest='verbose', action='store_true', default=False,
-            help='Verbose operation'),
+               help='Verbose operation'),
     )
 
     def run(self, name, uid, password, all_users, notify, verbose):
--- a/MoinMoin/script/maint/index.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/script/maint/index.py	Sun Mar 03 07:44:25 2013 -0700
@@ -20,7 +20,7 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
     ]
 
     def run(self, tmp):
@@ -32,7 +32,7 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
     ]
 
     def run(self, tmp):
@@ -44,11 +44,11 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
         Option('--procs', '-p', required=False, dest='procs', type=int, default=1,
-            help='Number of processors the writer will use.'),
+               help='Number of processors the writer will use.'),
         Option('--limitmb', '-l', required=False, dest='limitmb', type=int, default=10,
-            help='Maximum memory (in megabytes) each index-writer will use for the indexing pool.'),
+               help='Maximum memory (in megabytes) each index-writer will use for the indexing pool.'),
     ]
 
     def run(self, tmp, procs, limitmb):
@@ -60,7 +60,7 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
     ]
 
     def run(self, tmp):
@@ -82,7 +82,7 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
     ]
 
     def run(self, tmp):
@@ -94,7 +94,7 @@
 
     option_list = [
         Option('--tmp', action="store_true", required=False, dest='tmp', default=False,
-            help='use the temporary location.'),
+               help='use the temporary location.'),
     ]
 
     def run(self, tmp):
--- a/MoinMoin/script/maint/modified_systemitems.py	Sat Mar 02 14:09:49 2013 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-# Copyright: 2004 Nir Soffer <nirs@freeshell.org>
-# Copyright: 2008,2011 MoinMoin:ThomasWaldmann
-# Copyright: 2011 MoinMoin:ReimarBauer
-# License: GNU GPL v2 (or any later version), see LICENSE.txt for details.
-
-"""
-    MoinMoin - list system items that has been edited in this wiki.
-
-"""
-
-
-from flask import current_app as app
-from flask.ext.script import Command
-
-from MoinMoin.constants.keys import IS_SYSITEM, SYSITEM_VERSION
-
-
-class Modified_SystemItems(Command):
-    description = 'This command can be used to list system items that has been edited in this wiki.'
-
-    def run(self):
-        edited_sys_items = []
-        for current_rev in app.storage.documents():
-            is_sysitem = current_rev.meta.get(IS_SYSITEM, False)
-            if is_sysitem:
-                version = current_rev.meta.get(SYSITEM_VERSION)
-                if version is None:
-                    # if we don't have the version, it was edited:
-                    edited_sys_items.append(item.name)
-
-        # Format as numbered list, sorted by item name
-        edited_sys_items.sort()
-        if edited_sys_items:
-            print "Edited system items:"
-            for item_name in edited_sys_items:
-                print item_name
-        else:
-            print "Not any modified system items found!"
--- a/MoinMoin/script/maint/modify_item.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/script/maint/modify_item.py	Sun Mar 03 07:44:25 2013 -0700
@@ -18,13 +18,13 @@
     description = 'Get an item revision from the wiki.'
     option_list = (
         Option('--name', '-n', dest='name', type=unicode, required=True,
-            help='Name of the item to get.'),
+               help='Name of the item to get.'),
         Option('--revid', '-r', dest='revid', type=unicode, required=False, default=CURRENT,
-            help='Revision ID of the revision to get (default: current rev).'),
+               help='Revision ID of the revision to get (default: current rev).'),
         Option('--meta', '-m', dest='meta_file', type=unicode, required=True,
-            help='Filename of file to create for the metadata.'),
+               help='Filename of file to create for the metadata.'),
         Option('--data', '-d', dest='data_file', type=unicode, required=True,
-            help='Filename of file to create for the data.'),
+               help='Filename of file to create for the data.'),
     )
 
     def run(self, name, meta_file, data_file, revid):
@@ -42,11 +42,11 @@
     description = 'Put an item revision into the wiki.'
     option_list = (
         Option('--meta', '-m', dest='meta_file', type=unicode, required=True,
-            help='Filename of file to read as metadata.'),
+               help='Filename of file to read as metadata.'),
         Option('--data', '-d', dest='data_file', type=unicode, required=True,
-            help='Filename of file to read as data.'),
+               help='Filename of file to read as data.'),
         Option('--overwrite', '-o', action='store_true', dest='overwrite', default=False,
-            help='If given, overwrite existing revisions, if requested.'),
+               help='If given, overwrite existing revisions, if requested.'),
     )
 
     def run(self, meta_file, data_file, overwrite):
--- a/MoinMoin/script/maint/moinshell.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/script/maint/moinshell.py	Sun Mar 03 07:44:25 2013 -0700
@@ -39,12 +39,7 @@
         self.make_context = make_context
 
     def get_options(self):
-
-        return (
-                Option('--no-ipython',
-                       action="store_true",
-                       dest='no_ipython',
-                       default=not self.use_ipython), )
+        return (Option('--no-ipython', action="store_true", dest='no_ipython', default=not self.use_ipython), )
 
     def get_context(self):
         """
--- a/MoinMoin/search/_tests/test_analyzers.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/search/_tests/test_analyzers.py	Sun Mar 03 07:44:25 2013 -0700
@@ -29,94 +29,80 @@
         # (query, tokens)
         (u'-MinusGuy:read', [u'MinusGuy:-read']),
         (u'+PlusGuy:read', [u'PlusGuy:+read']),
-        (u'Admin3:read,write,admin',
-            [
-             u'Admin3:+read',
-             u'Admin3:-pubread',
-             u'Admin3:+write',
-             u'Admin3:-create',
-             u'Admin3:+admin',
-             u'Admin3:-destroy',
-            ]
-        ),
-        (u'Admin1,Admin2:read,write,admin',
-            [
-             u'Admin1:+read',
-             u'Admin1:-pubread',
-             u'Admin1:+write',
-             u'Admin1:-create',
-             u'Admin1:+admin',
-             u'Admin1:-destroy',
-             u'Admin2:+read',
-             u'Admin2:-pubread',
-             u'Admin2:+write',
-             u'Admin2:-create',
-             u'Admin2:+admin',
-             u'Admin2:-destroy',
-            ]
-        ),
-        (u'JoeDoe:pubread,write',
-            [
-             u'JoeDoe:-read',
-             u'JoeDoe:+pubread',
-             u'JoeDoe:+write',
-             u'JoeDoe:-create',
-             u'JoeDoe:-admin',
-             u'JoeDoe:-destroy',
-            ]
-        ),
-        (u'name with spaces,another one:read,write',
-            [
-             u'name with spaces:+read',
-             u'name with spaces:-pubread',
-             u'name with spaces:+write',
-             u'name with spaces:-create',
-             u'name with spaces:-admin',
-             u'name with spaces:-destroy',
-             u'another one:+read',
-             u'another one:-pubread',
-             u'another one:+write',
-             u'another one:-create',
-             u'another one:-admin',
-             u'another one:-destroy',
-            ]
-        ),
-        (u'CamelCase,extended name:read,write',
-            [
-             u'CamelCase:+read',
-             u'CamelCase:-pubread',
-             u'CamelCase:+write',
-             u'CamelCase:-create',
-             u'CamelCase:-admin',
-             u'CamelCase:-destroy',
-             u'extended name:+read',
-             u'extended name:-pubread',
-             u'extended name:+write',
-             u'extended name:-create',
-             u'extended name:-admin',
-             u'extended name:-destroy',
-            ]
-        ),
-        (u'BadGuy:',
-            [
-             u'BadGuy:-read',
-             u'BadGuy:-pubread',
-             u'BadGuy:-write',
-             u'BadGuy:-create',
-             u'BadGuy:-admin',
-             u'BadGuy:-destroy',
-            ]
-        ),
-        (u'All:read',
-            [
-             u'All:+read',
-             u'All:-pubread',
-             u'All:-write',
-             u'All:-create',
-             u'All:-admin',
-             u'All:-destroy',
-            ]
-        )
+        (u'Admin3:read,write,admin', [
+            u'Admin3:+read',
+            u'Admin3:-pubread',
+            u'Admin3:+write',
+            u'Admin3:-create',
+            u'Admin3:+admin',
+            u'Admin3:-destroy',
+        ]),
+        (u'Admin1,Admin2:read,write,admin', [
+            u'Admin1:+read',
+            u'Admin1:-pubread',
+            u'Admin1:+write',
+            u'Admin1:-create',
+            u'Admin1:+admin',
+            u'Admin1:-destroy',
+            u'Admin2:+read',
+            u'Admin2:-pubread',
+            u'Admin2:+write',
+            u'Admin2:-create',
+            u'Admin2:+admin',
+            u'Admin2:-destroy',
+        ]),
+        (u'JoeDoe:pubread,write', [
+            u'JoeDoe:-read',
+            u'JoeDoe:+pubread',
+            u'JoeDoe:+write',
+            u'JoeDoe:-create',
+            u'JoeDoe:-admin',
+            u'JoeDoe:-destroy',
+        ]),
+        (u'name with spaces,another one:read,write', [
+            u'name with spaces:+read',
+            u'name with spaces:-pubread',
+            u'name with spaces:+write',
+            u'name with spaces:-create',
+            u'name with spaces:-admin',
+            u'name with spaces:-destroy',
+            u'another one:+read',
+            u'another one:-pubread',
+            u'another one:+write',
+            u'another one:-create',
+            u'another one:-admin',
+            u'another one:-destroy',
+        ]),
+        (u'CamelCase,extended name:read,write', [
+            u'CamelCase:+read',
+            u'CamelCase:-pubread',
+            u'CamelCase:+write',
+            u'CamelCase:-create',
+            u'CamelCase:-admin',
+            u'CamelCase:-destroy',
+            u'extended name:+read',
+            u'extended name:-pubread',
+            u'extended name:+write',
+            u'extended name:-create',
+            u'extended name:-admin',
+            u'extended name:-destroy',
+        ]),
+        (u'BadGuy:', [
+            u'BadGuy:-read',
+            u'BadGuy:-pubread',
+            u'BadGuy:-write',
+            u'BadGuy:-create',
+            u'BadGuy:-admin',
+            u'BadGuy:-destroy',
+        ]),
+        (u'All:read', [
+            u'All:+read',
+            u'All:-pubread',
+            u'All:-write',
+            u'All:-create',
+            u'All:-admin',
+            u'All:-destroy',
+        ])
     ]
 
     def make_tokenizer(self):
@@ -127,22 +113,20 @@
     """ analyzers: test content type analyzer """
 
     test_cases_query = [
-                  # (query, tokens)
-                  (u'text/plain',
-                   [u'text/plain', u'text', u'plain']),
-                  (u'text/plain;charset=utf-8',
-                   [u'text/plain;charset=utf-8', u'text', u'plain', u'charset=utf-8']),
-                  (u'text/html;value1=foo;value2=bar',
-                   [u'text/html;value1=foo;value2=bar', u'text', u'html', u'value1=foo', u'value2=bar'],
-                  ),
-                  # we normalize, sort the params:
-                  (u'text/html;value2=bar;value1=foo',
-                   [u'text/html;value1=foo;value2=bar', u'text', u'html', u'value1=foo', u'value2=bar'],
-                  ),
-                  # later values for same key overwrite earlier ones:
-                  (u'text/html;value1=foo;value1=bar',
-                   [u'text/html;value1=bar', u'text', u'html', u'value1=bar'])
-                 ]
+        # (query, tokens)
+        (u'text/plain',
+         [u'text/plain', u'text', u'plain']),
+        (u'text/plain;charset=utf-8',
+         [u'text/plain;charset=utf-8', u'text', u'plain', u'charset=utf-8']),
+        (u'text/html;value1=foo;value2=bar',
+         [u'text/html;value1=foo;value2=bar', u'text', u'html', u'value1=foo', u'value2=bar']),
+        # we normalize, sort the params:
+        (u'text/html;value2=bar;value1=foo',
+         [u'text/html;value1=foo;value2=bar', u'text', u'html', u'value1=foo', u'value2=bar']),
+        # later values for same key overwrite earlier ones:
+        (u'text/html;value1=foo;value1=bar',
+         [u'text/html;value1=bar', u'text', u'html', u'value1=bar'])
+    ]
 
     def make_tokenizer(self):
         return MimeTokenizer()
@@ -152,19 +136,20 @@
     """ analyzers: test item_name analyzer """
 
     test_cases_query = [
-                  # (query, tokens)
-                  (u'wifi', [u'wifi']),
-                  (u'WiFi', [u'wi', u'fi']),
-                  (u'Wi-Fi', [u'wi', u'fi']),
-                  (u'some item name', [u'some', u'item', u'name']),
-                  (u'SomeItem/SubItem', [u'some', u'item', u'sub', u'item']),
-                  (u'GSOC2011', [u'gsoc', u'2011'])
-                 ]
+        # (query, tokens)
+        (u'wifi', [u'wifi']),
+        (u'WiFi', [u'wi', u'fi']),
+        (u'Wi-Fi', [u'wi', u'fi']),
+        (u'some item name', [u'some', u'item', u'name']),
+        (u'SomeItem/SubItem', [u'some', u'item', u'sub', u'item']),
+        (u'GSOC2011', [u'gsoc', u'2011'])
+    ]
 
-    test_cases_index = [(u'some item name', [u'some', u'item', u'name']),
-                        (u'SomeItem/SubItem', [u'some', u'item', u'sub', u'item', u'someitemsubitem']),
-                        (u'GSOC2011', [u'gsoc', u'2011'])
-                       ]
+    test_cases_index = [
+        (u'some item name', [u'some', u'item', u'name']),
+        (u'SomeItem/SubItem', [u'some', u'item', u'sub', u'item', u'someitemsubitem']),
+        (u'GSOC2011', [u'gsoc', u'2011'])
+    ]
 
     def make_tokenizer(self):
         return item_name_analyzer()
--- a/MoinMoin/security/_tests/test_security.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/security/_tests/test_security.py	Sun Mar 03 07:44:25 2013 -0700
@@ -224,7 +224,7 @@
             "CamelCase,extended name:read,write  "
             "BadGuy:  "
             "All:read  "
-            ]
+        ]
         acl = AccessControlList(acl_rights, valid=app.cfg.acl_rights_contents)
 
         # Should apply these rights:
@@ -250,7 +250,7 @@
             # with ACL modifiers
             ('MinusGuy', ()),
             ('PlusGuy', ('read', )),
-            )
+        )
 
         # Check rights
         for user, may in users:
@@ -267,6 +267,7 @@
 class TestGroupACL(object):
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         def groups(cfg):
             groups = {
@@ -276,7 +277,7 @@
                 # the group NAME, but not in the group members. This makes
                 # sure that a bug that erroneously checked "in groupname" (instead
                 # of "in groupmembers") does not reappear.
-                u'AllGroup': frozenset([]), # note: intended misnomer
+                u'AllGroup': frozenset([]),  # note: intended misnomer
             }
             return ConfigGroups(groups)
 
@@ -286,7 +287,7 @@
         acl_rights = [
             "PGroup,AllGroup:read,write,admin "
             "AGroup:read "
-            ]
+        ]
         acl = AccessControlList(acl_rights, valid=app.cfg.acl_rights_contents)
 
         # Should apply these rights:
@@ -295,7 +296,7 @@
             ('Antony', ('read', 'write', 'admin', )),  # in PGroup
             ('Beatrice', ('read', 'write', 'admin', )),  # in PGroup
             ('Charles', ('read', )),  # virtually in AGroup
-            )
+        )
 
         # Check rights
         for user, may in users:
@@ -333,6 +334,7 @@
     ]
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         content_acl = dict(hierarchic=False, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
         acl_functions = u"SuperUser:superuser NoTextchaUser:notextcha"
@@ -350,17 +352,17 @@
         tests = [
             # itemname, username, expected_rights
             (self.mainitem_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.mainitem_name, u'AnyUser', ['read']), # by after acl
-            (self.mainitem_name, u'JaneDoe', ['read', 'write']), # by item acl
-            (self.mainitem_name, u'JoeDoe', []), # by item acl
+            (self.mainitem_name, u'AnyUser', ['read']),  # by after acl
+            (self.mainitem_name, u'JaneDoe', ['read', 'write']),  # by item acl
+            (self.mainitem_name, u'JoeDoe', []),  # by item acl
             (self.subitem1_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem1_name, u'AnyUser', ['read', 'write']), # by default acl
-            (self.subitem1_name, u'JoeDoe', ['read', 'write']), # by default acl
-            (self.subitem1_name, u'JaneDoe', ['read', 'write']), # by default acl
+            (self.subitem1_name, u'AnyUser', ['read', 'write']),  # by default acl
+            (self.subitem1_name, u'JoeDoe', ['read', 'write']),  # by default acl
+            (self.subitem1_name, u'JaneDoe', ['read', 'write']),  # by default acl
             (self.subitem2_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem2_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem2_name, u'JoeDoe', ['read']), # by after acl
-            (self.subitem2_name, u'JaneDoe', ['read']), # by after acl
+            (self.subitem2_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem2_name, u'JoeDoe', ['read']),  # by after acl
+            (self.subitem2_name, u'JaneDoe', ['read']),  # by after acl
         ]
 
         for itemname, username, may in tests:
@@ -394,6 +396,7 @@
         assert not u.may.superuser()
         assert not u.may.notextcha()
 
+
 class TestItemHierachicalAcls(object):
     """ security: real-life access control list on items testing
     """
@@ -418,6 +421,7 @@
     ]
 
     from MoinMoin._tests import wikiconfig
+
     class Config(wikiconfig.Config):
         content_acl = dict(hierarchic=True, before=u"WikiAdmin:admin,read,write,create,destroy", default=u"All:read,write", after=u"All:read")
 
@@ -434,19 +438,19 @@
         tests = [
             # itemname, username, expected_rights
             (self.mainitem_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.mainitem_name, u'AnyUser', ['read']), # by after acl
-            (self.mainitem_name, u'JaneDoe', ['read', 'write']), # by item acl
-            (self.mainitem_name, u'JoeDoe', []), # by item acl
+            (self.mainitem_name, u'AnyUser', ['read']),  # by after acl
+            (self.mainitem_name, u'JaneDoe', ['read', 'write']),  # by item acl
+            (self.mainitem_name, u'JoeDoe', []),  # by item acl
             (self.subitem1_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem1_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem1_name, u'JoeDoe', []), # by inherited acl from main item
-            (self.subitem1_name, u'JaneDoe', ['read', 'write']), # by inherited acl from main item
+            (self.subitem1_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem1_name, u'JoeDoe', []),  # by inherited acl from main item
+            (self.subitem1_name, u'JaneDoe', ['read', 'write']),  # by inherited acl from main item
             (self.subitem2_name, u'WikiAdmin', ['read', 'write', 'admin', 'create', 'destroy']),
-            (self.subitem2_name, u'AnyUser', ['read']), # by after acl
-            (self.subitem2_name, u'JoeDoe', ['read']), # by after acl
-            (self.subitem2_name, u'JaneDoe', ['read']), # by after acl
-            (self.subitem_4boss, u'AnyUser', ['read']), # by after acl
-            (self.subitem_4boss, u'JoeDoe', ['read', 'write']), # by item acl
+            (self.subitem2_name, u'AnyUser', ['read']),  # by after acl
+            (self.subitem2_name, u'JoeDoe', ['read']),  # by after acl
+            (self.subitem2_name, u'JaneDoe', ['read']),  # by after acl
+            (self.subitem_4boss, u'AnyUser', ['read']),  # by after acl
+            (self.subitem_4boss, u'JoeDoe', ['read', 'write']),  # by item acl
         ]
 
         for itemname, username, may in tests:
@@ -488,7 +492,7 @@
         (p2, None, p2),  # default acl effective (also for children)
         (c2, None, c2),  # no own acl -> inherit from parent
         (c12, None, c12),  # no own acl -> inherit from parents
-        ]
+    ]
 
     from MoinMoin._tests import wikiconfig
 
--- a/MoinMoin/security/_tests/test_textcha.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/security/_tests/test_textcha.py	Sun Mar 03 07:44:25 2013 -0700
@@ -16,10 +16,12 @@
     """ Test: class TextCha """
     def setup_method(self, method):
         cfg = app.cfg
-        cfg.textchas = {'test_user_locale':
-                            {'Good Question': 'Good Answer',
-                            'What is the question?': 'Test_Answer'}
-                       }
+        cfg.textchas = {
+            'test_user_locale': {
+                'Good Question': 'Good Answer',
+                'What is the question?': 'Test_Answer',
+            }
+        }
         cfg.secrets['security/textcha'] = "test_secret"
         flaskg.user.profile[LOCALE] = 'test_user_locale'
 
@@ -38,8 +40,10 @@
 
         # test for textcha
         test_textchas = textcha_obj.textchas
-        expected_textchas = {'Good Question': 'Good Answer',
-                             'What is the question?': 'Test_Answer'}
+        expected_textchas = {
+            'Good Question': 'Good Answer',
+            'What is the question?': 'Test_Answer',
+        }
         assert test_textchas == expected_textchas
         # test for the question
         test_question = textcha_obj.question
@@ -85,13 +89,14 @@
         assert textcha_obj.form['textcha_question'].optional
         assert textcha_obj.form['textcha'].optional
 
+
 class TestTextChaValid(object):
     """ Test: class TextChaValid """
     def setup_method(self, method):
         cfg = app.cfg
-        cfg.textchas = {'test_user_locale':
-                            {'Good Question': 'Good Answer'}
-                       }
+        cfg.textchas = {
+            'test_user_locale': {'Good Question': 'Good Answer'}
+        }
         cfg.secrets['security/textcha'] = "test_secret"
         flaskg.user.profile[LOCALE] = 'test_user_locale'
 
--- a/MoinMoin/storage/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -42,9 +42,9 @@
 def create_mapping(uri, namespaces, backends, acls):
     namespace_mapping = namespaces.items()
     acl_mapping = acls.items()
-    backend_mapping = [(backend_name,
-                        backend_from_uri(uri % dict(backend=backend_name, kind="%(kind)s")))
-                        for backend_name in backends]
+    backend_mapping = [
+        (backend_name, backend_from_uri(uri % dict(backend=backend_name, kind="%(kind)s")))
+        for backend_name in backends]
     # we need the longest mountpoints first, shortest last (-> '' is very last)
     namespace_mapping = sorted(namespace_mapping, key=lambda x: len(x[0]), reverse=True)
     acl_mapping = sorted(acl_mapping, key=lambda x: len(x[0]), reverse=True)
--- a/MoinMoin/storage/backends/_tests/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/backends/_tests/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -14,6 +14,7 @@
 
 from MoinMoin.constants.keys import SIZE, HASH_ALGORITHM
 
+
 class BackendTestBase(object):
     def setup_method(self, method):
         """
@@ -111,11 +112,11 @@
             metaid = self.be.store(meta, StringIO(data))
 
     def test_iter(self):
-        mds = [# (metadata items, data str)
-                (dict(name='one'), 'ONE'),
-                (dict(name='two'), 'TWO'),
-                (dict(name='three'), 'THREE'),
-              ]
+        mds = [  # (metadata items, data str)
+            (dict(name='one'), 'ONE'),
+            (dict(name='two'), 'TWO'),
+            (dict(name='three'), 'THREE'),
+        ]
         expected_result = set()
         for m, d in mds:
             k = self.be.store(m, StringIO(d))
--- a/MoinMoin/storage/backends/_tests/test_fileserver.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/backends/_tests/test_fileserver.py	Sun Mar 03 07:44:25 2013 -0700
@@ -51,10 +51,10 @@
     def test_files(self):
         # note: as we can only store the data into the file system, meta can
         # only have items that are generated by the fileserver backend:
-        items = [# name,  meta,   data
-                 (u'foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
-                 (u'bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
-                ]
+        items = [  # name,  meta,   data
+            (u'foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
+            (u'bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
+        ]
         expected_result = self._prepare(items)
         dir_meta = tuple(sorted(dict(name=u'', size=0, contenttype=u'text/x.moin.wiki;charset=utf-8').items()))
         dir_data = """\
@@ -80,10 +80,10 @@
     def test_dir(self):
         # note: as we can only store the data into the file system, meta can
         # only have items that are generated by the fileserver backend:
-        items = [# name,  meta,   data
-                 (u'dir/foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
-                 (u'dir/bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
-                ]
+        items = [  # name,  meta,   data
+            (u'dir/foo.png', dict(size=11, contenttype=u'image/png'), 'png content'),
+            (u'dir/bar.txt', dict(size=12, contenttype=u'text/plain'), 'text content'),
+        ]
         expected_result = self._prepare(items)
         dir_meta = tuple(sorted(dict(name=u'', size=0, contenttype=u'text/x.moin.wiki;charset=utf-8').items()))
         dir_data = """\
--- a/MoinMoin/storage/backends/_tests/test_stores.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/backends/_tests/test_stores.py	Sun Mar 03 07:44:25 2013 -0700
@@ -17,6 +17,7 @@
 from MoinMoin.storage.stores.memory import BytesStore as MemoryBytesStore
 from MoinMoin.storage.stores.memory import FileStore as MemoryFileStore
 
+
 class TestMemoryBackend(MutableBackendTestBase):
     def setup_method(self, method):
         meta_store = MemoryBytesStore()
@@ -31,6 +32,7 @@
 from MoinMoin.storage.stores.fs import BytesStore as FSBytesStore
 from MoinMoin.storage.stores.fs import FileStore as FSFileStore
 
+
 class TestFSBackend(MutableBackendTestBase):
     def setup_method(self, method):
         meta_path = tempfile.mkdtemp()
--- a/MoinMoin/storage/middleware/_tests/test_indexing.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/_tests/test_indexing.py	Sun Mar 03 07:44:25 2013 -0700
@@ -31,7 +31,7 @@
 
 
 class TestIndexingMiddleware(object):
-    reinit_storage = True # cleanup after each test method
+    reinit_storage = True  # cleanup after each test method
 
     def setup_method(self, method):
         self.imw = flaskg.unprotected_storage
@@ -41,7 +41,7 @@
 
     def test_nonexisting_item(self):
         item = self.imw[u'foo']
-        assert not item # does not exist
+        assert not item  # does not exist
 
     def test_store_revision(self):
         item_name = u'foo'
@@ -52,7 +52,7 @@
         revid = rev.revid
         # check if we have the revision now:
         item = self.imw[item_name]
-        assert item # does exist
+        assert item  # does exist
         rev = item.get_revision(revid)
         assert rev.name == item_name
         assert rev.data.read() == data
@@ -76,8 +76,8 @@
         assert rev.meta[COMMENT] == u'no spam'
         assert rev.data.read() == newdata
         revids = [rev.revid for rev in item.iter_revs()]
-        assert len(revids) == 1 # we still have the revision, cleared
-        assert revid in revids # it is still same revid
+        assert len(revids) == 1  # we still have the revision, cleared
+        assert revid in revids  # it is still same revid
 
     def test_destroy_revision(self):
         item_name = u'foo'
@@ -134,7 +134,7 @@
         item.destroy_all_revisions()
         # check if the item was destroyed:
         item = self.imw[item_name]
-        assert not item # does not exist
+        assert not item  # does not exist
 
     def test_all_revisions(self):
         item_name = u'foo'
@@ -393,8 +393,9 @@
         item = self.imw[item_name]
         assert item.parentnames == [u'p1', u'p2', u'p3/p4', ]  # one p2 duplicate removed
 
+
 class TestProtectedIndexingMiddleware(object):
-    reinit_storage = True # cleanup after each test method
+    reinit_storage = True  # cleanup after each test method
 
     class Config(wikiconfig.Config):
         auth = [GivenAuth(user_name=u'joe', autocreate=True), ]
@@ -412,7 +413,7 @@
                                 StringIO('public content'), return_rev=True)
         revid_public = r.revid
         revids = [rev.revid for rev in self.imw.documents()
-                  if rev.name != u'joe'] # the user profile is a revision in the backend
+                  if rev.name != u'joe']  # the user profile is a revision in the backend
         assert revids == [revid_public]
 
     def test_getitem(self):
--- a/MoinMoin/storage/middleware/_tests/test_protecting.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/_tests/test_protecting.py	Sun Mar 03 07:44:25 2013 -0700
@@ -26,12 +26,14 @@
     ('', dict(before=u'', default=u'All:read,write,create', after=u'', hierarchic=False)),
 ]
 
+
 class FakeUser(object):
     """
     fake user object, just to give user.name
     """
     def __init__(self, name):
         self.name = [name, ]
+
     @property
     def name0(self):
         return self.name[0]
--- a/MoinMoin/storage/middleware/_tests/test_routing.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/_tests/test_routing.py	Sun Mar 03 07:44:25 2013 -0700
@@ -47,6 +47,7 @@
 
     return router
 
+
 def test_store_get_del(router):
     default_name = u'foo'
     default_backend_name, default_revid = router.store(dict(name=[default_name, ]), StringIO(''))
@@ -70,8 +71,9 @@
     with pytest.raises(TypeError):
         router.store(dict(name=[u'ro:testing', ]), StringIO(''))
 
+
 def test_del_readonly_fails(router):
-    ro_be_name, ro_id = next(iter(router)) # we have only readonly items
+    ro_be_name, ro_id = next(iter(router))  # we have only readonly items
     print ro_be_name, ro_id
     with pytest.raises(TypeError):
         router.remove(ro_be_name, ro_id)
--- a/MoinMoin/storage/middleware/_tests/test_serialization.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/_tests/test_serialization.py	Sun Mar 03 07:44:25 2013 -0700
@@ -38,14 +38,17 @@
 def pytest_generate_tests(metafunc):
     metafunc.addcall(id='Simple->Simple', param=('Simple', 'Simple'))
 
+
 def pytest_funcarg__source(request):
     # scenario
     return make_middleware(request)
 
+
 def pytest_funcarg__target(request):
     # scenario
     return make_middleware(request)
 
+
 def make_middleware(request):
     tmpdir = request.getfuncargvalue('tmpdir')
     # scenario
@@ -61,7 +64,7 @@
     request.addfinalizer(backend.destroy)
     request.addfinalizer(backend.close)
 
-    mw = IndexingMiddleware(index_storage=(WHOOSH_FILESTORAGE, (str(tmpdir/'foo'), ), {}),
+    mw = IndexingMiddleware(index_storage=(WHOOSH_FILESTORAGE, (str(tmpdir / 'foo'), ), {}),
                             backend=backend)
     mw.create()
     mw.open()
--- a/MoinMoin/storage/middleware/_tests/test_validation.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/_tests/test_validation.py	Sun Mar 03 07:44:25 2013 -0700
@@ -35,8 +35,8 @@
             keys.TAGS: [u"foo", u"bar"],
         }
 
-        state = {'trusted': False, # True for loading a serialized representation or other trusted sources
-                 keys.NAME: u'somename', # name we decoded from URL path
+        state = {'trusted': False,  # True for loading a serialized representation or other trusted sources
+                 keys.NAME: u'somename',  # name we decoded from URL path
                  keys.ACTION: u'SAVE',
                  keys.HOSTNAME: u'localhost',
                  keys.ADDRESS: u'127.0.0.1',
@@ -69,8 +69,8 @@
             keys.EMAIL: u"foo@example.org",
         }
 
-        state = {'trusted': False, # True for loading a serialized representation or other trusted sources
-                 keys.NAME: u'somename', # name we decoded from URL path
+        state = {'trusted': False,  # True for loading a serialized representation or other trusted sources
+                 keys.NAME: u'somename',  # name we decoded from URL path
                  keys.ACTION: u'SAVE',
                  keys.HOSTNAME: u'localhost',
                  keys.ADDRESS: u'127.0.0.1',
--- a/MoinMoin/storage/middleware/indexing.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/middleware/indexing.py	Sun Mar 03 07:44:25 2013 -0700
@@ -64,8 +64,7 @@
 
 from whoosh.fields import Schema, TEXT, ID, IDLIST, NUMERIC, DATETIME, KEYWORD, BOOLEAN
 from whoosh.writing import AsyncWriter
-from whoosh.qparser import QueryParser, MultifieldParser, RegexPlugin, \
-                           PseudoFieldPlugin
+from whoosh.qparser import QueryParser, MultifieldParser, RegexPlugin, PseudoFieldPlugin
 from whoosh.qparser import WordNode
 from whoosh.query import Every, Term
 from whoosh.sorting import FieldFacet
@@ -323,10 +322,10 @@
             'difficulty': NUMERIC(stored=True),
             'severity': NUMERIC(stored=True),
             'priority': NUMERIC(stored=True),
-            'status': ID(stored=True),
             'assigned_to': ID(stored=True),
             'superseded_by': ID(stored=True),
             'depends_on': ID(stored=True),
+            'closed': BOOLEAN(stored=True),
         }
         latest_revs_fields.update(**ticket_fields)
 
--- a/MoinMoin/storage/stores/_tests/conftest.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/conftest.py	Sun Mar 03 07:44:25 2013 -0700
@@ -33,15 +33,12 @@
 constructors = {
     'memory': lambda store, _: store(),
     'fs': lambda store, tmpdir: store(str(tmpdir.join('store'))),
-    'sqlite': lambda store, tmpdir: store(str(tmpdir.join('store.sqlite')),
-                                          'test_table', compression_level=0),
-    'sqlite:compressed': lambda store, tmpdir: store(str(tmpdir.join('store.sqlite')),
-                                          'test_table', compression_level=1),
+    'sqlite': lambda store, tmpdir: store(str(tmpdir.join('store.sqlite')), 'test_table', compression_level=0),
+    'sqlite:compressed': lambda store, tmpdir: store(str(tmpdir.join('store.sqlite')), 'test_table', compression_level=1),
     'kc': lambda store, tmpdir: store(str(tmpdir.join('store.kch'))),
     'kt': lambda store, _: store(),
     'mongodb': lambda store, _: store(),
-    'sqla': lambda store, tmpdir: store('sqlite:///{0!s}'.format(tmpdir.join('store.sqlite')),
-                                        'test_table'),
+    'sqla': lambda store, tmpdir: store('sqlite:///{0!s}'.format(tmpdir.join('store.sqlite')), 'test_table'),
 }
 
 
--- a/MoinMoin/storage/stores/_tests/test_all.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_all.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,6 +11,7 @@
 
 import pytest
 
+
 def test_getitem_raises(store):
     with pytest.raises(KeyError):
         store['doesnotexist']
@@ -24,6 +25,7 @@
     with pytest.raises(KeyError):
         store[k]
 
+
 def test_setitem_getitem_delitem_binary(store):
     k, v = 'key', '\000\001\002'
     store[k] = v
--- a/MoinMoin/storage/stores/_tests/test_kt.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_kt.py	Sun Mar 03 07:44:25 2013 -0700
@@ -35,6 +35,7 @@
     store = Store()
     store.destroy()
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("localhost")
--- a/MoinMoin/storage/stores/_tests/test_memory.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_memory.py	Sun Mar 03 07:44:25 2013 -0700
@@ -22,6 +22,7 @@
 
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(Store):
     store = test_create(Store)
@@ -29,6 +30,7 @@
     store.destroy()
     assert store._st is None
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("mem://")
--- a/MoinMoin/storage/stores/_tests/test_mongodb.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_mongodb.py	Sun Mar 03 07:44:25 2013 -0700
@@ -24,11 +24,13 @@
     store.create()
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(Store):
     store = Store()
     store.destroy()
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(Store):
     store = Store.from_uri("mongodb://localhost/test_base::test_coll")
--- a/MoinMoin/storage/stores/_tests/test_sqla.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_sqla.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,6 +11,7 @@
 pytest.importorskip('MoinMoin.storage.stores.sqla')
 from ..sqla import BytesStore, FileStore
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_create(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
@@ -21,6 +22,7 @@
     assert dbfile.check()
     return store
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_destroy(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
@@ -28,6 +30,7 @@
     store.destroy()
     # XXX: check for dropped table
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(tmpdir, Store):
     store = Store.from_uri("sqlite://%s::test_base" % tmpdir)
--- a/MoinMoin/storage/stores/_tests/test_sqlite.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/storage/stores/_tests/test_sqlite.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,16 +11,23 @@
 
 from ..sqlite import BytesStore, FileStore
 
+
 def bytes_compressed(path):
     return BytesStore(path, 'test_table', compression_level=1)
+
+
 def bytes_uncompressed(path):
     return BytesStore(path, 'test_table', compression_level=0)
 
+
 def file_compressed(path):
     return FileStore(path, 'test_table', compression_level=1)
+
+
 def file_uncompressed(path):
     return FileStore(path, 'test_table', compression_level=0)
 
+
 all_setups = pytest.mark.multi(Store=[
     bytes_uncompressed,
     bytes_compressed,
@@ -39,6 +46,7 @@
     assert dbfile.check()
     return store
 
+
 @all_setups
 def test_destroy(tmpdir, Store):
     dbfile = tmpdir.join('store.sqlite')
@@ -46,6 +54,7 @@
     store.destroy()
     # XXX: check for dropped table
 
+
 @pytest.mark.multi(Store=[BytesStore, FileStore])
 def test_from_uri(tmpdir, Store):
     store = Store.from_uri("%s::test_table::0" % tmpdir)
--- a/MoinMoin/templates/forms.html	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/templates/forms.html	Sun Mar 03 07:44:25 2013 -0700
@@ -156,9 +156,8 @@
   </dt>
   <dd>
     {{ gen.select.open(field) }}
-    {% set labels = field.properties.get('labels', {}) %}
-    {% for value in field.valid_values %}
-      {{ gen.option(field, value=value, contents=labels.get(value, value)) }}
+    {% for value, label in field.properties['choice_specs'] %}
+      {{ gen.option(field, value=value, contents=label or value) }}
     {% endfor %}
     {{ gen.select.close() }}
     {{ render_errors(field) }}
@@ -173,16 +172,13 @@
 {% endmacro %}
 
 {% macro multi_select(field) %}
-  {% set valid_values = field.member_schema.valid_values %}
-  {% set labels = field.member_schema.properties.get('labels', {}) %}
-  {% set descriptions = field.member_schema.properties.get('descriptions', {}) %}
-  {% for value in valid_values %}
+  {% for value, label, description in field.member_schema.properties['choice_specs'] %}
     <li>
       {{ raw_input(field, 'checkbox', value=value) }}
-      {{ _valued_label(field, value, labels.get(value, value), class='moin-inline-label') }}
-      {% if descriptions[value] is defined %}
+      {{ _valued_label(field, value, label or value, class='moin-inline-label') }}
+      {% if description %}
         <span class="helper-text">
-          {{ descriptions[value] }}
+          {{ description }}
         </span>
       {% endif %}
     </li>
--- a/MoinMoin/templates/ticket.html	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/templates/ticket.html	Sun Mar 03 07:44:25 2013 -0700
@@ -13,7 +13,13 @@
 {% endblock %}
 
 {% block content %}
-<h1>{{ title }}</h1>
+<h1>
+    {{ title }}
+    {% if closed %}
+        {# TODO style .moin-ticket-closed #}
+        <span class="moin-ticket-closed">{{ _("(Closed)") }}</span>
+    {% endif %}
+</h1>
 <div class="moin-form" id="moin-ticket-form">
     {{ gen.form.open(form, method='post', enctype='multipart/form-data') }}
 
@@ -49,7 +55,13 @@
         {{ forms.render(form['meta'][e]) }}
     {% endfor %}
     </dl>
-    {{ forms.render_submit(form) }}
+
+    {# see comments concerning the submit button within TicketForm in items/ticket.py #}
+    {% if is_new %}
+        {{ forms.render_submit(form) }}
+    {% else %}
+        {{ forms.render(form['submit']) }}
+    {% endif %}
 
     <h2>Back references</h2>
     <dl>
--- a/MoinMoin/themes/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/themes/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -410,22 +410,22 @@
     # datetimeformat, dateformat, timeformat, timedeltaformat
 
     app.jinja_env.globals.update({
-                            # please note that flask-babel/jinja2.ext installs:
-                            # _, gettext, ngettext
-                            'isinstance': isinstance,
-                            'list': list,
-                            'Type': Type,
-                            # please note that flask-themes installs:
-                            # theme, theme_static
-                            'theme_supp': ThemeSupport(app.cfg),
-                            'user': flaskg.user,
-                            'storage': flaskg.storage,
-                            'clock': flaskg.clock,
-                            'cfg': app.cfg,
-                            'item_name': u'handlers need to give it',
-                            'url_for_item': url_for_item,
-                            'get_editor_info': lambda meta: get_editor_info(meta),
-                            'utctimestamp': lambda dt: utctimestamp(dt),
-                            'gen': make_generator(),
-                            'search_form': SearchForm.from_defaults(),
-                            })
+        # please note that flask-babel/jinja2.ext installs:
+        # _, gettext, ngettext
+        'isinstance': isinstance,
+        'list': list,
+        'Type': Type,
+        # please note that flask-themes installs:
+        # theme, theme_static
+        'theme_supp': ThemeSupport(app.cfg),
+        'user': flaskg.user,
+        'storage': flaskg.storage,
+        'clock': flaskg.clock,
+        'cfg': app.cfg,
+        'item_name': u'handlers need to give it',
+        'url_for_item': url_for_item,
+        'get_editor_info': lambda meta: get_editor_info(meta),
+        'utctimestamp': lambda dt: utctimestamp(dt),
+        'gen': make_generator(),
+        'search_form': SearchForm.from_defaults(),
+    })
--- a/MoinMoin/themes/_tests/test_navi_bar.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/themes/_tests/test_navi_bar.py	Sun Mar 03 07:44:25 2013 -0700
@@ -13,6 +13,7 @@
 from MoinMoin.themes import ThemeSupport
 from MoinMoin import themes
 
+
 class TestNaviBar(object):
     class Config(wikiconfig.Config):
         interwiki_map = dict(Self='http://localhost:8080/', MoinMoin='http://moinmo.in/', )
@@ -51,7 +52,8 @@
     def test_parent_item(self):
         test_result = ThemeSupport.parent_item(self.theme, 'moin/moin-2.0/Item')
         expected = 'moin/moin-2.0'
-        assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
+        assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals()
+
 
 def test_shorten_item_name():
     test_result1 = themes.shorten_item_name(u'MoinMoin/some/value', 0)
@@ -61,6 +63,7 @@
     test_result3 = themes.shorten_item_name(u'MoinMoin/some/value')
     assert test_result3 == u'MoinMoin/some/value'
 
+
 def test_contenttype_to_class():
     test_result = themes.contenttype_to_class(u'MoinMoin/some/value')
     expected = u'moin-mime-MoinMoin'
--- a/MoinMoin/user.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/user.py	Sun Mar 03 07:44:25 2013 -0700
@@ -135,7 +135,7 @@
     if userid:
         userdata = User(userid)
         if userdata.mailto_author and userdata.email:
-            return ('email', userdata.email)
+            return 'email', userdata.email
         elif userdata.name:
             interwiki = getInterwikiHome(userdata.name0)
             if interwiki:
@@ -753,8 +753,7 @@
 
 If you didn't forget your password, please ignore this email.
 
-""", link=url_for('frontend.recoverpass',
-                        username=self.name0, token=token, _external=True))
+""", link=url_for('frontend.recoverpass', username=self.name0, token=token, _external=True))
 
         subject = _('[%(sitename)s] Your wiki password recovery link',
                     sitename=self._cfg.sitename or "Wiki")
@@ -774,8 +773,7 @@
 
 If you didn't create this account, please ignore this email.
 
-""", link=url_for('frontend.verifyemail',
-                        username=self.name0, token=token, _external=True))
+""", link=url_for('frontend.verifyemail', username=self.name0, token=token, _external=True))
 
         subject = _('[%(sitename)s] Please verify your email address',
                     sitename=self._cfg.sitename or "Wiki")
--- a/MoinMoin/util/__init__.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/__init__.py	Sun Mar 03 07:44:25 2013 -0700
@@ -72,11 +72,11 @@
     pattern = ','
     for i in range(len(numbers) - 1):
         if pattern[-1] == ',':
-            pattern = pattern + str(numbers[i])
+            pattern += str(numbers[i])
             if numbers[i] + 1 == numbers[i + 1]:
-                pattern = pattern + '-'
+                pattern += '-'
             else:
-                pattern = pattern + ','
+                pattern += ','
         elif numbers[i] + 1 != numbers[i + 1]:
             pattern = pattern + str(numbers[i]) + ','
 
@@ -117,4 +117,4 @@
     else:
         previous_offset = -1
     next_offset = count
-    return (selected_result, next_offset, previous_offset)
+    return selected_result, next_offset, previous_offset
--- a/MoinMoin/util/_tests/test_crypto.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_crypto.py	Sun Mar 03 07:44:25 2013 -0700
@@ -18,14 +18,14 @@
         length = 8
         result1 = crypto.random_string(length)
         result2 = crypto.random_string(length)
-        assert result1 != result2, ('Expected different random strings, but got "%(result1)s" and "%(result2)s"') % locals()
+        assert result1 != result2, 'Expected different random strings, but got "%(result1)s" and "%(result2)s"' % locals()
 
         result_string = crypto.random_string(length)
         assert isinstance(result_string, str), ('Expected an string value, but got ' + str(type(result_string)))
 
         result = len(crypto.random_string(length))
         expected = length
-        assert result == expected, ('Expected length "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected length "%(expected)s" but got "%(result)s"' % locals()
 
 
 class TestToken(object):
@@ -33,11 +33,11 @@
 
     def test_validtoken(self):
         """ validate the token """
-        test_key, test_token = crypto.generate_token(key='MoinMoin') # having some key value
+        test_key, test_token = crypto.generate_token(key='MoinMoin')  # having some key value
         result = crypto.valid_token(test_key, test_token)
         assert result
 
-        test_key, test_token = crypto.generate_token() # key value is none
+        test_key, test_token = crypto.generate_token()  # key value is none
         result = crypto.valid_token(test_key, test_token)
         assert result
 
@@ -62,7 +62,7 @@
         result1 = crypto.cache_key(**test_kw1)
         test_kw2 = {'Moin2': 'value2'}
         result2 = crypto.cache_key(**test_kw2)
-        assert result1 != result2, ("Expected different keys for different <kw> but got the same")
+        assert result1 != result2, "Expected different keys for different <kw> but got the same"
 
 
 coverage_modules = ['MoinMoin.util.crypto']
--- a/MoinMoin/util/_tests/test_diff3.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_diff3.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,7 +8,8 @@
 
 from MoinMoin.util import diff3
 
-class TestDiff3:
+
+class TestDiff3(object):
 
     def testTextMerge(self):
         """ util.diff3.text_merge: test correct merging """
@@ -79,7 +80,7 @@
 AAA 014
 >>>>>>>>>>>>>>>>>>>>>>>>>
 """
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff3']
--- a/MoinMoin/util/_tests/test_diff_html.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_diff_html.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 from MoinMoin.util import diff_html
 
+
 def test_indent():
     # input text
     test_input = """ \n
@@ -30,6 +31,7 @@
     result = diff_html.indent(test_input)
     assert result == expected
 
+
 def test_diff():
     test_input1 = """ \n
 
--- a/MoinMoin/util/_tests/test_diff_text.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_diff_text.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,6 +8,7 @@
 
 from MoinMoin.util import diff_text
 
+
 class TestDiffText(object):
 
     def testDiff(self):
@@ -63,7 +64,7 @@
 - AAA 013
 - AAA 014"""
 
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util.diff_text']
--- a/MoinMoin/util/_tests/test_filesys.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_filesys.py	Sun Mar 03 07:44:25 2013 -0700
@@ -5,8 +5,11 @@
     MoinMoin - MoinMoin.util.filesys Tests
 """
 
-import sys, os, time
-import shutil, tempfile
+import sys
+import os
+import time
+import shutil
+import tempfile
 
 import pytest
 
@@ -15,6 +18,7 @@
 win32_only = pytest.mark.skipif("sys.platform != 'win32'")
 win32_incompatible = pytest.mark.skipif("sys.platform == 'win32'")
 
+
 class TestFuid(object):
     """ test filesys.fuid (a better mtime() alternative for up-to-date checking) """
 
@@ -52,7 +56,7 @@
         self.makefile(self.fname, "foofoo")
         uid2 = filesys.fuid(self.fname)
 
-        assert uid2 != uid1 # we changed size and maybe mtime
+        assert uid2 != uid1  # we changed size and maybe mtime
 
     @win32_incompatible
     def testUpdateFileMovingFromTemp(self):
@@ -66,7 +70,7 @@
         os.rename(self.tmpname, self.fname)
         uid2 = filesys.fuid(self.fname)
 
-        assert uid2 != uid1 # we didn't change size, but inode and maybe mtime
+        assert uid2 != uid1  # we didn't change size, but inode and maybe mtime
 
     @win32_only
     def testStale(self):
@@ -75,7 +79,7 @@
         self.makefile(self.fname, "foo")
         uid1 = filesys.fuid(self.fname)
 
-        time.sleep(2) # thanks for waiting :)
+        time.sleep(2)  # thanks for waiting :)
         uid2 = filesys.fuid(self.fname, max_staleness=1)
         assert uid2 != uid1  # should be considered stale if platform has no inode support
 
@@ -167,4 +171,5 @@
         with pytest.raises(OSError):
             filesys.copytree(self.test_dir, self.test_dest_dir)
 
+
 coverage_modules = ['MoinMoin.util.filesys']
--- a/MoinMoin/util/_tests/test_forms.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_forms.py	Sun Mar 03 07:44:25 2013 -0700
@@ -21,6 +21,7 @@
 
 test_attributes = {'type': 'submit', u'required': 'test_required', 'autofocus': None, 'placeholder': None}
 
+
 def test_label_filter():
     # when content is None
     result1 = forms.label_filter('test_tagname', test_attributes, None, 'test_context', test_bind)
@@ -32,6 +33,7 @@
     expected = 'new_content'
     assert result2 == expected
 
+
 def test_button_filter():
     result = forms.button_filter('test_tagname', test_attributes, 'new_content', 'test_context', None)
     expected = 'new_content'
@@ -50,6 +52,7 @@
     expected = 'test_bind_default'
     assert content_result == expected
 
+
 def test_required_filter():
     test_bind.optional = False
     test_attributes[u'class'] = 'test_class'
@@ -68,6 +71,7 @@
     expected = u'required'
     assert attribute_result == expected
 
+
 def test_autofocus_filter():
     test_bind.properties = {'autofocus': True}
     content_result = forms.autofocus_filter('test_tagname', test_attributes, 'new_content', 'test_context', test_bind)
@@ -75,6 +79,7 @@
     attribute_result = test_attributes[u'autofocus']
     assert attribute_result == u'autofocus'
 
+
 def test_placeholder_filter():
     test_bind.properties['placeholder'] = 'test_placeholder'
     content_result = forms.placeholder_filter('test_tagname', test_attributes, 'new_content', 'test_context', test_bind)
@@ -82,6 +87,7 @@
     attribute_result = test_attributes['placeholder']
     assert attribute_result == 'test_placeholder'
 
+
 def test_error_filter_factory():
     # when 'class' not in test_attributes
     test_bind.errors = 'test_errors'
--- a/MoinMoin/util/_tests/test_interwiki.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_interwiki.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,17 +9,18 @@
 
 from __future__ import absolute_import, division
 
-import pytest
 import tempfile
 import os.path
 import shutil
 
+import pytest
+from flask import current_app as app
+
 from MoinMoin.util.interwiki import split_interwiki, join_wiki, InterWikiMap, url_for_item, _split_namespace
 from MoinMoin._tests import wikiconfig
 from MoinMoin.constants.keys import CURRENT
 from MoinMoin.app import before_wiki
 
-from flask import current_app as app
 
 class TestInterWiki(object):
     class Config(wikiconfig.Config):
@@ -27,7 +28,7 @@
                          'MoinMoin': 'http://moinmo.in/',
                          'OtherWiki': 'http://otherwiki.com/',
                          'OtherWiki:ns1': 'http://otherwiki.com/ns1/',
-                         'OtherWiki:ns1:ns2': 'http://otherwiki.com/ns1/ns2/'
+                         'OtherWiki:ns1:ns2': 'http://otherwiki.com/ns1/ns2/',
         }
 
     def test_url_for_item(self):
@@ -121,6 +122,7 @@
         for (baseurl, pagename, namespace), url in tests:
             assert join_wiki(baseurl, pagename, namespace) == url
 
+
 class TestInterWikiMapBackend(object):
     """
     tests for interwiki map
@@ -169,8 +171,7 @@
              '#       space     space\n'
              'foo bar\r\n'
              'ham spam # this is a valid description')
-        assert InterWikiMap.from_string(s).iwmap == dict(foo='bar',
-                                                                  ham='spam')
+        assert InterWikiMap.from_string(s).iwmap == dict(foo='bar', ham='spam')
         # test for valid strings
         s = ('link1 http://link1.com/\r\n'
              'link2 http://link2.in/\r\n')
--- a/MoinMoin/util/_tests/test_iri.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_iri.py	Sun Mar 03 07:44:25 2013 -0700
@@ -11,6 +11,7 @@
 
 from MoinMoin.util.iri import *
 
+
 def test_Iri_init_1():
     u = Iri(scheme='wiki', path='/StartSeite', query='action=raw')
     assert u.scheme == 'wiki'
@@ -19,6 +20,7 @@
     assert u.query == 'action=raw'
     assert u.fragment is None
 
+
 def test_Iri_init_2():
     i = 'wiki://MoinMoin/StartSeite?action=raw#body'
     u = Iri(i, scheme='newwiki', path='/newStartSeite', query='action=false')
@@ -28,12 +30,14 @@
     assert u.query == 'action=false'
     assert u.fragment == 'body'
 
+
 def test_Iri_init_3():
     i = Iri(scheme='wiki', path='/StartSeite', query='action=raw')
     u = Iri(i)
     assert i is not u
     assert i == u
 
+
 def test_Iri_parser():
     i = 'http://moinmo.in/StartSeite?action=raw#body'
     u = Iri(i)
@@ -179,6 +183,7 @@
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_2():
     i = 'wiki://MoinMoin/StartSeite?action=raw#body'
     u = Iri(i)
@@ -198,6 +203,7 @@
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_3():
     i = 'wiki.local:StartSeite?action=raw#body'
     u = Iri(i)
@@ -208,6 +214,7 @@
     assert u.fragment == 'body'
     assert unicode(u) == i
 
+
 def test_Iri_add_1():
     base = Iri('wiki://moinmo.in/Some/Page?action=raw#body')
 
@@ -274,8 +281,10 @@
     assert u.query == 'action=raw'
     assert u.fragment == 'head'
 
+
 def test_Iri_quote_1():
-    u = Iri(scheme=u'wiki', authority=u'authority_ä%?#', path=u'/path_ä%?#', query=u'query_ä%?#', fragment=u'fragment_ä%?#')
+    u = Iri(scheme=u'wiki', authority=u'authority_ä%?#',
+            path=u'/path_ä%?#', query=u'query_ä%?#', fragment=u'fragment_ä%?#')
     assert u.scheme == u'wiki'
     assert u.authority == u'authority_ä%?#'
     authority = u'authority_ä%25%3F%23'
@@ -299,6 +308,7 @@
     assert u.fragment.urlquoted == u'fragment_%C3%A4%25?%23'
     assert unicode(u) == u'wiki://{0}{1}?{2}#{3}'.format(authority, path, query, fragment)
 
+
 def test_Iri_quote_2():
     authority = u'authority_ä%25%3F%23'
     path = u'/path_ä%25%3F%23'
@@ -308,6 +318,7 @@
     u = Iri(i)
     assert unicode(u) == i
 
+
 def test_Iri_quote_3():
     i = u'wiki:///path_%92%92'
     u = Iri(i)
@@ -315,6 +326,7 @@
     assert u.path.quoted == u'/path_%92%92'
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_1():
     i = 'moinmo.in'
     u = IriAuthority(i)
@@ -323,6 +335,7 @@
     assert u.port is None
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_2():
     i = '@moinmo.in:'
     u = IriAuthority(i)
@@ -331,6 +344,7 @@
     assert u.port == 0
     assert unicode(u) == i
 
+
 def test_IriAuthority_parser_3():
     i = 'test:test@moinmo.in:1234'
     u = IriAuthority(i)
@@ -339,6 +353,7 @@
     assert u.port == 1234
     assert unicode(u) == i
 
+
 def test_IriPath_1():
     i = '/'
     u = IriPath(i)
@@ -347,6 +362,7 @@
     assert u[1] == ''
     assert unicode(u) == i
 
+
 def test_IriPath_2():
     i = '/.'
     u = IriPath(i)
@@ -362,6 +378,7 @@
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_3():
     i = '/..'
     u = IriPath(i)
@@ -377,6 +394,7 @@
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_4():
     i = '/test'
     u = IriPath(i)
@@ -407,6 +425,7 @@
     assert u[1] == ''
     assert unicode(u) == '/'
 
+
 def test_IriPath_5():
     i = '/test/test1/../../test2'
     u = IriPath(i)
--- a/MoinMoin/util/_tests/test_mime.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_mime.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,12 +8,14 @@
 
 from MoinMoin.util.mime import *
 
+
 def test_Type_init_1():
     t = Type(type='foo', subtype='bar', parameters={'foo': 'bar'})
     assert t.type == 'foo'
     assert t.subtype == 'bar'
     assert t.parameters == {'foo': 'bar'}
 
+
 def test_Type_init_2():
     i = 'text/plain;encoding=utf-8'
     t = Type(i, type='foo', subtype='bar', parameters={'foo': 'bar'})
@@ -21,6 +23,7 @@
     assert t.subtype == 'bar'
     assert t.parameters == {'encoding': 'utf-8', 'foo': 'bar'}
 
+
 def test_Type_init_3():
     i = Type(type='foo', subtype='bar')
     t = Type(i)
@@ -28,6 +31,7 @@
     assert i == t
     assert i.parameters is not t.parameters
 
+
 def test_Type_text():
     i = '*/*'
     t = Type(i)
@@ -62,6 +66,7 @@
     assert t.parameters == {'encoding': 'utf-8', 'foo': '['}
     assert unicode(t) == i
 
+
 def test_Type_compare():
     t1 = Type(type='text', subtype='plain')
 
--- a/MoinMoin/util/_tests/test_mimetype.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_mimetype.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 from MoinMoin.util import mimetype
 
+
 class TestMimeType(object):
     """ Test: util.mimetype """
 
@@ -16,11 +17,11 @@
         MimeType_obj = mimetype.MimeType(filename='test_file.jpg')
         # format in PARSER_TEXT_MIMETYPE
         test = [
-        #test_format, test_mimetype
-        ('html', ('text', 'html')),
-        ('css', ('text', 'css')),
-        ('python', ('text', 'python')),
-        ('latex', ('text', 'latex'))
+            #test_format, test_mimetype
+            ('html', ('text', 'html')),
+            ('css', ('text', 'css')),
+            ('python', ('text', 'python')),
+            ('latex', ('text', 'latex')),
         ]
 
         for test_format, test_mimetype in test:
@@ -29,10 +30,10 @@
 
         # format not in PARSER_TEXT_MIMETYPE
         test = [
-        # test_format, test_mimetype
-        ('wiki', ('text', 'x.moin.wiki')),
-        ('irc', ('text', 'irssi')),
-        ('test_random', ('text', 'x-test_random'))
+            # test_format, test_mimetype
+            ('wiki', ('text', 'x.moin.wiki')),
+            ('irc', ('text', 'irssi')),
+            ('test_random', ('text', 'x-test_random')),
         ]
 
         for test_format, test_mimetype in test:
@@ -41,14 +42,14 @@
 
     def test_mime_type(self):
         test = [
-        # test_extension, test_major/minor
-        ('.mpeg', 'video/mpeg'),
-        ('.pdf', 'application/pdf'),
-        ('.txt', 'text/plain'),
-        ('.jpeg', 'image/jpeg'),
-        ('.png', 'image/png'),
-        ('.svg', 'image/svg+xml'),
-        ('', 'application/octet-stream')
+            # test_extension, test_major/minor
+            ('.mpeg', 'video/mpeg'),
+            ('.pdf', 'application/pdf'),
+            ('.txt', 'text/plain'),
+            ('.jpeg', 'image/jpeg'),
+            ('.png', 'image/png'),
+            ('.svg', 'image/svg+xml'),
+            ('', 'application/octet-stream'),
         ]
 
         # when mimestr is None
--- a/MoinMoin/util/_tests/test_paramparser.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_paramparser.py	Sun Mar 03 07:44:25 2013 -0700
@@ -16,54 +16,42 @@
         abcd = [u'a', u'b', u'c', u'd']
         abcd_dict = {u'a': u'1', u'b': u'2', u'c': u'3', u'd': u'4'}
         tests = [
-                  # regular and quoting tests
-                  (u'd = 4,c=3,b=2,a= 1 ',    ([], abcd_dict, [])),
-                  (u'a,b,c,d',                (abcd, {}, [])),
-                  (u' a , b , c , d ',        (abcd, {}, [])),
-                  (u'   a   ',                ([u'a'], {}, [])),
-                  (u'"  a  "',                ([u'  a  '], {}, [])),
-                  (u'a,b,c,d, "a,b,c,d"',     (abcd+[u'a,b,c,d'], {}, [])),
-                  (u'quote " :), b',          ([u'quote " :)', u'b'], {}, [])),
-                  (u'"quote "" :)", b',       ([u'quote " :)', u'b'], {}, [])),
-                  (u'=7',                     ([], {u'': u'7'}, [])),
-                  (u',,',                     ([None, None, None], {}, [])),
-                  (u',"",',                   ([None, u'', None], {}, [])),
-                  (u',"", ""',                ([None, u'', u''], {}, [])),
-                  (u'  ""  ,"", ""',          ([u'', u'', u''], {}, [])),
-                  # some name=value test
-                  (u'd = 4,c=3,b=2,a= 1 ',    ([], abcd_dict, [])),
-                  (u'd=d,e="a,b,c,d"',        ([], {u'd': u'd',
-                                                    u'e': u'a,b,c,d'}, [])),
-                  (u'd = d,e = "a,b,c,d"',    ([], {u'd': u'd',
-                                                    u'e': u'a,b,c,d'}, [])),
-                  (u'd = d, e = "a,b,c,d"',   ([], {u'd': u'd',
-                                                    u'e': u'a,b,c,d'}, [])),
-                  (u'd = , e = "a,b,c,d"',    ([], {u'd': None,
-                                                    u'e': u'a,b,c,d'}, [])),
-                  (u'd = "", e = "a,b,c,d"',  ([], {u'd': u'',
-                                                    u'e': u'a,b,c,d'}, [])),
-                  (u'd = "", e = ',           ([], {u'd': u'', u'e': None},
-                                               [])),
-                  (u'd=""',                   ([], {u'd': u''}, [])),
-                  (u'd = "", e = ""',         ([], {u'd': u'', u'e': u''},
-                                               [])),
-                  # no, None as key isn't accepted
-                  (u' = "",  e = ""',         ([], {u'': u'', u'e': u''},
-                                               [])),
-                  # can quote both name and value:
-                  (u'd = d," e "= "a,b,c,d"', ([], {u'd': u'd',
-                                                    u' e ': u'a,b,c,d'}, [])),
-                  # trailing args
-                  (u'1,2,a=b,3,4',            ([u'1', u'2'], {u'a': u'b'},
-                                               [u'3', u'4'])),
-                  # can quote quotes:
-                  (u'd = """d"',              ([], {u'd': u'"d'}, [])),
-                  (u'd = """d"""',            ([], {u'd': u'"d"'}, [])),
-                  (u'd = "d"" ", e=7',        ([], {u'd': u'd" ', u'e': u'7'},
-                                               [])),
-                  (u'd = "d""", e=8',         ([], {u'd': u'd"', u'e': u'8'},
-                                               [])),
-                ]
+            # regular and quoting tests
+            (u'd = 4,c=3,b=2,a= 1 ', ([], abcd_dict, [])),
+            (u'a,b,c,d', (abcd, {}, [])),
+            (u' a , b , c , d ', (abcd, {}, [])),
+            (u'   a   ', ([u'a'], {}, [])),
+            (u'"  a  "', ([u'  a  '], {}, [])),
+            (u'a,b,c,d, "a,b,c,d"', (abcd + [u'a,b,c,d'], {}, [])),
+            (u'quote " :), b', ([u'quote " :)', u'b'], {}, [])),
+            (u'"quote "" :)", b', ([u'quote " :)', u'b'], {}, [])),
+            (u'=7', ([], {u'': u'7'}, [])),
+            (u',,', ([None, None, None], {}, [])),
+            (u',"",', ([None, u'', None], {}, [])),
+            (u',"", ""', ([None, u'', u''], {}, [])),
+            (u'  ""  ,"", ""', ([u'', u'', u''], {}, [])),
+            # some name=value test
+            (u'd = 4,c=3,b=2,a= 1 ', ([], abcd_dict, [])),
+            (u'd=d,e="a,b,c,d"', ([], {u'd': u'd', u'e': u'a,b,c,d'}, [])),
+            (u'd = d,e = "a,b,c,d"', ([], {u'd': u'd', u'e': u'a,b,c,d'}, [])),
+            (u'd = d, e = "a,b,c,d"', ([], {u'd': u'd', u'e': u'a,b,c,d'}, [])),
+            (u'd = , e = "a,b,c,d"', ([], {u'd': None, u'e': u'a,b,c,d'}, [])),
+            (u'd = "", e = "a,b,c,d"', ([], {u'd': u'', u'e': u'a,b,c,d'}, [])),
+            (u'd = "", e = ', ([], {u'd': u'', u'e': None}, [])),
+            (u'd=""', ([], {u'd': u''}, [])),
+            (u'd = "", e = ""', ([], {u'd': u'', u'e': u''}, [])),
+            # no, None as key isn't accepted
+            (u' = "",  e = ""', ([], {u'': u'', u'e': u''}, [])),
+            # can quote both name and value:
+            (u'd = d," e "= "a,b,c,d"', ([], {u'd': u'd', u' e ': u'a,b,c,d'}, [])),
+            # trailing args
+            (u'1,2,a=b,3,4', ([u'1', u'2'], {u'a': u'b'}, [u'3', u'4'])),
+            # can quote quotes:
+            (u'd = """d"', ([], {u'd': u'"d'}, [])),
+            (u'd = """d"""', ([], {u'd': u'"d"'}, [])),
+            (u'd = "d"" ", e=7', ([], {u'd': u'd" ', u'e': u'7'}, [])),
+            (u'd = "d""", e=8', ([], {u'd': u'd"', u'e': u'8'}, [])),
+        ]
         for args, expected in tests:
             result = paramparser.parse_quoted_separated(args)
             assert expected == result
@@ -78,12 +66,11 @@
 
     def testLimited(self):
         tests = [
-                  # regular and quoting tests
-                  (u'd = 4,c=3,b=2,a= 1 ',    ([], {u'd': u'4',
-                                                    u'c': u'3,b=2,a= 1'}, [])),
-                  (u'a,b,c,d',                ([u'a', u'b,c,d'], {}, [])),
-                  (u'a=b,b,c,d',              ([], {u'a': u'b'}, [u'b,c,d'])),
-                ]
+            # regular and quoting tests
+            (u'd = 4,c=3,b=2,a= 1 ', ([], {u'd': u'4', u'c': u'3,b=2,a= 1'}, [])),
+            (u'a,b,c,d', ([u'a', u'b,c,d'], {}, [])),
+            (u'a=b,b,c,d', ([], {u'a': u'b'}, [u'b,c,d'])),
+        ]
         for args, expected in tests:
             result = paramparser.parse_quoted_separated(args, seplimit=1)
             assert expected == result
@@ -98,11 +85,11 @@
 
     def testDoubleNameValueSeparator(self):
         tests = [
-                  # regular and quoting tests
-                  (u'd==4,=3 ',    ([], {u'd': u'=4', u'': u'3'}, [])),
-                  (u'===a,b,c,d',  ([], {u'': u'==a'}, [u'b', u'c', u'd'])),
-                  (u'a,b,===,c,d', ([u'a', u'b'], {u'': u'=='}, [u'c', u'd'])),
-                ]
+            # regular and quoting tests
+            (u'd==4,=3 ', ([], {u'd': u'=4', u'': u'3'}, [])),
+            (u'===a,b,c,d', ([], {u'': u'==a'}, [u'b', u'c', u'd'])),
+            (u'a,b,===,c,d', ([u'a', u'b'], {u'': u'=='}, [u'c', u'd'])),
+        ]
 
         def _check(a, e):
             r = paramparser.parse_quoted_separated(a)
@@ -114,21 +101,19 @@
     def testNoNameValue(self):
         abcd = [u'a', u'b', u'c', u'd']
         tests = [
-                  # regular and quoting tests
-                  (u'd = 4,c=3,b=2,a= 1 ',    [u'd = 4', u'c=3',
-                                               u'b=2', u'a= 1']),
-                  (u'a,b,c,d',                abcd),
-                  (u' a , b , c , d ',        abcd),
-                  (u'   a   ',                [u'a']),
-                  (u'"  a  "',                [u'  a  ']),
-                  (u'a,b,c,d, "a,b,c,d"',     abcd + [u'a,b,c,d']),
-                  (u'quote " :), b',          [u'quote " :)', u'b']),
-                  (u'"quote "" :)", b',       [u'quote " :)', u'b']),
-                  (u'"unended quote',         [u'"unended quote']),
-                  (u'"',                      [u'"']),
-                  (u'd=d,e="a,b,c,d"',        [u'd=d', u'e="a', u'b',
-                                               u'c', u'd"']),
-                ]
+            # regular and quoting tests
+            (u'd = 4,c=3,b=2,a= 1 ', [u'd = 4', u'c=3', u'b=2', u'a= 1']),
+            (u'a,b,c,d', abcd),
+            (u' a , b , c , d ', abcd),
+            (u'   a   ', [u'a']),
+            (u'"  a  "', [u'  a  ']),
+            (u'a,b,c,d, "a,b,c,d"', abcd + [u'a,b,c,d']),
+            (u'quote " :), b', [u'quote " :)', u'b']),
+            (u'"quote "" :)", b', [u'quote " :)', u'b']),
+            (u'"unended quote', [u'"unended quote']),
+            (u'"', [u'"']),
+            (u'd=d,e="a,b,c,d"', [u'd=d', u'e="a', u'b', u'c', u'd"']),
+        ]
         for args, expected in tests:
             result = paramparser.parse_quoted_separated(args, name_value=False)
             assert expected == result
@@ -279,7 +264,6 @@
             (u'a:b:c d:e:f', None, u':', [(u'a', u'b', u'c'), (u'd', 'e', u'f')]),
             (u'a:b:c:d', None, u':', [(u'a', u'b', u'c', u'd')]),
             (u'a:"b:c":d', None, u':', [(u'a', u'b:c', u'd')]),
-
             (u'-a:b:d', None, u':', [(M, u'a', u'b', u'd')]),
             (u'"-a:b:d"', None, u':', [(u'-a:b:d')]),
             (u'-"a:b:d"', None, u':', [(M, u'a:b:d')]),
@@ -313,13 +297,14 @@
 
         def _check(args, sep, kwsep, err):
             pytest.raises(err,
-                           paramparser.parse_quoted_separated_ext,
-                           args, sep, kwsep,
-                           brackets=(u'<>', u'()'))
+                          paramparser.parse_quoted_separated_ext,
+                          args, sep, kwsep,
+                          brackets=(u'<>', u'()'))
 
         for test in tests:
             yield [_check] + list(test)
 
+
 class TestArgGetters(object):
     def testGetBoolean(self):
         tests = [
@@ -360,7 +345,7 @@
         pytest.raises(ValueError, paramparser.get_bool, u'')
         pytest.raises(ValueError, paramparser.get_bool, u'42')
         pytest.raises(ValueError, paramparser.get_bool, u'wrong')
-        pytest.raises(ValueError, paramparser.get_bool, u'"True"') # must not be quoted!
+        pytest.raises(ValueError, paramparser.get_bool, u'"True"')  # must not be quoted!
 
     def testGetInt(self):
         tests = [
@@ -394,7 +379,7 @@
         pytest.raises(ValueError, paramparser.get_int, u'')
         pytest.raises(ValueError, paramparser.get_int, u'23.42')
         pytest.raises(ValueError, paramparser.get_int, u'wrong')
-        pytest.raises(ValueError, paramparser.get_int, u'"4711"') # must not be quoted!
+        pytest.raises(ValueError, paramparser.get_int, u'"4711"')  # must not be quoted!
 
     def testGetFloat(self):
         tests = [
@@ -429,7 +414,7 @@
         # any value not convertable to int raises ValueError
         pytest.raises(ValueError, paramparser.get_float, u'')
         pytest.raises(ValueError, paramparser.get_float, u'wrong')
-        pytest.raises(ValueError, paramparser.get_float, u'"47.11"') # must not be quoted!
+        pytest.raises(ValueError, paramparser.get_float, u'"47.11"')  # must not be quoted!
 
     def testGetComplex(self):
         tests = [
@@ -444,10 +429,10 @@
             (u'-23.42', None, None, -23.42),
             (u'-23.42E3', None, None, -23.42E3),
             (u'23.42E-3', None, None, 23.42E-3),
-            (u'23.42E-3+3.04j', None, None, 23.42E-3+3.04j),
+            (u'23.42E-3+3.04j', None, None, 23.42E-3 + 3.04j),
             (u'3.04j', None, None, 3.04j),
             (u'-3.04j', None, None, -3.04j),
-            (u'23.42E-3+3.04i', None, None, 23.42E-3+3.04j),
+            (u'23.42E-3+3.04i', None, None, 23.42E-3 + 3.04j),
             (u'3.04i', None, None, 3.04j),
             (u'-3.04i', None, None, -3.04j),
             (u'-3', None, None, -3L),
@@ -476,7 +461,7 @@
         pytest.raises(ValueError, paramparser.get_complex, u'3Ij')
         pytest.raises(ValueError, paramparser.get_complex, u'3i-3i')
         pytest.raises(ValueError, paramparser.get_complex, u'wrong')
-        pytest.raises(ValueError, paramparser.get_complex, u'"47.11"') # must not be quoted!
+        pytest.raises(ValueError, paramparser.get_complex, u'"47.11"')  # must not be quoted!
 
     def testGetUnicode(self):
         tests = [
@@ -563,16 +548,16 @@
         ief(self._test_invoke_int_None, u'i=')
         ief(self._test_invoke_int_None, u'')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_int_None, u'x')
+                      self._test_invoke_int_None, u'x')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_int_None, u'""')
+                      self._test_invoke_int_None, u'""')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_int_None, u'i=""')
+                      self._test_invoke_int_None, u'i=""')
         pytest.raises(ValueError, ief,
-                       _test_invoke_int_fixed, u'a=7', [7, 8])
+                      _test_invoke_int_fixed, u'a=7', [7, 8])
         ief(_test_invoke_int_fixed, u'i=1', [7, 8])
         pytest.raises(ValueError, ief,
-                       _test_invoke_int_fixed, u'i=""', [7, 8])
+                      _test_invoke_int_fixed, u'i=""', [7, 8])
         ief(_test_invoke_int_fixed, u'i=', [7, 8])
 
         for choicefn in (self._test_invoke_choice, self._test_invoke_choicet):
@@ -581,20 +566,20 @@
             ief(choicefn, u'choice=', [7])
             ief(choicefn, u'choice="a"', [7])
             pytest.raises(ValueError, ief,
-                           choicefn, u'x', [7])
+                          choicefn, u'x', [7])
             pytest.raises(ValueError, ief,
-                           choicefn, u'choice=x', [7])
+                          choicefn, u'choice=x', [7])
 
         ief(self._test_invoke_float_None, u'i=1.4')
         ief(self._test_invoke_float_None, u'i=')
         ief(self._test_invoke_float_None, u'')
         ief(self._test_invoke_float_None, u'1.4')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_float_None, u'x')
+                      self._test_invoke_float_None, u'x')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_float_None, u'""')
+                      self._test_invoke_float_None, u'""')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_float_None, u'i=""')
+                      self._test_invoke_float_None, u'i=""')
         ief(self._test_trailing, u'a=7, a')
         ief(self._test_trailing, u'7, a')
         ief(self._test_arbitrary_kw, u'test=x, \xc3=test',
@@ -608,15 +593,15 @@
         ief(self._test_arbitrary_kw, u'7 \xc3=test, test= x ',
             [{u'7 \xc3': 'test', 'test': u'x'}])
         pytest.raises(ValueError, ief,
-                       self._test_invoke_float_required, u'')
+                      self._test_invoke_float_required, u'')
         ief(self._test_invoke_float_required, u'1.4')
         ief(self._test_invoke_float_required, u'i=1.4')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_choice_required, u'')
+                      self._test_invoke_choice_required, u'')
         ief(self._test_invoke_choice_required, u'a')
         ief(self._test_invoke_choice_required, u'i=a')
         pytest.raises(ValueError, ief,
-                       self._test_invoke_float_required, u',')
+                      self._test_invoke_float_required, u',')
 
     def testConstructors(self):
         ief = paramparser.invoke_extension_function
--- a/MoinMoin/util/_tests/test_pysupport.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_pysupport.py	Sun Mar 03 07:44:25 2013 -0700
@@ -7,7 +7,8 @@
 """
 
 
-import os, errno
+import os
+import errno
 
 import pytest
 
@@ -26,13 +27,11 @@
 
     def testNonExistingModule(self):
         """ pysupport: import nonexistent module raises ImportError """
-        pytest.raises(ImportError, pysupport.importName,
-                       'MoinMoin.util.nonexistent', 'importName')
+        pytest.raises(ImportError, pysupport.importName, 'MoinMoin.util.nonexistent', 'importName')
 
     def testNonExistingAttribute(self):
         """ pysupport: import nonexistent attritbue raises AttributeError """
-        pytest.raises(AttributeError, pysupport.importName,
-                       'MoinMoin.util.pysupport', 'nonexistent')
+        pytest.raises(AttributeError, pysupport.importName, 'MoinMoin.util.pysupport', 'nonexistent')
 
     def testExisting(self):
         """ pysupport: import name from existing module """
@@ -72,10 +71,7 @@
         """ pysupport: import nonexistent wiki plugin fail """
         if self.pluginExists():
             pytest.skip('plugin exists: {0}'.format(self.plugin))
-        pytest.raises(plugins.PluginMissingError,
-                       plugins.importWikiPlugin,
-                           app.cfg, 'parser',
-                           self.plugin, 'Parser')
+        pytest.raises(plugins.PluginMissingError, plugins.importWikiPlugin, app.cfg, 'parser', self.plugin, 'Parser')
 
 
 class TestImportExisting(TestImportNameFromPlugin):
@@ -96,8 +92,7 @@
             self.createTestPlugin()
             # clear the plugin cache...
             app.cfg._site_plugin_lists = {}
-            parser = plugins.importWikiPlugin(app.cfg, 'parser',
-                                               self.plugin, 'Parser')
+            parser = plugins.importWikiPlugin(app.cfg, 'parser', self.plugin, 'Parser')
             assert getattr(parser, '__name__', None) == 'Parser'
             assert parser.key == self.key
         finally:
@@ -133,5 +128,6 @@
                 if err.errno != errno.ENOENT:
                     raise
 
+
 coverage_modules = ['MoinMoin.util.pysupport']
 pytest.main("-x test_pysupport.py")
--- a/MoinMoin/util/_tests/test_registry.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_registry.py	Sun Mar 03 07:44:25 2013 -0700
@@ -10,19 +10,24 @@
 
 from MoinMoin.util.registry import *
 
+
 def factory_all(arg):
     return 1
 
+
 def factory_all2(arg):
     return 3
 
+
 def factory_none(arg):
     pass
 
+
 def factory_special(arg):
     if arg == 'a':
         return 2
 
+
 def test_Registry_get():
     r = Registry()
 
@@ -38,6 +43,7 @@
     assert r.get(None) == 3
     assert r.get('a') == 3
 
+
 def test_Registry_lifecycle():
     r = Registry()
 
--- a/MoinMoin/util/_tests/test_send_file.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_send_file.py	Sun Mar 03 07:44:25 2013 -0700
@@ -7,10 +7,13 @@
 """
 
 import os
-import tempfile, shutil
+import tempfile
+import shutil
+
+import pytest
 
 from MoinMoin.util import send_file
-import pytest
+
 
 class TestFuid(object):
     """ test for send_file """
--- a/MoinMoin/util/_tests/test_thread_monitor.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_thread_monitor.py	Sun Mar 03 07:44:25 2013 -0700
@@ -6,11 +6,13 @@
 MoinMoin - MoinMoin.util.thread_monitor Tests
 """
 
-import shutil, tempfile
+import shutil
+import tempfile
 import os
 
 from MoinMoin.util.thread_monitor import Monitor
 
+
 class TestMonitor(object):
     """ Tests: Monitor """
 
--- a/MoinMoin/util/_tests/test_tree.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_tree.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,6 +8,7 @@
 
 from MoinMoin.util.tree import *
 
+
 def test_Name():
     uri = 'uri:a'
 
@@ -21,6 +22,7 @@
     assert isinstance(element, ET.Element)
     assert element.tag == name
 
+
 def test_Namespace():
     uri = 'uri:a'
 
@@ -58,8 +60,10 @@
     assert name.name == 'class_'
     assert name.uri == uri
 
+
 def test_html():
     assert isinstance(html, Namespace)
 
+
 def test_moin_page():
     assert isinstance(moin_page, Namespace)
--- a/MoinMoin/util/_tests/test_util.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_util.py	Sun Mar 03 07:44:25 2013 -0700
@@ -8,37 +8,38 @@
 
 from MoinMoin import util
 
+
 class TestUtil(object):
 
     def testRangeList(self):
         """ util.rangelist: test correct function for misc. input values """
         result = util.rangelist([])
         expected = ''
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42])
         expected = '42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([42, 23])
         expected = '23,42'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([1, 2, 3, 4, 5])
         expected = '1-5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 5, 3])
         expected = '2-3,5'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6])
         expected = '2-3,5-6'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
         result = util.rangelist([2, 3, 5, 6, 23, 100, 101, 102, 104])
         expected = '2-3,5-6,23,100-102,104'
-        assert result == expected, ('Expected "%(expected)s" but got "%(result)s"') % locals()
+        assert result == expected, 'Expected "%(expected)s" but got "%(result)s"' % locals()
 
 
 coverage_modules = ['MoinMoin.util']
--- a/MoinMoin/util/_tests/test_version.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/_tests/test_version.py	Sun Mar 03 07:44:25 2013 -0700
@@ -6,8 +6,10 @@
 """
 
 
+import pytest
+
 from MoinMoin.util.version import Version
-import pytest
+
 
 class TestVersion(object):
     def test_Version(self):
--- a/MoinMoin/util/diff3.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/diff3.py	Sun Mar 03 07:44:25 2013 -0700
@@ -135,7 +135,7 @@
             match_len = match(old, other, other_match[0], other_match[1],
                               difference)
             if match_len == difference:
-                return (new_match[0], other_match[1] + difference, new_match[1])
+                return new_match[0], other_match[1] + difference, new_match[1]
             else:
                 other_match = find_match(old, other,
                                          other_match[0] + match_len,
@@ -155,7 +155,7 @@
         # both conflicts change same number of lines
         # or no match till the end
         else:
-            return (new_match[0], other_match[1], new_match[1])
+            return new_match[0], other_match[1], new_match[1]
 
 
 def match(list1, list2, nr1, nr2, maxcount=3):
@@ -217,7 +217,7 @@
     elif hit2:
         return hit2
     else:
-        return (len1, len2)
+        return len1, len2
 
 
 def main():
--- a/MoinMoin/util/diff_text.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/diff_text.py	Sun Mar 03 07:44:25 2013 -0700
@@ -49,10 +49,10 @@
     while i < len(lines):
         marker = lines[i][0]
         if marker == ' ':
-            count = count + 1
-            i = i + 1
-            lcount_old = lcount_old + 1
-            lcount_new = lcount_new + 1
+            count += 1
+            i += 1
+            lcount_old += 1
+            lcount_new += 1
         elif marker in ['-', '+']:
             if (count == i) and count > 3:
                 lines[:i - 3] = []
@@ -67,9 +67,9 @@
                 count = 0
                 i += 1
             if marker == '-':
-                lcount_old = lcount_old + 1
+                lcount_old += 1
             else:
-                lcount_new = lcount_new + 1
+                lcount_new += 1
         elif marker == '?':
             lines[i:i + 1] = []
 
--- a/MoinMoin/util/iri.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/iri.py	Sun Mar 03 07:44:25 2013 -0700
@@ -62,8 +62,7 @@
 
     _overall_re = re.compile(overall_rules, re.X)
 
-    def __init__(self, _iri=None, _quoted=True,
-            scheme=None, authority=None, path=None, query=None, fragment=None):
+    def __init__(self, _iri=None, _quoted=True, scheme=None, authority=None, path=None, query=None, fragment=None):
         """
         @param _iri A full IRI in unicode
         @param scheme Scheme part of the IRI, overrides the same part of the IRI.
@@ -163,13 +162,13 @@
 
     def __repr__(self):
         return '{0}(scheme={1!r}, authority={2!r}, path={3!r}, query={4!r}, fragment={5!r})'.format(
-                self.__class__.__name__,
-                self.scheme,
-                self._authority,
-                self._path,
-                self._query,
-                self._fragment,
-                )
+            self.__class__.__name__,
+            self.scheme,
+            self._authority,
+            self._path,
+            self._query,
+            self._fragment,
+        )
 
     def __unicode__(self):
         ret = []
@@ -216,8 +215,7 @@
                     else:
                         new_path = self.path + new_path
 
-            return Iri(scheme=new_scheme, authority=new_authority, path=new_path,
-                    query=new_query, fragment=other.fragment)
+            return Iri(scheme=new_scheme, authority=new_authority, path=new_path, query=new_query, fragment=other.fragment)
 
         if isinstance(other, basestring):
             return self + Iri(other)
@@ -232,8 +230,7 @@
 
     def __set_scheme(self, value):
         self._scheme = unicode(value).lower()
-    scheme = property(__get_scheme, __set_scheme, __del_scheme,
-            """Scheme part of the IRI.""")
+    scheme = property(__get_scheme, __set_scheme, __del_scheme, """Scheme part of the IRI.""")
 
     def __del_authority(self):
         self._authority = None
@@ -245,8 +242,7 @@
         if value.__class__ is not IriAuthority:
             value = IriAuthority(value, False)
         self._authority = value
-    authority = property(__get_authority, __set_authority, __del_authority,
-            """Authority part of the IRI.""")
+    authority = property(__get_authority, __set_authority, __del_authority, """Authority part of the IRI.""")
 
     def __del_path(self):
         self._path = None
@@ -258,8 +254,7 @@
         if value.__class__ is not IriPath:
             value = IriPath(value, False)
         self._path = value
-    path = property(__get_path, __set_path, __del_path,
-            """Path part of the IRI.""")
+    path = property(__get_path, __set_path, __del_path, """Path part of the IRI.""")
 
     def __del_query(self):
         self._query = None
@@ -269,8 +264,7 @@
 
     def __set_query(self, value):
         self._query = IriQuery(value, False)
-    query = property(__get_query, __set_query, __del_query,
-            """Query part of the IRI.""")
+    query = property(__get_query, __set_query, __del_query, """Query part of the IRI.""")
 
     def __del_fragment(self):
         self._fragment = None
@@ -280,8 +274,7 @@
 
     def __set_fragment(self, value):
         self._fragment = IriFragment(value, False)
-    fragment = property(__get_fragment, __set_fragment, __del_fragment,
-            """Fragment part of the IRI.""")
+    fragment = property(__get_fragment, __set_fragment, __del_fragment, """Fragment part of the IRI.""")
 
 
 class _Value(unicode):
@@ -434,8 +427,7 @@
 
     _authority_re = re.compile(authority_rules, re.X)
 
-    def __init__(self, iri_authority=None, _quoted=True,
-            userinfo=None, host=None, port=None):
+    def __init__(self, iri_authority=None, _quoted=True, userinfo=None, host=None, port=None):
         self._userinfo = self._host = self.port = None
 
         if iri_authority:
@@ -458,8 +450,8 @@
             return unicode(self) == other
         if isinstance(other, IriAuthority):
             return self._userinfo == other._userinfo and \
-                    self._host == other._host and \
-                    self.port == other.port
+                self._host == other._host and \
+                self.port == other.port
         return NotImplemented
 
     def __nonzero__(self):
@@ -469,11 +461,11 @@
 
     def __repr__(self):
         return '{0}(userinfo={1!r}, host={2!r}, port={3!r})'.format(
-                self.__class__.__name__,
-                self._userinfo,
-                self._host,
-                self.port,
-                )
+            self.__class__.__name__,
+            self._userinfo,
+            self._host,
+            self.port,
+        )
 
     def __unicode__(self):
         return self.__get(self._userinfo, self._host)
@@ -630,9 +622,9 @@
 
     def __repr__(self):
         return '{0}({1!r})'.format(
-                self.__class__.__name__,
-                unicode(self),
-                )
+            self.__class__.__name__,
+            unicode(self),
+        )
 
     def _remove_dots(self, segments):
         if not segments or segments[0] != '':
--- a/MoinMoin/util/mimetype.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/mimetype.py	Sun Mar 03 07:44:25 2013 -0700
@@ -17,43 +17,43 @@
 mimetypes.init(mimetypes.knownfiles)
 
 MIMETYPES_MORE = {
- # OpenOffice 2.x & other open document stuff
- '.odt': 'application/vnd.oasis.opendocument.text',
- '.ods': 'application/vnd.oasis.opendocument.spreadsheet',
- '.odp': 'application/vnd.oasis.opendocument.presentation',
- '.odg': 'application/vnd.oasis.opendocument.graphics',
- '.odc': 'application/vnd.oasis.opendocument.chart',
- '.odf': 'application/vnd.oasis.opendocument.formula',
- '.odb': 'application/vnd.oasis.opendocument.database',
- '.odi': 'application/vnd.oasis.opendocument.image',
- '.odm': 'application/vnd.oasis.opendocument.text-master',
- '.ott': 'application/vnd.oasis.opendocument.text-template',
- '.ots': 'application/vnd.oasis.opendocument.spreadsheet-template',
- '.otp': 'application/vnd.oasis.opendocument.presentation-template',
- '.otg': 'application/vnd.oasis.opendocument.graphics-template',
- # some systems (like Mac OS X) don't have some of these:
- '.patch': 'text/x-diff',
- '.diff': 'text/x-diff',
- '.py': 'text/x-python',
- '.cfg': 'text/plain',
- '.conf': 'text/plain',
- '.irc': 'text/plain',
- '.md5': 'text/plain',
- '.csv': 'text/csv',
- '.rst': 'text/x-rst',
- '.flv': 'video/x-flv',
- '.wmv': 'video/x-ms-wmv',
- '.wma': 'audio/x-ms-wma',
- '.swf': 'application/x-shockwave-flash',
- '.awd': 'application/x-anywikidraw',
- '.twd': 'application/x-twikidraw',
- '.swd': 'application/x-svgdraw',
- '.dbx': 'application/docbook+xml',
- '.moin': 'text/x.moin.wiki',
- '.creole': 'text/x.moin.creole',
- '.mediawiki': 'text/x-mediawiki',
- '.ico': 'image/x-icon',
- '.svg': 'image/svg+xml'
+    # OpenOffice 2.x & other open document stuff
+    '.odt': 'application/vnd.oasis.opendocument.text',
+    '.ods': 'application/vnd.oasis.opendocument.spreadsheet',
+    '.odp': 'application/vnd.oasis.opendocument.presentation',
+    '.odg': 'application/vnd.oasis.opendocument.graphics',
+    '.odc': 'application/vnd.oasis.opendocument.chart',
+    '.odf': 'application/vnd.oasis.opendocument.formula',
+    '.odb': 'application/vnd.oasis.opendocument.database',
+    '.odi': 'application/vnd.oasis.opendocument.image',
+    '.odm': 'application/vnd.oasis.opendocument.text-master',
+    '.ott': 'application/vnd.oasis.opendocument.text-template',
+    '.ots': 'application/vnd.oasis.opendocument.spreadsheet-template',
+    '.otp': 'application/vnd.oasis.opendocument.presentation-template',
+    '.otg': 'application/vnd.oasis.opendocument.graphics-template',
+    # some systems (like Mac OS X) don't have some of these:
+    '.patch': 'text/x-diff',
+    '.diff': 'text/x-diff',
+    '.py': 'text/x-python',
+    '.cfg': 'text/plain',
+    '.conf': 'text/plain',
+    '.irc': 'text/plain',
+    '.md5': 'text/plain',
+    '.csv': 'text/csv',
+    '.rst': 'text/x-rst',
+    '.flv': 'video/x-flv',
+    '.wmv': 'video/x-ms-wmv',
+    '.wma': 'audio/x-ms-wma',
+    '.swf': 'application/x-shockwave-flash',
+    '.awd': 'application/x-anywikidraw',
+    '.twd': 'application/x-twikidraw',
+    '.swd': 'application/x-svgdraw',
+    '.dbx': 'application/docbook+xml',
+    '.moin': 'text/x.moin.wiki',
+    '.creole': 'text/x.moin.creole',
+    '.mediawiki': 'text/x-mediawiki',
+    '.ico': 'image/x-icon',
+    '.svg': 'image/svg+xml',
 }
 
 # add all mimetype patterns of pygments
--- a/MoinMoin/util/monkeypatch.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/monkeypatch.py	Sun Mar 03 07:44:25 2013 -0700
@@ -20,8 +20,7 @@
 
 class BaseRequestHandler(werkzeug.serving.BaseRequestHandler):
     def log(self, type, message, *args):
-        _log(type, "{0} {1}\n".format(self.address_string(),
-                                message % args))
+        _log(type, "{0} {1}\n".format(self.address_string(), message % args))
 
 werkzeug.serving.BaseRequestHandler = BaseRequestHandler
 werkzeug.serving.WSGIRequestHandler = BaseRequestHandler
--- a/MoinMoin/util/paramparser.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/paramparser.py	Sun Mar 03 07:44:25 2013 -0700
@@ -182,7 +182,7 @@
                 continue
             idx -= 1
             if len(cur) and cur[-1]:
-                cur[-1] = cur[-1] + spaces
+                cur[-1] += spaces
         elif not quoted and char == name_value_separator:
             if multikey or len(cur) == 1:
                 cur.append(None)
@@ -529,7 +529,7 @@
                 return ret
         if self._defaultunit is not None:
             try:
-                return (self._type(s), self._defaultunit)
+                return self._type(s), self._defaultunit
             except ValueError:
                 pass
         units = ', '.join(self._units)
@@ -614,8 +614,7 @@
             if isinstance(default.argtype, (tuple, list)):
                 # treat choice specially and return None if no choice
                 # is given in the value
-                return get_choice(value, name, list(default.argtype),
-                       default_none=True)
+                return get_choice(value, name, list(default.argtype), default_none=True)
             else:
                 return _convert_arg(value, default.argtype, name)
         return value
--- a/MoinMoin/util/plugins.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/plugins.py	Sun Mar 03 07:44:25 2013 -0700
@@ -234,8 +234,5 @@
 
 Make sure your data directory path is correct, check permissions, and
 that the data/plugin directory has an __init__.py file.
-""" % {
-    'path': pdir,
-    'err': str(err),
-}
+""" % dict(path=pdir, err=str(err))
         raise error.ConfigurationError(msg)
--- a/MoinMoin/util/version.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/util/version.py	Sun Mar 03 07:44:25 2013 -0700
@@ -32,13 +32,14 @@
     Also, we inherit all the comparison logic from tuple base class.
     """
     VERSION_RE = re.compile(
-        r"""(?P<major>\d+)
-            \.
-            (?P<minor>\d+)
-            \.
-            (?P<release>\d+)
-            (?P<additional>[abc]\d+)?""",
-            re.VERBOSE)
+        r"""
+        (?P<major>\d+)
+        \.
+        (?P<minor>\d+)
+        \.
+        (?P<release>\d+)
+        (?P<additional>[abc]\d+)?""",
+        re.VERBOSE)
 
     @classmethod
     def parse_version(cls, version):
--- a/MoinMoin/wikiutil.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/MoinMoin/wikiutil.py	Sun Mar 03 07:44:25 2013 -0700
@@ -23,7 +23,7 @@
 from flask import request
 
 from MoinMoin.constants.contenttypes import CHARSET
-from MoinMoin.constants.keys import CURRENT, IS_SYSITEM
+from MoinMoin.constants.keys import CURRENT
 from MoinMoin.constants.misc import URI_SCHEMES, CLEAN_INPUT_TRANSLATION_MAP, ITEM_INVALID_CHARS_REGEX
 from MoinMoin.constants.contenttypes import DRAWING_EXTENSIONS
 
@@ -113,20 +113,6 @@
 ### Item types / Item names
 #############################################################################
 
-def isSystemItem(itemname):
-    """ Is this a system page?
-
-    :param itemname: the item name
-    :rtype: bool
-    :returns: True if page is a system item
-    """
-    try:
-        item = flaskg.storage[itemname]
-        return item[CURRENT][IS_SYSITEM]
-    except (NoSuchItemError, NoSuchRevisionError, KeyError):
-        return False
-
-
 def isGroupItem(itemname):
     """ Is this a name of group item?
 
--- a/_ui_tests/conftest.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/_ui_tests/conftest.py	Sun Mar 03 07:44:25 2013 -0700
@@ -9,6 +9,7 @@
 
 import os
 import sys
+
 sys.path.append(os.path.dirname(__file__))
 import driver_register
 
--- a/setup.cfg	Sat Mar 02 14:09:49 2013 -0700
+++ b/setup.cfg	Sun Mar 03 07:44:25 2013 -0700
@@ -46,16 +46,12 @@
 norecursedirs = .hg _build tmp* env* dlc wiki
 minversion = 2.0
 pep8ignore =
- *.py E121 E122 E123 E124 E125 E126 E127 E128  # continuation line indentation
+ *.py E124  # closing bracket does not match visual indentation (behaves strange!?)
+ *.py E125  # continuation line does not distinguish itself from next logical line (difficult to avoid!)
  *.py E501  # maximum line length (see also pep8maxlinelength)
- */_tests/*.py E225 E226  # missing whitespace / missing optional whitespace around operator
- */_tests/*.py E261  # less than 2 blanks before inline comment
- */_tests/*.py E301 E302  # separate toplevel definitions with 2 empty lines, method defs inside class by 1 empty line
- */_tests/*.py E401  # imports on separate lines
+ MoinMoin/config/default.py E501  # maximum line length (long lines expected there)
+ MoinMoin/constants/chartypes.py E501  # auto-generated, long lines
  wikiconfig_*.py ALL  # local stuff, not in the repo
- MoinMoin/config/default.py E501  # maximum line length (long lines expected there)
- MoinMoin/util/_tests/test_paramparser.py E241 # whitespace around comma (we have some "tabular" formatting there)
- MoinMoin/constants/chartypes.py E501  # auto-generated, long lines
  MoinMoin/script/migration/moin19/_logfile19.py ALL  # legacy code "as is"
  MoinMoin/script/migration/moin19/_utils19.py ALL  # legacy code "as is"
  docs/conf.py ALL  # sphinx stuff, automatically generated, don't check this
--- a/setup.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/setup.py	Sun Mar 03 07:44:25 2013 -0700
@@ -63,18 +63,19 @@
     #             'MoinMoin.apps.misc.templates': 'MoinMoin/apps/misc/templates',
     #            },
 
-    package_data={'MoinMoin.translations': ['MoinMoin.pot', '*.po', ],
-                  'MoinMoin.static': ['*', ],
-                  'MoinMoin.themes.modernized': ['*', ],
-                  'MoinMoin.themes.foobar': ['*', ],
-                  'MoinMoin.templates': ['*.html', '*.xml', ],
-                  'MoinMoin.apps.admin.templates': ['*.html', ],
-                  'MoinMoin.apps.misc.templates': ['*.html', '*.txt', ],
-                 },
+    package_data={
+        'MoinMoin.translations': ['MoinMoin.pot', '*.po', ],
+        'MoinMoin.static': ['*', ],
+        'MoinMoin.themes.modernized': ['*', ],
+        'MoinMoin.themes.foobar': ['*', ],
+        'MoinMoin.templates': ['*.html', '*.xml', ],
+        'MoinMoin.apps.admin.templates': ['*.html', ],
+        'MoinMoin.apps.misc.templates': ['*.html', '*.txt', ],
+    },
     include_package_data=True,
     zip_safe=False,
     dependency_links=[
-        #'https://github.com/mitsuhiko/werkzeug/tarball/master#egg=Werkzeug-0.7dev',
+        # 'https://github.com/mitsuhiko/werkzeug/tarball/master#egg=Werkzeug-0.7dev',
         'https://bitbucket.org/thomaswaldmann/whoosh/get/2.4x.tar.gz#egg=Whoosh-2.4.99dev',
         # fixed flask-themes, 0.1.3 does not work for flask 0.8.x, thus we use a faked 0.1.3.1:
         'https://bitbucket.org/thomaswaldmann/flask-themes/get/24dcc703953f.tar.gz#egg=Flask-Themes-0.1.3.1',
--- a/wikiconfig.py	Sat Mar 02 14:09:49 2013 -0700
+++ b/wikiconfig.py	Sun Mar 03 07:44:25 2013 -0700
@@ -31,18 +31,18 @@
     # This provides a simple default setup for your backend configuration.
     # 'stores:fs:...' indicates that you want to use the filesystem backend.
     # Alternatively you can set up the mapping yourself (see HelpOnStorageConfiguration).
-    namespace_mapping, backend_mapping, acl_mapping = \
-        create_simple_mapping(uri='stores:fs:{0}/%(backend)s/%(kind)s'.format(data_dir),
-                              # XXX we use rather relaxed ACLs for the development wiki:
-                              content_acl=dict(before=u'',
-                                               default=u'All:read,write,create,destroy,admin',
-                                               after=u'',
-                                               hierarchic=False, ),
-                              user_profile_acl=dict(before=u'',
-                                                    default=u'All:read,write,create,destroy,admin',
-                                                    after=u'',
-                                                    hierarchic=False, ),
-                             )
+    namespace_mapping, backend_mapping, acl_mapping = create_simple_mapping(
+        uri='stores:fs:{0}/%(backend)s/%(kind)s'.format(data_dir),
+        # XXX we use rather relaxed ACLs for the development wiki:
+        content_acl=dict(before=u'',
+                         default=u'All:read,write,create,destroy,admin',
+                         after=u'',
+                         hierarchic=False, ),
+        user_profile_acl=dict(before=u'',
+                              default=u'All:read,write,create,destroy,admin',
+                              after=u'',
+                              hierarchic=False, ),
+    )
 
     #item_root = u'Home' # front page
 
@@ -63,12 +63,13 @@
     # see https://bitbucket.org/thomaswaldmann/xstatic for infos about xstatic:
     from xstatic.main import XStatic
     # names below must be package names
-    mod_names = ['jquery', 'jquery_file_upload',
-                 'json_js',
-                 'ckeditor',
-                 'svgweb',
-                 'svgedit_moin', 'twikidraw_moin', 'anywikidraw',
-                ]
+    mod_names = [
+        'jquery', 'jquery_file_upload',
+        'json_js',
+        'ckeditor',
+        'svgweb',
+        'svgedit_moin', 'twikidraw_moin', 'anywikidraw',
+    ]
     pkg = __import__('xstatic.pkg', fromlist=mod_names)
     for mod_name in mod_names:
         mod = getattr(pkg, mod_name)