comparison 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
comparison
equal deleted inserted replaced
5377:12fe83f90f0d 5378:35ea9b1efc14
166 if not isinstance(prop, (hyperdb.Link, 166 if not isinstance(prop, (hyperdb.Link,
167 hyperdb.Multilink)): 167 hyperdb.Multilink)):
168 continue 168 continue
169 linkto = prop.classname 169 linkto = prop.classname
170 if linkto not in classes: 170 if linkto not in classes:
171 raise ValueError, \ 171 raise ValueError("property %s.%s links to non-existent class %s"
172 ("property %s.%s links to non-existent class %s"
173 % (classname, propname, linkto)) 172 % (classname, propname, linkto))
174 173
175 db.post_init() 174 db.post_init()
176 self.db_open = 1 175 self.db_open = 1
177 return db 176 return db
279 278
280 """ 279 """
281 import imp 280 import imp
282 # sanity check existence of tracker home 281 # sanity check existence of tracker home
283 if not os.path.exists(tracker_home): 282 if not os.path.exists(tracker_home):
284 raise ValueError, 'no such directory: "%s"'%tracker_home 283 raise ValueError('no such directory: "%s"'%tracker_home)
285 284
286 # sanity check tracker home contents 285 # sanity check tracker home contents
287 for reqd in 'config dbinit select_db interfaces'.split(): 286 for reqd in 'config dbinit select_db interfaces'.split():
288 if not os.path.exists(os.path.join(tracker_home, '%s.py'%reqd)): 287 if not os.path.exists(os.path.join(tracker_home, '%s.py'%reqd)):
289 raise TrackerError, 'File "%s.py" missing from tracker '\ 288 raise TrackerError('File "%s.py" missing from tracker '\
290 'home "%s"'%(reqd, tracker_home) 289 'home "%s"'%(reqd, tracker_home))
291 290
292 if self.trackers.has_key(tracker_home): 291 if self.trackers.has_key(tracker_home):
293 return imp.load_package(self.trackers[tracker_home], 292 return imp.load_package(self.trackers[tracker_home],
294 tracker_home) 293 tracker_home)
295 # register all available backend modules 294 # register all available backend modules
302 tracker = imp.load_package(modname, tracker_home) 301 tracker = imp.load_package(modname, tracker_home)
303 302
304 # ensure the tracker has all the required bits 303 # ensure the tracker has all the required bits
305 for required in 'open init Client MailGW'.split(): 304 for required in 'open init Client MailGW'.split():
306 if not hasattr(tracker, required): 305 if not hasattr(tracker, required):
307 raise TrackerError, \ 306 raise TrackerError('Required tracker attribute "%s" missing'%required)
308 'Required tracker attribute "%s" missing'%required
309 307
310 # load and apply the config 308 # load and apply the config
311 tracker.config = configuration.CoreConfig(tracker_home) 309 tracker.config = configuration.CoreConfig(tracker_home)
312 tracker.dbinit.config = tracker.config 310 tracker.dbinit.config = tracker.config
313 311

Roundup Issue Tracker: http://roundup-tracker.org/