changeset 135:75312c9b94e3

use except...as syntax, use raise Exception(...) syntax, fix some imports
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 20 Mar 2011 02:31:24 +0100
parents 901bd4e1861e
children 13bce99cba0b
files MoinMoin/_tests/ldap_testbase.py MoinMoin/_tests/maketestwiki.py MoinMoin/_tests/test_sourcecode.py MoinMoin/app.py MoinMoin/apps/admin/views.py MoinMoin/apps/feed/views.py MoinMoin/auth/ldap_login.py MoinMoin/converter/__init__.py MoinMoin/converter/archive_in.py MoinMoin/converter/macro.py MoinMoin/log.py MoinMoin/macro/Date.py MoinMoin/macro/PagenameList.py MoinMoin/mail/sendmail.py MoinMoin/signalling/__init__.py MoinMoin/signalling/log.py MoinMoin/storage/backends/fileserver.py MoinMoin/storage/backends/flatfile.py MoinMoin/storage/backends/fs.py MoinMoin/storage/backends/fs19.py MoinMoin/storage/backends/fs19_logfile.py MoinMoin/storage/backends/fs2.py MoinMoin/storage/backends/hg.py MoinMoin/storage/backends/indexing.py MoinMoin/storage/backends/memory.py MoinMoin/themes/__init__.py MoinMoin/user.py MoinMoin/util/SubProcess.py MoinMoin/util/_tests/test_pysupport.py MoinMoin/util/filesys.py MoinMoin/util/lock.py MoinMoin/util/plugins.py
diffstat 32 files changed, 72 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/_tests/ldap_testbase.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/_tests/ldap_testbase.py	Sun Mar 20 02:31:24 2011 +0100
@@ -65,7 +65,7 @@
         rc = p.wait()
         if pid and rc == 1:
             slapd = True  # it works
-    except OSError, err:
+    except OSError as err:
         import errno
         if not (err.errno == errno.ENOENT or
                 (err.errno == 3 and os.name == 'nt')):
@@ -116,7 +116,7 @@
                 try:
                     lo.simple_bind_s('', '')
                     started = True
-                except ldap.SERVER_DOWN, err:
+                except ldap.SERVER_DOWN as err:
                     time.sleep(0.1)
                 else:
                     break
--- a/MoinMoin/_tests/maketestwiki.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/_tests/maketestwiki.py	Sun Mar 20 02:31:24 2011 +0100
@@ -25,7 +25,7 @@
     dir = 'data'
     try:
         shutil.rmtree(os.path.join(WIKI, dir))
-    except OSError, err:
+    except OSError as err:
         if not (err.errno == errno.ENOENT or
                 (err.errno == 3 and os.name == 'nt')):
             raise
@@ -41,7 +41,7 @@
 def run(skip_if_existing=False):
     try:
         os.makedirs(WIKI)
-    except OSError, e:
+    except OSError as e:
         if e.errno != errno.EEXIST:
             raise
 
--- a/MoinMoin/_tests/test_sourcecode.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/_tests/test_sourcecode.py	Sun Mar 20 02:31:24 2011 +0100
@@ -11,7 +11,7 @@
 
 import re, time
 import py
-import pep8
+from . import pep8
 
 
 moindir = py.path.local(__file__).pypkgpath()
--- a/MoinMoin/app.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/app.py	Sun Mar 20 02:31:24 2011 +0100
@@ -279,7 +279,7 @@
 
         try:
             flaskg.user = setup_user()
-        except HTTPException, e:
+        except HTTPException as e:
             # this makes stuff like abort(redirect(...)) work
             return app.handle_http_exception(e)
 
--- a/MoinMoin/apps/admin/views.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/apps/admin/views.py	Sun Mar 20 02:31:24 2011 +0100
@@ -114,7 +114,7 @@
         xmlfile = request.files.get('xmlfile')
         try:
             upgrade_sysitems(xmlfile)
-        except BackendError, e:
+        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!'))
--- a/MoinMoin/apps/feed/views.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/apps/feed/views.py	Sun Mar 20 02:31:24 2011 +0100
@@ -57,7 +57,7 @@
                     # full html rendering for new items
                     content = hl_item._render_data()
                 content_type = 'xhtml'
