コード例 #1
0
ファイル: legacy_events.py プロジェクト: belokop/indico_bare
    def migrate_legacy_events(self):
        print cformat('%{white!}migrating legacy events')

        # XXX: removed display manager / internal page manager update
        # don't forget to handle them when updating this for 2.0!
        wfr = WebFactoryRegistry()._getConfRegistry()
        for event in self._committing_iterator(self._get_events()):
            if not hasattr(event, '_old_id'):
                new_id = self.gen_event_id()
                event.unindexConf()
                del self.zodb_root['conferences'][event.id]
                wf = wfr.pop(event.id, None)
                event._old_id = event.id
                event.id = new_id
                if wf is not None:
                    wfr[event.id] = wf
                self.zodb_root['conferences'][event.id] = event
                event.indexConf()
                EventSetting.find(event_id=event._old_id).update({EventSetting.event_id: event.id})
                EventSettingPrincipal.find(event_id=event._old_id).update({EventSettingPrincipal.event_id: event.id})
                db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
                if not self.quiet:
                    self.print_success(cformat('%{cyan}{}').format(event.id), event_id=event._old_id)
            else:
                # happens if this importer was executed before but you want to add the mapping to your DB again
                db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
                if not self.quiet:
                    self.print_success(cformat('%{cyan}{}%{reset} %{yellow}(already updated in zodb)').format(event.id),
                                       event_id=event._old_id)
コード例 #2
0
    def migrate_legacy_events(self):
        print cformat('%{white!}migrating legacy events')

        # XXX: removed display manager / internal page manager update
        # don't forget to handle them when updating this for 2.0!
        wfr = WebFactoryRegistry()._getConfRegistry()
        for event in self._committing_iterator(self._get_events()):
            if not hasattr(event, '_old_id'):
                new_id = self.gen_event_id()
                event.unindexConf()
                del self.zodb_root['conferences'][event.id]
                wf = wfr.pop(event.id, None)
                event._old_id = event.id
                event.id = new_id
                if wf is not None:
                    wfr[event.id] = wf
                self.zodb_root['conferences'][event.id] = event
                event.indexConf()
                IndexedEvent.find(id=event._old_id).update(
                    {IndexedEvent.id: event.id})
                EventSetting.find(event_id=event._old_id).update(
                    {EventSetting.event_id: event.id})
                EventSettingPrincipal.find(event_id=event._old_id).update(
                    {EventSettingPrincipal.event_id: event.id})
                db.session.add(
                    LegacyEventMapping(legacy_event_id=event._old_id,
                                       event_id=int(event.id)))
                if not self.quiet:
                    self.print_success(cformat('%{cyan}{}').format(event.id),
                                       event_id=event._old_id)
            else:
                # happens if this importer was executed before but you want to add the mapping to your DB again
                db.session.add(
                    LegacyEventMapping(legacy_event_id=event._old_id,
                                       event_id=int(event.id)))
                if not self.quiet:
                    self.print_success(cformat(
                        '%{cyan}{}%{reset} %{yellow}(already updated in zodb)'
                    ).format(event.id),
                                       event_id=event._old_id)
コード例 #3
0
ファイル: output.py プロジェクト: stomanin/indico
    def __init__(self, aw, XG=None):
        self.__aw = aw
        if XG != None:
            self._XMLGen = XG
        else:
            self._XMLGen = XMLGen()
        self._config = Config.getInstance()
        self.text = ""
        self.time_XML = 0
        self.time_HTML = 0
        self.cache = XMLCache()

        from MaKaC.webinterface.webFactoryRegistry import WebFactoryRegistry
        self.webFactory = WebFactoryRegistry()
