Mercurial > p > roundup > code
diff roundup/instance.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 | 32f95ec6bd8e |
| children | 0942fe89e82e |
line wrap: on
line diff
--- a/roundup/instance.py Tue Jul 24 21:36:02 2018 +0000 +++ b/roundup/instance.py Tue Jul 24 21:39:58 2018 +0000 @@ -168,8 +168,7 @@ continue linkto = prop.classname if linkto not in classes: - raise ValueError, \ - ("property %s.%s links to non-existent class %s" + raise ValueError("property %s.%s links to non-existent class %s" % (classname, propname, linkto)) db.post_init() @@ -281,13 +280,13 @@ import imp # sanity check existence of tracker home if not os.path.exists(tracker_home): - raise ValueError, 'no such directory: "%s"'%tracker_home + raise ValueError('no such directory: "%s"'%tracker_home) # sanity check tracker home contents for reqd in 'config dbinit select_db interfaces'.split(): if not os.path.exists(os.path.join(tracker_home, '%s.py'%reqd)): - raise TrackerError, 'File "%s.py" missing from tracker '\ - 'home "%s"'%(reqd, tracker_home) + raise TrackerError('File "%s.py" missing from tracker '\ + 'home "%s"'%(reqd, tracker_home)) if self.trackers.has_key(tracker_home): return imp.load_package(self.trackers[tracker_home], @@ -304,8 +303,7 @@ # ensure the tracker has all the required bits for required in 'open init Client MailGW'.split(): if not hasattr(tracker, required): - raise TrackerError, \ - 'Required tracker attribute "%s" missing'%required + raise TrackerError('Required tracker attribute "%s" missing'%required) # load and apply the config tracker.config = configuration.CoreConfig(tracker_home)
