Exemple #1
0
    def epilogue(self):
        tenants = self.session_old.query(self.model_from['Tenant'])
        for tenant in tenants:
            for s in [{'label': {'en': 'New'}, 'system_usage': u'new'},
                      {'label': {'en': 'Opened'}, 'system_usage': u'opened'},
                      {'label': {'en': 'Closed'}, 'system_usage': u'closed'}]:
                state = self.model_to['SubmissionStatus']()
                state.tid = tenant.id
                state.label = s['label']
                state.system_defined = True
                state.system_usage = s['system_usage']
                self.session_new.add(state)

        self.session_new.flush()

        for tenant in tenants:
            itips = self.session_new.query(self.model_to['InternalTip'])\
                                    .filter(self.model_to['InternalTip'].context_id == self.model_to['Context'].id,
                                            self.model_to['Context'].tid == tenant.id)
            for itip in itips:
                open_status_id = self.session_new.query(self.model_to['SubmissionStatus'].id)\
                                                .filter(self.model_to['SubmissionStatus'].tid == tenant.id,
                                                        self.model_to['SubmissionStatus'].system_usage.in_(['open','opened'])).one()[0]

                db_update_submission_status(self.session_new, u'', itip, open_status_id, u'')
Exemple #2
0
    def epilogue(self):
        tenants = self.session_old.query(self.model_from['Tenant'])
        for tenant in tenants:
            for s in [{'label': {'en': 'New'}, 'system_usage': 'new'},
                      {'label': {'en': 'Opened'}, 'system_usage': 'opened'},
                      {'label': {'en': 'Closed'}, 'system_usage': 'closed'}]:
                state = self.model_to['SubmissionStatus']()
                state.tid = tenant.id
                state.label = s['label']
                state.system_defined = True
                state.system_usage = s['system_usage']
                self.session_new.add(state)

        self.session_new.flush()

        for tenant in tenants:
            itips = self.session_new.query(self.model_to['InternalTip'])\
                                    .filter(self.model_to['InternalTip'].context_id == self.model_to['Context'].id,
                                            self.model_to['Context'].tid == tenant.id)
            for itip in itips:
                open_status_id = self.session_new.query(self.model_to['SubmissionStatus'].id)\
                                                .filter(self.model_to['SubmissionStatus'].tid == tenant.id,
                                                        self.model_to['SubmissionStatus'].system_usage.in_(['open','opened'])).one()[0]

                db_update_submission_status(self.session_new, '', itip, open_status_id, '')
Exemple #3
0
    def epilogue(self):
        tenants = self.session_old.query(self.model_from['Tenant'])
        for tenant in tenants:
            initialize_submission_statuses(self.session_new, tenant.id)

        self.session_new.flush()

        for tenant in tenants:
            itips = self.session_new.query(self.model_to['InternalTip'])\
                                    .filter(self.model_to['InternalTip'].context_id == self.model_to['Context'].id,
                                            self.model_to['Context'].tid == tenant.id)
            for itip in itips:
                open_status_id = self.session_new.query(self.model_to['SubmissionStatus'].id)\
                                                .filter(self.model_to['SubmissionStatus'].tid == tenant.id,
                                                        self.model_to['SubmissionStatus'].system_usage == 'open').one()[0]

                db_update_submission_status(self.session_new, u'', itip,
                                            open_status_id, u'')