コード例 #4
0
ファイル: legacy_events.py プロジェクト: k3njiy/indico
    def migrate_legacy_events(self):
        print cformat('%{white!}migrating legacy events')

        dmr = ConfDisplayMgrRegistery()._getDisplayMgrRegistery()
        wfr = WebFactoryRegistry()._getConfRegistry()
        ipmr = InternalPagesMgrRegistery()._getInternalPagesMgrRegistery()
        for event in self._committing_iterator(self._get_events()):
            if not hasattr(event, '_old_id'):
                new_id = self.gen_event_id()
                event.unindexConf()
                del self.zodb_root['conferences'][event.id]
                dm = dmr.pop(event.id, None)
                wf = wfr.pop(event.id, None)
                ipm = ipmr.pop(event.id, None)
                event._old_id = event.id
                event.id = new_id
                if dm is not None:
                    dmr[event.id] = dm
                if wf is not None:
                    wfr[event.id] = wf
                if ipm is not None:
                    ipmr[event.id] = ipm
                self.zodb_root['conferences'][event.id] = event
                event.indexConf()
                IndexedEvent.find(id=event._old_id).update({IndexedEvent.id: event.id})
                EventSetting.find(event_id=event._old_id).update({EventSetting.event_id: event.id})
                EventSettingPrincipal.find(event_id=event._old_id).update({EventSettingPrincipal.event_id: event.id})
                db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
                print cformat('%{green}+++%{reset} '
                              '%{white!}{:6s}%{reset} %{cyan}{}').format(event._old_id, int(event.id))
            else:
                # happens if this importer was executed before but you want to add the mapping to your DB again
                db.session.add(LegacyEventMapping(legacy_event_id=event._old_id, event_id=int(event.id)))
                msg = cformat('%{green}+++%{reset} '
                              '%{white!}{:6s}%{reset} %{cyan}{}%{reset} %{yellow}(already updated in zodb)')
                print msg.format(event._old_id, int(event.id))
コード例 #5
0
 def getVars( self ):
     from MaKaC.registration import Notification
     from MaKaC.webinterface.webFactoryRegistry import WebFactoryRegistry
     vars = wcomponents.WTemplated.getVars(self)
     evaluation = self._conf.getEvaluation()
     evaluationStartNotification = evaluation.getNotification(Evaluation._EVALUATION_START)
     newSubmissionNotification   = evaluation.getNotification(Evaluation._NEW_SUBMISSION)
     vars["postURL"]=urlHandlers.UHConfModifEvaluationPerformDataModif.getURL(self._conf)
     vars["calendarSelectURL"]= urlHandlers.UHSimpleCalendar.getURL()
     vars["calendarIconURL"]  = Config.getInstance().getSystemIconURL("calendar")
     vars["announcement"]     = evaluation.getAnnouncement()
     vars["contactInfo"]      = evaluation.getContactInfo()
     vars["submissionsLimit"] = evaluation.getSubmissionsLimit()
     vars["title"]            = evaluation.getTitle()
     if evaluation.getStartDate() is None:
         vars["sDay"]  =""
         vars["sMonth"]=""
         vars["sYear"] =""
     else:
         d = evaluation.getStartDate()
         vars["sDay"]  =str(d.day)
         vars["sMonth"]=str(d.month)
         vars["sYear"] =str(d.year)
     if evaluation.getEndDate() is None:
         vars["eDay"]  =""
         vars["eMonth"]=""
         vars["eYear"] =""
     else:
         d = evaluation.getEndDate()
         vars["eDay"]  = str(d.day)
         vars["eMonth"]= str(d.month)
         vars["eYear"] = str(d.year)
     if evaluation.isMandatoryAccount():
         vars["mandatoryAccount"]='checked'
     else:
         vars["mandatoryAccount"]=""
     if evaluation.isMandatoryParticipant():
         vars["mandatoryParticipant"]='checked'
     else:
         vars["mandatoryParticipant"]=""
     if evaluation.isAnonymous() :
         vars["anonymous"] = 'checked'
     else:
         vars["anonymous"] = ""
     #Notifications
     if WebFactoryRegistry().getFactory(self._conf)==None: #Conference
         vars["adherent"] = "registrant"
         allAdherents = [r.getEmail() for r in self._conf.getRegistrantsList()]
     else : #Lecture / Meeting
         vars["adherent"] = "participant"
         allAdherents = [p.getEmail() for p in self._conf.getParticipation().getParticipantList()]
     if evaluationStartNotification == None :
         vars["evaluationStartNotifyTo"] = ""
         vars["evaluationStartNotifyCc"] = ""
     else :
         toList = evaluationStartNotification.getToList()
         vars["evaluationStartNotifyTo"] = ", ".join(toList)
         vars["evaluationStartNotifyCc"] = ", ".join(evaluationStartNotification.getCCList())
     if newSubmissionNotification == None :
         vars["newSubmissionNotifyTo"] = ""
         vars["newSubmissionNotifyCc"] = ""
     else :
         vars["newSubmissionNotifyTo"]   = ", ".join(newSubmissionNotification.getToList())
         vars["newSubmissionNotifyCc"]   = ", ".join(newSubmissionNotification.getCCList())
     return vars