Changeset 755a70 in indico
- Timestamp:
- 03/03/11 12:07:26 (2 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
- Children:
- 20ac18
- Parents:
- 5ce34c
- git-author:
- Pedro Ferreira <jose.pedro.ferreira@…> (03/02/11 18:19:08)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (03/03/11 12:07:26)
- Files:
-
- 5 edited
-
bin/migration/migrate_0.97_0.98.py (modified) (7 diffs)
-
indico/MaKaC/common/db.py (modified) (2 diffs)
-
indico/MaKaC/webinterface/pages/conferences.py (modified) (2 diffs)
-
indico/MaKaC/webinterface/rh/conferenceModif.py (modified) (2 diffs)
-
indico/modules/scheduler/tasks.py (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
bin/migration/migrate_0.97_0.98.py
r353585 r755a70 25 25 import traceback 26 26 from BTrees.OOBTree import OOTreeSet 27 from dateutil import rrule 27 28 28 29 from MaKaC.common.indexes import IndexesHolder, CategoryDayIndex … … 37 38 from indico.ext import livesync 38 39 from indico.util import console 40 from indico.modules.scheduler.tasks import AlarmTask, FoundationSyncTask, \ 41 CategoryStatisticsUpdaterTask 42 43 from indico.modules.scheduler import Client 39 44 40 45 … … 43 48 Migrating database tasks from the old format to the new one 44 49 """ 50 51 c = Client() 52 45 53 for t in HelperTaskList().getTaskListInstance().getTasks(): 46 print t 47 # TODO: finish this 54 for obj in t.getObjList(): 55 print console.colored(" * %s" % obj.__class__.__name__, 'blue') 56 if obj.__class__.__name__ == 'FoundationSync': 57 c.enqueue( 58 FoundationSyncTask(rrule.DAILY, byhour=0, byminute=0)) 59 elif obj.__class__.__name__ == 'StatisticsUpdater': 60 c.enqueue(CategoryStatisticsUpdaterTask( 61 CategoryManager().getById('0'), 62 rrule.DAILY, 63 byhour=0, byminute=0)) 64 elif obj.__class__.__name__ == 'sendMail': 65 # they have to be somewhere in the conference 66 alarm = t.conf.alarmList[t.id] 67 c.enqueue(alarm) 68 else: 69 raise Exception("Unknown task type!") 48 70 49 71 dbi.commit() … … 64 86 65 87 88 def _convertAlarms(obj): 89 alarms = {} 90 obj._legacyAlarmList = obj.getAlarmList() 91 92 for alarm in obj.getAlarmList(): 93 sdate = alarm.getStartDate() 94 newTask = AlarmTask(obj, alarm.id, sdate) 95 newTask.setSubject(alarm.getSubject()) 96 newTask.setText(alarm.getText()) 97 newTask.setNote(alarm.getNote()) 98 newTask.setConfSummary(alarm.getConfSumary()) 99 newTask.setToAllParticipants(alarm.getToAllParticipants()) 100 alarms[alarm.id] = newTask 101 102 newTask.setFromAddr(alarm.getFromAddr()) 103 for addr in alarm.getToAddrList(): 104 newTask.addToAddr(addr) 105 106 obj.alarmList = alarms 107 108 66 109 def runConferenceMigration(dbi): 67 110 """ … … 73 116 74 117 for (level, obj) in console.conferenceHolderIterator(ch, deepness='contrib'): 75 76 ## TODO: Fix and uncomment 77 ## 78 ## # only for conferences 79 ## if level == 'conf': 80 ## if hasattr(obj, '__alarmCounter'): 81 ## raise Exception("Conference Object %s (%s) seems to have been " 82 ## "already converted" % (obj, obj.id)) 83 84 ## existingKeys = obj.alarmList.keys() 85 ## existingKeys.sort() 86 ## nstart = int(existingKeys[-1]) + 1 if existingKeys else 0 87 ## obj._Conference__alarmCounter = Counter(nstart) 88 89 ## # TODO: For each conference, take the existing tasks and 90 ## # convert them to the new object classes. 91 ## # It is important to save the state of the alarm (sent or not) 92 118 # only for conferences 119 if level == 'event': 120 if hasattr(obj, '_Conference__alarmCounter'): 121 raise Exception("Conference Object %s (%s) seems to have been " 122 "already converted" % (obj, obj.id)) 123 124 existingKeys = obj.alarmList.keys() 125 existingKeys.sort() 126 nstart = int(existingKeys[-1]) + 1 if existingKeys else 0 127 obj._Conference__alarmCounter = Counter(nstart) 128 129 # TODO: For each conference, take the existing tasks and 130 # convert them to the new object classes. 131 # It is important to save the state of the alarm (sent or not) 132 _convertAlarms(obj) 93 133 _fixAccessController(obj) 94 134 … … 100 140 if isinstance(obj, Conference): 101 141 for reg in obj.getRegistrants().values(): 102 if reg._sessions and isinstance(reg._sessions[0], RegistrationSession): 103 reg._sessions = [RegistrantSession(ses, reg) for ses in self._sessions] 142 if reg._sessions and \ 143 isinstance(reg._sessions[0], RegistrationSession): 144 reg._sessions = [RegistrantSession(ses, reg) \ 145 for ses in reg._sessions] 104 146 105 147 dbi.commit() … … 168 210 169 211 tasks = [runPluginMigration, 212 runConferenceMigration, 170 213 runTaskMigration, 171 runConferenceMigration,172 214 runCategoryDateIndexMigration, 173 215 runCategoryConfDictToTreeSet] -
indico/MaKaC/common/db.py
r76defd r755a70 159 159 160 160 def commitZODBOld(self, sub=False): 161 transaction.commit(sub)161 transaction.commit(sub) 162 162 163 163 def abort(self): … … 212 212 elif int(zodbVersion[1]) < 7: 213 213 commit = commitZODBOld 214 215 -
indico/MaKaC/webinterface/pages/conferences.py
r5ce34c r755a70 5205 5205 "saveAlarm": urlHandlers.UHConfSaveAlarm.getURL(), \ 5206 5206 "confId": self._conf.getId(), \ 5207 "alarmId": self._alarm.get Id(), \5207 "alarmId": self._alarm.getConfRelativeId(), \ 5208 5208 "confTitle": self._conf.getTitle() } 5209 5209 vars["selec1"] = vars["selec2"] = vars["selec3"] = "" … … 5297 5297 5298 5298 vars["testSendAlarm"] = testSendAlarm 5299 if self._alarm.getConfSum ary():5299 if self._alarm.getConfSummary(): 5300 5300 vars["includeConf"] = "checked" 5301 5301 -
indico/MaKaC/webinterface/rh/conferenceModif.py
ra3574e r755a70 3248 3248 3249 3249 if self._includeConf and self._includeConf == "1": 3250 al.setConfSum ary(True)3251 else: 3252 al.setConfSum ary(False)3250 al.setConfSummary(True) 3251 else: 3252 al.setConfSummary(False) 3253 3253 3254 3254 self._al = al … … 5381 5381 5382 5382 5383 class RHContributionList ( RoomBookingDBMixin, RHContributionListBase ):5383 class RHContributionList202( RoomBookingDBMixin, RHContributionListBase ): 5384 5384 _uh = urlHandlers.UHConfModifContribList 5385 5385 -
indico/modules/scheduler/tasks.py
rd738f7 r755a70 281 281 """ 282 282 Singleton periodic tasks: no two or more PeriodicUniqueTask of this 283 class will be queued or running at the same time 284 """ 283 class will be queued or running at the same time (TODO) 284 """ 285 # TODO: implement this 285 286 286 287 … … 317 318 return self._task 318 319 320 319 321 class CategoryStatisticsUpdaterTask(PeriodicUniqueTask): 320 322 '''Updates statistics associated with categories 321 323 ''' 322 def __init__(self, cat, **kwargs): 323 super(CategoryStatisticsUpdaterTask, self).__init__(**kwargs) 324 def __init__(self, cat, frequency, **kwargs): 325 super(CategoryStatisticsUpdaterTask, self).__init__(frequency, 326 **kwargs) 324 327 self._cat = cat 325 328 … … 329 332 330 333 331 # TODO CERN Specific334 # TODO: Isolate CERN Specific 332 335 class FoundationSyncTask(PeriodicUniqueTask): 333 336 """ … … 339 342 (This is object for a task class) 340 343 """ 341 def __init__(self, **kwargs): 342 super(FoundationSyncTask, self).__init__(**kwargs) 343 obj.__init__(self) 344 def __init__(self, frequency, **kwargs): 345 super(FoundationSyncTask, self).__init__(frequency, **kwargs) 344 346 345 347 def run(self): … … 361 363 self.smtpServer = Config.getInstance().getSmtpServer() 362 364 363 def run(self, check =False):365 def run(self, check=False): 364 366 import smtplib 365 367 from MaKaC.webinterface.mail import GenericMailer, GenericNotification 366 368 367 369 # prepare the mail 368 self._prepare(check =check);370 self._prepare(check=check); 369 371 370 372 addrs = [smtplib.quoteaddr(x) for x in self.toAddr] … … 393 395 if not addr in self.toAddr: 394 396 self.toAddr.append(addr) 395 self._p_changed =1397 self._p_changed = 1 396 398 397 399 def addCcAddr(self, addr): 398 400 if not addr in self.ccAddr: 399 401 self.ccAddr.append(addr) 400 self._p_changed =1402 self._p_changed = 1 401 403 402 404 def removeToAddr(self, addr): 403 405 if addr in self.toAddr: 404 406 self.toAddr.remove(addr) 405 self._p_changed =1407 self._p_changed = 1 406 408 407 409 def setToAddrList(self, addrList): 408 410 """Params: addrList -- addresses of type : list of str.""" 409 411 self.toAddr = addrList 410 self._p_changed =1412 self._p_changed = 1 411 413 412 414 def getToAddrList(self): … … 416 418 """Params: addrList -- addresses of type : list of str.""" 417 419 self.ccAddr = addrList 418 self._p_changed =1420 self._p_changed = 1 419 421 420 422 def getCcAddrList(self): … … 424 426 if not user in self.toUser: 425 427 self.toUser.append(user) 426 self._p_changed =1428 self._p_changed = 1 427 429 428 430 def removeToUser(self, user): 429 431 if user in self.toUser: 430 432 self.toUser.remove(user) 431 self._p_changed =1433 self._p_changed = 1 432 434 433 435 def getToUserList(self): … … 445 447 def getText(self): 446 448 return self.text 447 448 449 449 450 … … 553 554 return self.note 554 555 555 def setConfSum ary(self, val):556 def setConfSummary(self, val): 556 557 self.confSumary = val 557 558 self._setMailText() 558 559 self._p_changed=1 559 560 560 def getConfSum ary(self):561 def getConfSummary(self): 561 562 return self.confSumary 562 563
Note: See TracChangeset
for help on using the changeset viewer.