-            except Exception, e:
+            except Exception as e:
                 logging.exception("content rendering crashed")
                 content = _(u'MoinMoin feels unhappy.')
                 content_type = 'text'
--- a/MoinMoin/auth/ldap_login.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/auth/ldap_login.py	Sun Mar 20 02:31:24 2011 +0100
@@ -22,7 +22,7 @@
 
 try:
     import ldap
-except ImportError, err:
+except ImportError as err:
     logging.error("You need to have python-ldap installed (%s)." % str(err))
     raise
 
@@ -161,7 +161,7 @@
                     try:
                         l.start_tls_s()
                         logging.debug("Using TLS to %r." % server)
-                    except (ldap.SERVER_DOWN, ldap.CONNECT_ERROR), err:
+                    except (ldap.SERVER_DOWN, ldap.CONNECT_ERROR) as err:
                         logging.warning("Couldn't establish TLS to %r (err: %s)." % (server, str(err)))
                         raise
 
@@ -240,7 +240,7 @@
                 u.aliasname = aliasname
                 logging.debug("creating user object with name %r email %r alias %r" % (username, email, aliasname))
 
-            except ldap.INVALID_CREDENTIALS, err:
+            except ldap.INVALID_CREDENTIALS as err:
                 logging.debug("invalid credentials (wrong password?) for dn %r (username: %r)" % (dn, username))
                 return CancelLogin(_("Invalid username or password."))
 
@@ -249,7 +249,7 @@
                 u.create_or_update(True)
             return ContinueLogin(u)
 
-        except ldap.SERVER_DOWN, err:
+        except ldap.SERVER_DOWN as err:
             # looks like this LDAP server isn't working, so we just try the next
             # authenticator object in cfg.auth list (there could be some second
             # ldap authenticator that queries a backup server or any other auth
--- a/MoinMoin/converter/__init__.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/converter/__init__.py	Sun Mar 20 02:31:24 2011 +0100
@@ -97,7 +97,7 @@
                 try:
                     try:
                         imp.load_module(module_complete, *info)
-                    except Exception, e:
+                    except Exception as e:
                         import MoinMoin.log as logging
                         logger = logging.getLogger(__name__)
                         logger.exception("Failed to import converter package %s: %s" % (module, e))
--- a/MoinMoin/converter/archive_in.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/converter/archive_in.py	Sun Mar 20 02:31:24 2011 +0100
@@ -57,7 +57,7 @@
                          self.process_name(name),
                         ) for size, dt, name in contents]
             return self.build_dom_table(contents)
-        except ArchiveException, err:
+        except ArchiveException as err:
             logging.exception("An exception within archive file handling occurred:")
             # XXX we also use a table for error reporting, could be
             # something more adequate, though:
@@ -91,7 +91,7 @@
                     tinfo.name,
                 ))
             return rows
-        except tarfile.TarError, err:
+        except tarfile.TarError as err:
             raise ArchiveException(str(err))
 
 
@@ -110,7 +110,7 @@
                     zinfo.filename,
                 ))
             return rows
-        except (RuntimeError, zipfile.BadZipfile), err:
+        except (RuntimeError, zipfile.BadZipfile) as err:
             # RuntimeError is raised by zipfile stdlib module in case of
             # problems (like inconsistent slash and backslash usage in the
             # archive or a defective zip file).
--- a/MoinMoin/converter/macro.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/converter/macro.py	Sun Mar 20 02:31:24 2011 +0100
@@ -70,7 +70,7 @@
             ret = macro((), args, page, alt, context_block)
 
             elem_body.append(ret)
-        except Exception, e:
+        except Exception as e:
             # we do not want that a faulty macro aborts rendering of the page
             # and makes the wiki UI unusable (by emitting a Server Error),
             # thus, in case of exceptions, we just log the problem and return
--- a/MoinMoin/log.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/log.py	Sun Mar 20 02:31:24 2011 +0100
@@ -125,7 +125,7 @@
             l = getLogger(__name__)
             l.info('using logging configuration read from "%s"' % conf_fname)
             warnings.showwarning = _log_warning
-        except Exception, err: # XXX be more precise
+        except Exception as err: # XXX be more precise
             err_msg = str(err)
     if not configured:
         # load builtin fallback logging config
