def taskMigration(dbi, withRBDB, prevVersion): """ Migrating database tasks from the old format to the new one """ c = Client() for t in HelperTaskList().getTaskListInstance().getTasks(): for obj in t.listObj.values(): print console.colored(" * %s" % obj.__class__.__name__, 'blue') if obj.__class__.__name__ == 'FoundationSync': c.enqueue( FoundationSyncTask(rrule.DAILY, byhour=0, byminute=0)) elif obj.__class__.__name__ == 'StatisticsUpdater': c.enqueue(CategoryStatisticsUpdaterTask( CategoryManager().getById('0'), rrule.DAILY, byhour=0, byminute=0)) elif obj.__class__.__name__ == 'sendMail': # they have to be somewhere in the conference alarm = t.conf.alarmList[t.id] c.enqueue(alarm) else: raise Exception("Unknown task type!") if withRBDB: DALManager.commit() dbi.commit()