当前位置: 首页>>代码示例>>Python>>正文


Python EventSetting.delete_all方法代码示例

本文整理汇总了Python中indico.modules.events.models.settings.EventSetting.delete_all方法的典型用法代码示例。如果您正苦于以下问题:Python EventSetting.delete_all方法的具体用法?Python EventSetting.delete_all怎么用?Python EventSetting.delete_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在indico.modules.events.models.settings.EventSetting的用法示例。


在下文中一共展示了EventSetting.delete_all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_all

# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import delete_all [as 别名]
    def delete_all(self, event):
        """Deletes all settings.

        :param event: Event (or its ID)
        """
        EventSetting.delete_all(self.module, event_id=event)
        EventSettingPrincipal.delete_all(self.module, event_id=event)
        self._flush_cache()
开发者ID:k3njiy,项目名称:indico,代码行数:10,代码来源:settings.py

示例2: migrate_event_settings

# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import delete_all [as 别名]
    def migrate_event_settings(self):
        self.messages.append(cformat("%{magenta!} - Event Payment Settings:"))
        print cformat("%{white!}migrating event settings")

        count = 0

        EventSetting.delete_all(payment_event_settings.module)
        for event in committing_iterator(self._iter_events()):
            old_payment = event._modPay
            default_conditions = global_settings.get("conditions")
            default_register_email = global_settings.get("register_email")
            default_success_email = global_settings.get("success_email")
            register_email = getattr(old_payment, "receiptMsg", default_register_email)
            success_email = getattr(old_payment, "successMsg", default_success_email)
            conditions = (
                getattr(old_payment, "paymentConditions", default_conditions)
                if (
                    getattr(old_payment, "paymentConditionsEnabled", False)
                    and convert_to_unicode(getattr(old_payment, "specificPaymentConditions", "")).strip() == ""
                )
                else getattr(old_payment, "specificPaymentConditions", "")
            )
            # The new messages are shown in an "additional info" section, so the old defaults can always go away
            if convert_to_unicode(register_email) == "Please, see the summary of your order:":
                register_email = ""
            if convert_to_unicode(success_email) == "Congratulations, your payment was successful.":
                success_email = ""
            # Get rid of the most terrible part of the old default conditions
            conditions = convert_to_unicode(conditions).replace("CANCELLATION :", "CANCELLATION:")
            settings = {
                "enabled": getattr(old_payment, "activated", False),
                "currency": event._registrationForm._currency,
                "conditions": conditions,
                "register_email": register_email,
                "success_email": success_email,
            }
            payment_event_settings.set_multi(event, settings)

            count += 1
            print cformat("%{cyan}<EventSettings(id={id:>6}, enabled={enabled}, " "currency={currency})>").format(
                id=event.id, **settings
            )

        msg = cformat("%{green!}migration of {0} event payment settings successful\n").format(count)
        self.messages.append("    " + msg)
        print msg
开发者ID:MichelCordeiro,项目名称:indico,代码行数:48,代码来源:payment.py

示例3: migrate_event_settings

# 需要导入模块: from indico.modules.events.models.settings import EventSetting [as 别名]
# 或者: from indico.modules.events.models.settings.EventSetting import delete_all [as 别名]
 def migrate_event_settings(self):
     print cformat('%{white!}migrating event settings')
     default_method_name = PaypalPaymentPlugin.settings.get('method_name')
     EventSetting.delete_all(PaypalPaymentPlugin.event_settings.module)
     account_id_re = re.compile(r'^[a-zA-Z0-9]{13}$')
     for event in committing_iterator(self._iter_events(), 25):
         pp = event._modPay.payMods['PayPal']
         business = pp._business.strip()
         if not business or (not is_valid_mail(business, multi=False) and not account_id_re.match(business)):
             print cformat(' - %{yellow!}event {} skipped (business: {})').format(event.id, business or '(none)')
             continue
         PaypalPaymentPlugin.event_settings.set(event, 'enabled', True)
         method_name = convert_to_unicode(pp._title)
         if method_name.lower() == 'paypal':
             method_name = default_method_name
         PaypalPaymentPlugin.event_settings.set(event, 'method_name', method_name)
         PaypalPaymentPlugin.event_settings.set(event, 'business', pp._business)
         print cformat(' - %{cyan}event {} (business: {})').format(event.id, pp._business)
开发者ID:florv,项目名称:indico-plugins,代码行数:20,代码来源:zodbimport.py


注:本文中的indico.modules.events.models.settings.EventSetting.delete_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。