--- a/MoinMoin/macro/Date.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/macro/Date.py	Sun Mar 20 02:31:24 2011 +0100
@@ -40,7 +40,7 @@
                         if sign == '-':
                             tzoffset = -tzoffset
                 tm = year, month, day, hour, minute, second, 0, 0, 0
-            except ValueError, err:
+            except ValueError as err:
                 raise ValueError("Bad timestamp %r: %s" % (args, err))
             # as mktime wants a localtime argument (but we only have UTC),
             # we adjust by our local timezone's offset
@@ -52,7 +52,7 @@
             # try raw seconds since epoch in UTC
             try:
                 tm = float(args)
-            except ValueError, err:
+            except ValueError as err:
                 raise ValueError("Bad timestamp %r: %s" % (args, err))
         return tm
 
--- a/MoinMoin/macro/PagenameList.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/macro/PagenameList.py	Sun Mar 20 02:31:24 2011 +0100
@@ -26,7 +26,7 @@
         if regex:
             try:
                 needle_re = re.compile(needle, re_flags)
-            except re.error, err:
+            except re.error as err:
                 raise ValueError("Error in regex %r: %s" % (needle, err))
         else:
             needle_re = re.compile(re.escape(needle), re_flags)
--- a/MoinMoin/mail/sendmail.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/mail/sendmail.py	Sun Mar 20 02:31:24 2011 +0100
@@ -152,10 +152,10 @@
                 except AttributeError:
                     # in case the connection failed, SMTP has no "sock" attribute
                     pass
-        except smtplib.SMTPException, e:
+        except smtplib.SMTPException as e:
             logging.exception("smtp mail failed with an exception.")
             return (0, str(e))
-        except (os.error, socket.error), 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,
--- a/MoinMoin/signalling/__init__.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/signalling/__init__.py	Sun Mar 20 02:31:24 2011 +0100
@@ -10,8 +10,8 @@
 
 
 # import all signals so they can be imported from here:
-from signals import *
+from .signals import *
 
 # import all signal handler modules so they install their handlers:
-import log
+from . import log
 
