예제 #1
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: (disable_notification flags, ping_templates)" % self.std_fancy

        old_notification = self.store_old.find(
            self.get_right_model("Notification", 15)).one()
        new_notification = self.get_right_model("Notification", 16)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'disable_admin_notification_emails':
                new_notification.disable_admin_notification_emails = False
                continue

            if v.name == 'disable_receivers_notification_emails':
                new_notification.disable_receivers_notification_emails = False
                continue

            if v.name == 'ping_mail_template':
                new_notification.ping_mail_template = every_language("")
                continue

            if v.name == 'ping_mail_title':
                new_notification.ping_mail_title = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification,
                                                      v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #2
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: (admin_anomaly_template)" % self.std_fancy

        old_notification = self.store_old.find(
            self.get_right_model("Notification", 14)).one()
        new_notification = self.get_right_model("Notification", 15)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'admin_anomaly_template':
                new_notification.admin_anomaly_template = every_language("")
                continue

            if v.name == 'pgp_expiration_alert':
                new_notification.pgp_expiration_alert = every_language("")
                continue

            if v.name == 'pgp_expiration_notice':
                new_notification.pgp_alert_notice = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification,
                                                      v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #3
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: (pgp_expiration_alert templates)" % self.std_fancy

        appdata_dict = load_appdata()

        old_notification = self.store_old.find(
            self.get_right_model("Notification", 16)).one()
        new_notification = self.get_right_model("Notification", 17)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'admin_pgp_alert_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_pgp_alert_mail_template = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.admin_pgp_alert_mail_template = every_language(
                        "")
                continue

            if v.name == 'admin_pgp_alert_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_pgp_alert_mail_title = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.admin_pgp_alert_mail_title = every_language(
                        "")
                continue

            if v.name == 'pgp_alert_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.pgp_alert_mail_template = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.pgp_alert_mail_template = every_language(
                        "")
                continue

            if v.name == 'pgp_alert_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.pgp_alert_mail_title = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.pgp_alert_mail_title = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification,
                                                      v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #4
0
    def migrate_Node(self):
        print "%s Node migration assistant: header_titles and landing_page configuration" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 16)).one()
        new_node = self.get_right_model("Node", 17)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'header_title_homepage':
                new_node.header_title_homepage = {
                    old_node.default_language: old_node.name
                }
                continue

            if v.name == 'header_title_submissionpage':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.header_title_submissionpage = appdata_dict[
                        'node']['header_title_submissionpage']
                else:
                    new_node.header_title_submissionpage = every_language("")
                continue

            if v.name == 'landing_page':
                new_node.landing_page = u'homepage'
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #5
0
    def migrate_Node(self):
        print "%s Node migration assistant: disable_key_code_hint" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 19)).one()
        new_node = self.get_right_model("Node", 20)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'can_postpone_expiration':
                old_attr = 'postpone_superpower'
                setattr(new_node, v.name, getattr(old_node, old_attr))
                continue

            if v.name == 'context_selector_label':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.context_selector_label = appdata_dict['node']['context_selector_label']
                else:
                    new_node.context_selector_label = every_language("")
                continue

            if v.name == 'disable_key_code_hint':
                new_node.disable_key_code_hint = False
                continue

            if v.name == 'show_contexts_in_alphabetical_order':
                new_node.show_contexts_in_alphabetical_order = False
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #6
0
    def migrate_Node(self):
        print "%s Node migration assistant: header_titles and landing_page configuration" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 16)).one()
        new_node = self.get_right_model("Node", 17)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'header_title_homepage':
                new_node.header_title_homepage = {old_node.default_language: old_node.name}
                continue

            if v.name == 'header_title_submissionpage':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.header_title_submissionpage = appdata_dict['node']['header_title_submissionpage']
                else:
                    new_node.header_title_submissionpage = every_language("")
                continue

            if v.name == 'landing_page':
                new_node.landing_page = u'homepage'
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #7
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: (pgp_expiration_alert templates)" % self.std_fancy

        appdata_dict = load_appdata()

        old_notification = self.store_old.find(self.get_right_model("Notification", 16)).one()
        new_notification = self.get_right_model("Notification", 17)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'admin_pgp_alert_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_pgp_alert_mail_template = appdata_dict['templates'][v.name]
                else:
                    new_notification.admin_pgp_alert_mail_template = every_language("")
                continue

            if v.name == 'admin_pgp_alert_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_pgp_alert_mail_title = appdata_dict['templates'][v.name]
                else:
                    new_notification.admin_pgp_alert_mail_title = every_language("")
                continue

            if v.name == 'pgp_alert_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.pgp_alert_mail_template = appdata_dict['templates'][v.name]
                else:
                    new_notification.pgp_alert_mail_template = every_language("")
                continue

            if v.name == 'pgp_alert_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.pgp_alert_mail_title = appdata_dict['templates'][v.name]
                else:
                    new_notification.pgp_alert_mail_title = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification, v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #8
