Mercurial > p > roundup > code
diff roundup/scripts/roundup_server.py @ 5378:35ea9b1efc14
Python 3 preparation: "raise" syntax.
Changing "raise Exception, value" to "raise Exception(value)".
Tool-assisted patch. Particular cases to check carefully are the one
place in frontends/ZRoundup/ZRoundup.py where a string exception
needed to be fixed, and the one in roundup/cgi/client.py involving
raising an exception with a traceback (requires three-argument form of
raise in Python 2, which as I understand it requires exec() to avoid a
Python 3 syntax error).
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 21:39:58 +0000 |
| parents | 64b05e24dbd8 |
| children | 0942fe89e82e |
line wrap: on
line diff
--- a/roundup/scripts/roundup_server.py Tue Jul 24 21:36:02 2018 +0000 +++ b/roundup/scripts/roundup_server.py Tue Jul 24 21:39:58 2018 +0000 @@ -479,7 +479,7 @@ try: import grp except ImportError: - raise ValueError, _("Can't change groups - no grp module") + raise ValueError(_("Can't change groups - no grp module")) try: try: gid = int(group) @@ -488,7 +488,7 @@ else: grp.getgrgid(gid) except KeyError: - raise ValueError,_("Group %(group)s doesn't exist")%locals() + raise ValueError(_("Group %(group)s doesn't exist")%locals()) os.setgid(gid) def setuid(user): @@ -499,7 +499,7 @@ if user is None: if os.getuid(): return - raise ValueError, _("Can't run as root!") + raise ValueError(_("Can't run as root!")) if os.getuid(): print(_('WARNING: ignoring "-u" argument, not root')) @@ -508,7 +508,7 @@ try: import pwd except ImportError: - raise ValueError, _("Can't change users - no pwd module") + raise ValueError(_("Can't change users - no pwd module")) try: try: uid = int(user) @@ -517,7 +517,7 @@ else: pwd.getpwuid(uid) except KeyError: - raise ValueError, _("User %(user)s doesn't exist")%locals() + raise ValueError(_("User %(user)s doesn't exist")%locals()) os.setuid(uid) class TrackerHomeOption(configuration.FilePathOption): @@ -725,9 +725,8 @@ httpd = server_class(*args, **kwargs) except socket.error as e: if e[0] == errno.EADDRINUSE: - raise socket.error, \ - _("Unable to bind to port %s, port already in use.") \ - % self["PORT"] + raise socket.error(_("Unable to bind to port %s, port already in use.") \ + % self["PORT"]) raise # change user and/or group setgid(self["GROUP"]) @@ -966,7 +965,7 @@ try: name, home = arg.split('=') except ValueError: - raise ValueError, _("Instances must be name=home") + raise ValueError(_("Instances must be name=home")) config.add_option(TrackerHomeOption(config, "trackers", name)) config["TRACKERS_" + name.upper()] = home