--- a/MoinMoin/signalling/log.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/signalling/log.py	Sun Mar 20 02:31:24 2011 +0100
@@ -6,7 +6,7 @@
 """
 
 
-from signals import *
+from .signals import *
 
 from MoinMoin import log
 logging = log.getLogger(__name__)
--- a/MoinMoin/storage/backends/fileserver.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/fileserver.py	Sun Mar 20 02:31:24 2011 +0100
@@ -119,7 +119,7 @@
         filepath = backend._item2path(name)
         try:
             self._fs_stat = os.stat(filepath)
-        except OSError, err:
+        except OSError as err:
             raise NoSuchItemError("No such item, %r" % name)
         self._fs_revisions = [0] # there is only 1 revision of each file/dir
         self._fs_meta = {} # no item level metadata
@@ -185,7 +185,7 @@
             content.extend(u" * [[/%s|%s/]]" % (name, name) for name in sorted(dirs))
             content.extend(u" * [[/%s|%s]]" % (name, name) for name in sorted(files))
             content = u'\r\n'.join(content)
-        except OSError, err:
+        except OSError as err:
             content = unicode(err)
         self._fs_data_file = StringIO(content.encode(config.charset))
 
--- a/MoinMoin/storage/backends/flatfile.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/flatfile.py	Sun Mar 20 02:31:24 2011 +0100
@@ -46,7 +46,7 @@
         self._path = path
         try:
             os.makedirs(path)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.EEXIST:
                 raise BackendError(str(err))
 
@@ -122,7 +122,7 @@
         revpath = self._rev_path(revision.item.name)
         try:
             os.unlink(revpath)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.ENOENT:
                 raise CouldNotDestroyError("Could not destroy revision #%d of item '%r' [errno: %d]" % (
                     revision.revno, revision.item.name, err.errno))
@@ -148,7 +148,7 @@
         revpath = self._rev_path(item.name)
         try:
             os.unlink(revpath)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.ENOENT:
                 raise CouldNotDestroyError("Could not destroy item '%r' [errno: %d]" % (
                     item.name, err.errno))
--- a/MoinMoin/storage/backends/fs.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/fs.py	Sun Mar 20 02:31:24 2011 +0100
@@ -71,7 +71,7 @@
 
         try:
             os.makedirs(path)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.EEXIST:
                 raise BackendError(str(err))
 
@@ -190,7 +190,7 @@
             revision._fs_file.close()
         try:
             os.unlink(revision._fs_revpath)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.ENOENT:
                 raise CouldNotDestroyError("Could not destroy revision #%d of item '%r' [errno: %d]" % (
                     revision.revno, revision.item.name, err.errno))
@@ -249,7 +249,7 @@
             try:
                 os.mkdir(ipath)
                 done = True
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise
             if cntr > 2 and not done and self._itemspace <= 2 ** 31:
@@ -355,7 +355,7 @@
             rp = os.path.join(self._path, item._fs_item_id, 'rev.%d' % rev.revno)
             try:
                 filesys.rename_no_overwrite(rev._fs_revpath, rp, delete_old=True)
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise
                 raise RevisionAlreadyExistsError("")
@@ -379,7 +379,7 @@
         path = os.path.join(self._path, item._fs_item_id)
         try:
             shutil.rmtree(path)
-        except OSError, err:
+        except OSError as err:
             raise CouldNotDestroyError("Could not destroy item '%r' [errno: %d]" % (
                 item.name, err.errno))
 
@@ -406,7 +406,7 @@
                 # metadata now empty, just rm the metadata file
                 try:
                     os.unlink(os.path.join(self._path, item._fs_item_id, 'meta'))
-                except OSError, err:
+                except OSError as err:
                     if err.errno != errno.ENOENT:
                         raise
                     # ignore, there might not have been metadata
@@ -435,7 +435,7 @@
                 f = open(p, 'rb')
                 metadata = pickle.load(f)
                 f.close()
-            except IOError, err:
+            except IOError as err:
                 if err.errno != errno.ENOENT:
                     raise
                 # no such file means no metadata was stored
--- a/MoinMoin/storage/backends/fs19.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/fs19.py	Sun Mar 20 02:31:24 2011 +0100
@@ -111,7 +111,7 @@
             try:
                 refs = refcount and 1 or 0
                 idx.insert().values(name=name, uuid=uuid, old_id=old_id, refcount=refs).execute()
-            except IntegrityError, err:
+            except IntegrityError as err:
                 # input maybe has duplicate names in user profiles
                 logging.warning("Multiple user profiles for name: %r" % name)
         return uuid
@@ -147,7 +147,7 @@
             uuid = make_uuid()
             try:
                 idx.insert().values(name=name, uuid=uuid).execute()
-            except IntegrityError, err:
+            except IntegrityError as err:
                 # shouldn't happen
                 logging.warning(str(err))
             return uuid
--- a/MoinMoin/storage/backends/fs19_logfile.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/fs19_logfile.py	Sun Mar 20 02:31:24 2011 +0100
@@ -147,7 +147,7 @@
                 # Open the file (NOT using codecs.open, it breaks our offset calculation. We decode it later.).
                 # Use binary mode in order to retain \r - otherwise the offset calculation would fail.
                 self._input = file(self.__filename, "rb", )
-            except IOError, err:
+            except IOError as err:
                 if err.errno == errno.ENOENT: # "file not found"
                     # XXX workaround if edit-log does not exist: just create it empty
                     # if this workaround raises another error, we don't catch
@@ -176,7 +176,7 @@
         """
         try:
             return os.path.getsize(self.__filename)
-        except OSError, err:
+        except OSError as err:
             if err.errno == errno.ENOENT:
                 return 0
             raise
@@ -200,7 +200,7 @@
                 return count
             finally:
                 f.close()
-        except (OSError, IOError), err:
+        except (OSError, IOError) as err:
             if err.errno == errno.ENOENT:
                 return 0
             raise
--- a/MoinMoin/storage/backends/fs2.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/fs2.py	Sun Mar 20 02:31:24 2011 +0100
@@ -117,7 +117,7 @@
         for path in (self._path, meta_path, data_path):
             try:
                 os.makedirs(path)
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise BackendError(str(err))
 
@@ -229,7 +229,7 @@
             os.unlink(rev._fs_path_meta)
             # XXX do refcount data files and if zero, kill it
             #os.unlink(rev._fs_path_data)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.ENOENT:
                 raise CouldNotDestroyError("Could not destroy revision #%d of item '%r' [errno: %d]" % (
                     rev.revno, rev.item.name, err.errno))