0
    def update_model_with_new_templates(self, model_obj, var_name, templates_list, templates_dict):
        if var_name in templates_list:
            # check needed to preserve funtionality if templates will be altered in the future
            if var_name in templates_dict:
                template_text = templates_dict[var_name]
            else:
                template_text = every_language("")

            setattr(model_obj, var_name, template_text)
            return True

        return False
예제 #9
0
    def update_model_with_new_templates(self, model_obj, var_name, template_list, templates_dict):
        if var_name in template_list:
            # check needed to preserve funtionality if templates will be altered in the future
            if var_name in templates_dict:
                template_text = templates_dict[var_name]
            else:
                template_text = every_language("")

            setattr(model_obj, var_name, template_text)
            return True

        return False
예제 #10
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: (admin_anomaly_template)" % self.std_fancy

        old_notification = self.store_old.find(self.get_right_model("Notification", 14)).one()
        new_notification = self.get_right_model("Notification", 15)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'admin_anomaly_template':
                new_notification.admin_anomaly_template = every_language("")
                continue

            if v.name == 'pgp_expiration_alert':
                new_notification.pgp_expiration_alert = every_language("")
                continue

            if v.name == 'pgp_expiration_notice':
                new_notification.pgp_alert_notice = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification, v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #11
0
    def migrate_Node(self):
        print "%s Node migration assistant: header_title_receiptpage" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 18)).one()
        new_node = self.get_right_model("Node", 19)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'header_title_receiptpage':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.header_title_receiptpage = appdata_dict['node']['header_title_receiptpage']
                else:
                    new_node.header_title_receiptpage = every_language("")
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #12
0
    def migrate_Node(self):
        print "%s Node migration assistant: header_title_receiptpage" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 18)).one()
        new_node = self.get_right_model("Node", 19)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'header_title_receiptpage':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.header_title_receiptpage = appdata_dict['node'][
                        'header_title_receiptpage']
                else:
                    new_node.header_title_receiptpage = every_language("")
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #13
0
    def migrate_Notification(self):
        print "%s Notification migration assistant:" % self.std_fancy

        appdata_dict = load_appdata()

        old_notification = self.store_old.find(self.get_right_model("Notification", 20)).one()
        new_notification = self.get_right_model("Notification", 21)()

        for _, v in new_notification._storm_columns.iteritems():
            # In this release we enforce reloading all the updated templates due to the
            # semplification applied and the fact that we are not aware of any adopter
            # that has customized them.
            if v.name in templates_list:
                if v.name in appdata_dict['templates']:
                    value = appdata_dict['templates'][v.name]
                else:
                    value = every_language("")

                setattr(new_notification, v.name, value)
                continue

            if v.name == 'notification_threshold_per_hour':
                setattr(new_notification, v.name, 20)
                continue

            if v.name == 'notification_suspension_time':
                setattr(new_notification, v.name, 7200)
                continue

            if v.name == 'tip_expiration_threshold':
                setattr(new_notification, v.name, 72)
                continue

            setattr(new_notification, v.name, getattr(old_notification, v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #14
0
    def migrate_Node(self):
        print "%s Node migration assistant: disable_key_code_hint" % self.std_fancy

        appdata_dict = load_appdata()

        old_node = self.store_old.find(self.get_right_model("Node", 19)).one()
        new_node = self.get_right_model("Node", 20)()

        for _, v in new_node._storm_columns.iteritems():

            if v.name == 'can_postpone_expiration':
                old_attr = 'postpone_superpower'
                setattr(new_node, v.name, getattr(old_node, old_attr))
                continue

            if v.name == 'context_selector_label':
                # check needed to preserve funtionality if appdata will be altered in the future
                if v.name in appdata_dict['node']:
                    new_node.context_selector_label = appdata_dict['node'][
                        'context_selector_label']
                else:
                    new_node.context_selector_label = every_language("")
                continue

            if v.name == 'disable_key_code_hint':
                new_node.disable_key_code_hint = False
                continue

            if v.name == 'show_contexts_in_alphabetical_order':
                new_node.show_contexts_in_alphabetical_order = False
                continue

            setattr(new_node, v.name, getattr(old_node, v.name))

        self.store_new.add(new_node)
        self.store_new.commit()
예제 #15
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: various templates addeed" % self.std_fancy

        appdata_dict = load_appdata()

        old_notification = self.store_old.find(
            self.get_right_model("Notification", 19)).one()
        new_notification = self.get_right_model("Notification", 20)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'send_email_for_every_event':
                new_notification.send_email_for_every_event = True
                continue

            if v.name == 'torify':
                new_notification.torify = True
                continue

            if v.name == 'admin_anomaly_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_anomaly_mail_title = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.admin_anomaly_mail_title = every_language(
                        "")
                continue

            if v.name == 'admin_anomaly_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_anomaly_mail_template = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.admin_anomaly_mail_template = every_language(
                        "")
                continue

            if v.name == 'notification_digest_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.notification_digest_mail_title = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.notification_digest_mail_title = every_language(
                        "")
                continue

            if v.name == 'tip_expiration_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.tip_expiration_mail_title = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.tip_expiration_mail_title = every_language(
                        "")
                continue

            if v.name == 'tip_expiration_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.tip_expiration_template = appdata_dict[
                        'templates'][v.name]
                else:
                    new_notification.tip_expiration_template = every_language(
                        "")
                continue

            setattr(new_notification, v.name, getattr(old_notification,
                                                      v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()
예제 #16
0
    def migrate_Notification(self):
        print "%s Notification migration assistant: various templates addeed" % self.std_fancy

        appdata_dict = load_appdata()

        old_notification = self.store_old.find(self.get_right_model("Notification", 19)).one()
        new_notification = self.get_right_model("Notification", 20)()

        for _, v in new_notification._storm_columns.iteritems():

            if v.name == 'send_email_for_every_event':
                new_notification.send_email_for_every_event = True
                continue

            if v.name == 'torify':
                new_notification.torify = True
                continue

            if v.name == 'admin_anomaly_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_anomaly_mail_title = appdata_dict['templates'][v.name]
                else:
                    new_notification.admin_anomaly_mail_title = every_language("")
                continue

            if v.name == 'admin_anomaly_mail_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.admin_anomaly_mail_template = appdata_dict['templates'][v.name]
                else:
                    new_notification.admin_anomaly_mail_template = every_language("")
                continue

            if v.name == 'notification_digest_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.notification_digest_mail_title = appdata_dict['templates'][v.name]
                else:
                    new_notification.notification_digest_mail_title = every_language("")
                continue

            if v.name == 'tip_expiration_mail_title':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.tip_expiration_mail_title = appdata_dict['templates'][v.name]
                else:
                    new_notification.tip_expiration_mail_title = every_language("")
                continue

            if v.name == 'tip_expiration_template':
                # check needed to preserve funtionality if templates will be altered in the future
                if v.name in appdata_dict['templates']:
                    new_notification.tip_expiration_template = appdata_dict['templates'][v.name]
                else:
                    new_notification.tip_expiration_template = every_language("")
                continue

            setattr(new_notification, v.name, getattr(old_notification, v.name))

        self.store_new.add(new_notification)
        self.store_new.commit()