def main(): if len(sys.argv) < 2: print >> sys.stderr, 'usage: %s /path/to/projenv' \ % os.path.basename(sys.argv[0]) sys.exit(2) env = open_environment(sys.argv[1]) with env.db_transaction: for oldprio, newprio in priority_mapping.items(): priority = Priority(env, oldprio) priority.name = newprio priority.update() for severity in list(Severity.select(env)): severity.delete()
def main(): if len(sys.argv) < 2: print("usage: %s /path/to/projenv" % os.path.basename(sys.argv[0]), file=sys.stderr) sys.exit(2) env = open_environment(sys.argv[1]) with env.db_transaction: for oldprio, newprio in priority_mapping.items(): priority = Priority(env, oldprio) priority.name = newprio priority.update() for severity in list(Severity.select(env)): severity.delete()
def main(): if len(sys.argv) < 2: print >> sys.stderr, 'usage: %s /path/to/projenv' \ % os.path.basename(sys.argv[0]) sys.exit(2) env = open_environment(sys.argv[1]) db = env.get_db_cnx() for oldprio, newprio in priority_mapping.items(): priority = Priority(env, oldprio, db) priority.name = newprio priority.update(db) for severity in list(Severity.select(env, db)): severity.delete(db) db.commit()
def test_abstractenum(self): """ Verify basic AbstractEnum functionality. """ p = Priority(self.env, 'major') self.assertEqual(p.name, 'major') self.assertEqual(p.value, '3') p = Priority(self.env) p.name = 'foo' p.insert() p = Priority(self.env) p.name = 'bar' p.value = 100 p.insert() p = Priority(self.env, 'foo') p.name = 'foo2' p.update() p = Priority(self.env, 'foo2') p.delete() p = Priority(self.env, 'bar') p.delete()
def test_priority_update(self): prio = Priority(self.env, 'major') prio.name = 'foo' prio.update() Priority(self.env, 'foo') self.assertRaises(TracError, Priority, self.env, 'major')
def test_priority_update(self): prio = Priority(self.env, "major") prio.name = "foo" prio.update() Priority(self.env, "foo") self.assertRaises(TracError, Priority, self.env, "major")