@@ -331,14 +331,14 @@
         else:
             try:
                 filesys.rename_no_overwrite(rev._fs_path_data, pd, delete_old=True)
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise
 
             pm = self._make_path('meta', item._fs_item_id, '%d.rev' % rev.revno)
             try:
                 filesys.rename_no_overwrite(rev._fs_path_meta, pm, delete_old=True)
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise
                 raise RevisionAlreadyExistsError("")
@@ -359,7 +359,7 @@
         path = self._make_path('meta', item_id)
         try:
             shutil.rmtree(path)
-        except OSError, err:
+        except OSError as err:
             raise CouldNotDestroyError("Could not destroy item '%r' [errno: %d]" % (
                 item.name, err.errno))
         # XXX do refcount data files and if zero, kill it
@@ -387,7 +387,7 @@
                 # metadata now empty, just rm the metadata file
                 try:
                     os.unlink(self._make_path('meta', item._fs_item_id, 'item'))
-                except OSError, err:
+                except OSError as err:
                     if err.errno != errno.ENOENT:
                         raise
                     # ignore, there might not have been metadata
@@ -408,7 +408,7 @@
                 f = open(p, 'rb')
                 metadata = pickle.load(f)
                 f.close()
-            except IOError, err:
+            except IOError as err:
                 if err.errno != errno.ENOENT:
                     raise
                 # no such file means no metadata was stored
--- a/MoinMoin/storage/backends/hg.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/hg.py	Sun Mar 20 02:31:24 2011 +0100
@@ -90,7 +90,7 @@
         for path in (self._path, self._rev_path, self._meta_path):
             try:
                 os.makedirs(path)
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise BackendError(str(err))
         try:
@@ -294,7 +294,7 @@
                 dst = os.path.join(self._meta_path, "%s.meta" % newid)
                 try:
                     util.rename(src, dst)
-                except OSError, err:
+                except OSError as err:
                     if err == errno.EEXIST:
                         pass  # if metadata is empty, there is no file, only entry in cdb
                 self._add_to_cdb(newid, newname, replace=item._id)
@@ -357,7 +357,7 @@
         self._commit_files(['%s.rev' % item._id, '%s.rip' % item._id, item._id], message='(item destroy)')
         try:
             os.remove(os.path.join(self._meta_path, "%s.meta" % item._id))
-        except OSError, err:
+        except OSError as err:
             if err.errno == errno.EACCES:
                 raise CouldNotDestroyError
 
--- a/MoinMoin/storage/backends/indexing.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/indexing.py	Sun Mar 20 02:31:24 2011 +0100
@@ -77,10 +77,10 @@
             try:
                 item = self.get_item(name)
                 yield item.get_revision(rev_no)
-            except AccessDeniedError, e:
+            except AccessDeniedError as e:
                 # just skip items we may not access
                 pass
-            except (NoSuchItemError, NoSuchRevisionError), e:
+            except (NoSuchItemError, NoSuchRevisionError) as e:
                 logging.exception("history processing catched exception")
 
     def all_tags(self):
--- a/MoinMoin/storage/backends/memory.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/storage/backends/memory.py	Sun Mar 20 02:31:24 2011 +0100
@@ -298,7 +298,7 @@
         @see: Backend._publish_item_metadata.__doc__
         """
         if item._item_id is None and self.has_item(item.name):
-            raise  ItemAlreadyExistsError, "The Item whose metadata you tried to publish already exists."
+            raise  ItemAlreadyExistsError("The Item whose metadata you tried to publish already exists.")
         if item._item_id is None:
             # not committed yet, no locking, store item
             self._add_item_internally(item)
@@ -420,7 +420,7 @@
             try:
                 try:
                     retval = func(*args, **kwargs)
-                except Exception, e:
+                except Exception as e:
                     exc = type(e).__name__ # yes, not very exact
                     log(" " * level + "try:")
                     level += 4
--- a/MoinMoin/themes/__init__.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/themes/__init__.py	Sun Mar 20 02:31:24 2011 +0100
@@ -240,9 +240,10 @@
                                 pass # ignore invalid lines
                         f.close()
                         app.cache.set(cid, sisteritems)
-                        logging.info(u"Site: %s Status: Updated. Pages: %d" % (sistername, len(sisteritems)))
-                    except IOError, (title, code, msg, headers): # code e.g. 304
-                        logging.warning(u"Site: %s Status: Not updated." % sistername)
+                        logging.info("Site: %s Status: Updated. Pages: %d" % (sistername, len(sisteritems)))
+                    except IOError as err:
+                        (title, code, msg, headers) = err.args # code e.g. 304
+                        logging.warning("Site: %s Status: Not updated." % sistername)
                         logging.exception("exception was:")
                 if current in sisteritems:
                     url = sisteritems[current]
--- a/MoinMoin/user.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/user.py	Sun Mar 20 02:31:24 2011 +0100
@@ -69,7 +69,7 @@
     # Encode password
     try:
         theuser.enc_password = encodePassword(password)
-    except UnicodeError, err:
+    except UnicodeError as err:
         # Should never happen
         return "Can't encode password: %(msg)s" % dict(msg=str(err))
 
--- a/MoinMoin/util/SubProcess.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/util/SubProcess.py	Sun Mar 20 02:31:24 2011 +0100
@@ -133,7 +133,7 @@
             while read_set or write_set:
                 try:
                     rlist, wlist, xlist = select.select(read_set, write_set, [], self.timeout)
-                except select.error, e:
+                except select.error as e:
                     if e.args[0] == errno.EINTR:
                         continue
                     raise
--- a/MoinMoin/util/_tests/test_pysupport.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/util/_tests/test_pysupport.py	Sun Mar 20 02:31:24 2011 +0100
@@ -119,7 +119,7 @@
 ''' % self.key
         try:
             file(self.pluginFilePath('.py'), 'w').write(data)
-        except Exception, err:
+        except Exception as err:
             py.test.skip("Can't create test plugin: %s" % str(err))
 
     def deleteTestPlugin(self):
@@ -129,7 +129,7 @@
         for suffix in ('.py', '.pyc'):
             try:
                 os.unlink(self.pluginFilePath(suffix))
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.ENOENT:
                     raise
 
--- a/MoinMoin/util/filesys.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/util/filesys.py	Sun Mar 20 02:31:24 2011 +0100
@@ -101,7 +101,7 @@
             while True:
                 try:
                     return fn(*args, **kwargs)
-                except OSError, err:
+                except OSError as err:
                     retry += 1
                     if retry > max_retries:
                         raise
@@ -229,7 +229,7 @@
             else:
                 shutil.copy2(srcname, dstname)
             # XXX What about devices, sockets etc.?
-        except (IOError, os.error), why:
+        except (IOError, os.error) as why:
             errors.append((srcname, dstname, why))
     if errors:
         raise EnvironmentError(str(errors))
--- a/MoinMoin/util/lock.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/util/lock.py	Sun Mar 20 02:31:24 2011 +0100
@@ -114,7 +114,7 @@
                 self._locked = True
                 logging.debug('acquired exclusive lock: %s' % (self.lockDir, ))
                 return True
-            except OSError, err:
+            except OSError as err:
                 if err.errno != errno.EEXIST:
                     raise
                 if self.expire():
@@ -149,7 +149,7 @@
         try:
             lock_age = time.time() - filesys.stat(self.lockDir).st_mtime
             return lock_age > self.timeout
-        except OSError, err:
+        except OSError as err:
             if err.errno == errno.ENOENT:
                 # No such lock file, therefore "expired"
                 return True
@@ -170,7 +170,7 @@
         try:
             filesys.mkdir(self.dir)
             logging.debug('created directory: %s' % self.dir)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.EEXIST:
                 raise
 
@@ -179,7 +179,7 @@
         try:
             filesys.rmdir(self.lockDir)
             logging.debug('removed directory: %s' % self.dir)
-        except OSError, err:
+        except OSError as err:
             if err.errno != errno.ENOENT:
                 raise
 
--- a/MoinMoin/util/plugins.py	Sun Mar 20 00:00:44 2011 +0100
+++ b/MoinMoin/util/plugins.py	Sun Mar 20 02:31:24 2011 +0100
@@ -222,7 +222,7 @@
                     cfg._plugin_modules.append(modname)
         finally:
             imp.release_lock()
-    except ImportError, err:
+    except ImportError as err:
         msg = """
 Could not import plugin package "%(path)s" because of ImportError:
 %(err)s.