• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python conf.register_setting函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mezzanine.conf.register_setting函数的典型用法代码示例。如果您正苦于以下问题:Python register_setting函数的具体用法?Python register_setting怎么用?Python register_setting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_bytes_conversion

    def test_bytes_conversion(self):

        settings.clear_cache()

        register_setting(name="BYTES_TEST_SETTING", editable=True, default=b"")
        Setting.objects.create(name="BYTES_TEST_SETTING", value="A unicode value")
        self.assertEqual(settings.BYTES_TEST_SETTING, b"A unicode value")
开发者ID:AliLozano,项目名称:mezzanine,代码行数:7,代码来源:tests.py


示例2: test_invalid_value_warning

    def test_invalid_value_warning(self):
        """
        Test that a warning is raised when a database setting has an invalid
        value, i.e. one that can't be converted to the correct Python type.
        """

        settings.clear_cache()

        register_setting(name="INVALID_INT_SETTING", editable=True, default=0)
        Setting.objects.create(name="INVALID_INT_SETTING", value='zero')
        with warnings.catch_warnings():
            warning_re = r'The setting \w+ should be of type'
            warnings.filterwarnings('error', warning_re, UserWarning)
            with self.assertRaises(UserWarning):
                settings.INVALID_INT_SETTING
        self.assertEqual(settings.INVALID_INT_SETTING, 0)
开发者ID:yomguy,项目名称:mezzanine,代码行数:16,代码来源:tests.py


示例3: test_unregistered_setting

    def test_unregistered_setting(self):
        """
        Test that accessing any editable setting will delete all Settings
        with no corresponding registered setting from the database.
        """

        settings.clear_cache()

        register_setting(name="REGISTERED_SETTING", editable=True, default="")
        Setting.objects.create(name="UNREGISTERED_SETTING", value='')

        with self.assertRaises(AttributeError):
            settings.UNREGISTERED_SETTING

        qs = Setting.objects.filter(name="UNREGISTERED_SETTING")
        self.assertEqual(qs.count(), 1)

        # This triggers Settings._load(), which deletes unregistered Settings
        settings.REGISTERED_SETTING

        self.assertEqual(qs.count(), 0)
开发者ID:yomguy,项目名称:mezzanine,代码行数:21,代码来源:tests.py


示例4: test_conflicting_setting

    def test_conflicting_setting(self):
        """
        Test that conflicting settings raise a warning and use the settings.py
        value instead of the value from the database.
        """

        settings.clear_cache()

        register_setting(name="CONFLICTING_SETTING", editable=True, default=1)
        Setting.objects.create(name="CONFLICTING_SETTING", value=2)
        settings.CONFLICTING_SETTING = 3

        with warnings.catch_warnings():
            warning_re = "These settings are defined in both " "settings\.py and the database"
            warnings.filterwarnings("error", warning_re, UserWarning)

            with self.assertRaises(UserWarning):
                settings.CONFLICTING_SETTING

        self.assertEqual(settings.CONFLICTING_SETTING, 3)

        del settings.CONFLICTING_SETTING
开发者ID:AliLozano,项目名称:mezzanine,代码行数:22,代码来源:tests.py


示例5: register_setting

from mezzanine.conf import register_setting
from django.utils.translation import ugettext_lazy as _


register_setting(
    name="NEWS_SLUG",
    label=_("News slug"),
    description=_("The slug name for page representing the news list."),
    editable=True,
    default="news",
)

register_setting(
    name="NEWS_PER_PAGE",
    label=_("News per page"),
    description=_("The number of news entries to show on a single page."),
    editable=True,
    default=10,
)

register_setting(
    name="NEWS_IMG_DIR",
    label=_("News image directory"),
    description=_("The directory for news images."),
    editable=True,
    default="uploads/news",
)
开发者ID:keznikl,项目名称:bozp,代码行数:27,代码来源:defaults.py


示例6: register_setting

that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost",
           "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
    ),
)

register_setting(
    name="ADMIN_REMOVAL",
    description=_("Unregister these models from the admin."),
    editable=False,
    default=(),
)

register_setting(
    name="ADMIN_THUMB_SIZE",
开发者ID:Donneker,项目名称:mezzanine,代码行数:31,代码来源:defaults.py


示例7: register_setting

the setting is editable via Django's admin.

Thought should be given to how a setting is actually used before
making it editable, as it may be inappropriate - for example settings
that are only read during startup shouldn't be editable, since changing
them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="ACCOUNTS_MIN_PASSWORD_LENGTH",
    description=_("Minimum length for passwords"),
    editable=False,
    default=6,
)

register_setting(
    name="ACCOUNTS_NO_USERNAME",
    description=_("If ``True``, the username field will be excluded "
        "from sign up and account update forms."),
    editable=False,
    default=False,
)

register_setting(
    name="ACCOUNTS_PROFILE_FORM_EXCLUDE_FIELDS",
    description=_("List of fields to exclude from the profile form."),
    editable=False,
开发者ID:AdnanHodzic,项目名称:mezzanine,代码行数:32,代码来源:defaults.py


示例8: register_setting

from mezzanine.conf import register_setting

register_setting(
    name="TEMPLATE_ACCESSIBLE_SETTINGS",
    append=True,
    default=("SOCIAL_LINK_FACEBOOK",
             "SOCIAL_LINK_TWITTER",
             "SOCIAL_LINK_PINTEREST",
             "SOCIAL_LINK_VIMEO",
             "SOCIAL_LINK_TUMBLR",
             "SOCIAL_LINK_DELICIOUS",
             ),
)

register_setting(
    name="SOCIAL_LINK_FACEBOOK",
    label="Facebook link",
    description="If present a Facebook icon linking here will be in the header.",
    editable=True,
    default="https://facebook.com/mezzatheme",
)

register_setting(
    name="SOCIAL_LINK_TWITTER",
    label="Twitter link",
    description="If present a Twitter icon linking here will be in the header.",
    editable=True,
    default="https://twitter.com/mezzatheme",
)

register_setting(
开发者ID:mjstealey,项目名称:pam-web,代码行数:31,代码来源:defaults.py


示例9: register_setting

from mezzanine.conf import register_setting

register_setting(
    name="RICHTEXT_ALLOWED_TAGS",
    append=True,
    default=("script",),
)
开发者ID:JesusAnaya,项目名称:jesusanaya.com,代码行数:7,代码来源:defaults.py


示例10: register_setting

from mezzanine.conf import register_setting

register_setting(
	name="MZEVENTS_GOOGLE_MAPS_DOMAIN",
	description="The Google Maps country domain to geocode addresses with",
	editable=True,
	default="maps.google.com.au",
)

register_setting(
	name="MZEVENTS_HIDPI_STATIC_MAPS",
	description="Generate maps suitable for Retina displays",
	editable=True,
	default=True,
)
开发者ID:joshcartme,项目名称:mezzanine-events,代码行数:15,代码来源:defaults.py


示例11: getattr

from __future__ import unicode_literals
from future.builtins import range

from django.conf import settings
from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


generic_comments = getattr(settings, "COMMENTS_APP", "") == "mezzanine.generic"

if generic_comments:
    register_setting(
        name="COMMENTS_ACCOUNT_REQUIRED",
        label=_("Accounts required for commenting"),
        description=_("If ``True``, users must log in to comment."),
        editable=True,
        default=False,
    )

    register_setting(
        name="COMMENTS_DISQUS_SHORTNAME",
        label=_("Disqus shortname"),
        description=_("Shortname for the http://disqus.com comments "
                      "service."),
        editable=True,
        default="",
    )

    register_setting(
        name="COMMENTS_DISQUS_API_PUBLIC_KEY",
开发者ID:11m09d,项目名称:weixin_market,代码行数:31,代码来源:defaults.py


示例12: register_setting

them would require an application reload.
"""

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="PAGE_MENU_TEMPLATES",
    description=_("A sequence of templates used by the ``page_menu`` "
        "template tag. Each item in the sequence is a three item sequence, "
        "containing a unique ID for the template, a label for the template, "
        "and the template path. These templates are then available for "
        "selection when editing which menus a page should appear in. Note "
        "that if a menu template is used that doesn't appear in this "
        "setting, all pages will appear in it."),
    editable=False,
    default=(
        (1, _("Top navigation bar"), "pages/menus/dropdown.html"),
        (2, _("Left-hand tree"), "pages/menus/tree.html"),
        (3, _("Footer"), "pages/menus/footer.html"),
    ),
)

register_setting(
    name="PAGE_MENU_TEMPLATES_DEFAULT",
    description=_("A sequence of IDs from the ``PAGE_MENU_TEMPLATES`` "
        "setting that defines the default menu templates selected when "
        "creating new pages. By default all menu templates are selected. "
        "Set this setting to an empty sequence to have no templates "
        "selected by default."),
开发者ID:Aviatorjeremy,项目名称:mezzanine,代码行数:32,代码来源:defaults.py


示例13: register_setting

from mezzanine.conf import register_setting

from django.utils.translation import ugettext as _

#register_setting(
#    name="IMAGE_FIELD_WIDGET_CLASS",
#    description=_("Dotted package path and class name of the widget to use "
#                  "for the image fields`."),
#    editable=False,
#    default="django.forms.FileInput",
#)

register_setting(
    name="RESTRICTED_WIDGETS",
    label="Restricted Widgets",
    description=_("Widgets which cannot be added by a client "),
    editable=False,
    append=True,
    default=[
        "TestWidget"
    ],
)

register_setting(
    name="WIDGET_PERMISSION_HANDLER",
    label="Widget Permission Handler",
    description=_("A class which handles permissions for widgets"),
    editable=False,
    default=None,
)
开发者ID:gelliravi,项目名称:mezzanine_widgets,代码行数:30,代码来源:defaults.py


示例14: register_setting

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

register_setting(
    name="Enable Twitter",
    label=_("For sending info about events"),
    description=_("For sending info about events."),
    editable=True,
    default=True,
)

register_setting(
    name="Consumer Key",
    label=_("Twitter Consumer Key"),
    description=_("Twitter Consumer Key"),
    editable=True,
    default="",
)

register_setting(
    name="Consumer Secret",
    label=_("Twitter Consumer Secret"),
    description=_("Twitter Consumer Secret."),
    editable=True,
    default="",
)

register_setting(
    name="Access Token",
    label=_("Twitter Access Token"),
    description=_("Twitter Access Token."),
开发者ID:galuszkak,项目名称:mezzanine-community,代码行数:31,代码来源:defaults.py


示例15: register_setting

from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting


##################################################
#  These first set of settings already exist in  #
#  mezzanine.conf.defaults, and are overridden   #
#  or appended to here, with Cartridge values.   #
##################################################

# Default to False in Mezzanine, change to True so checkout can have
# an account option.
register_setting(
    name="ACCOUNTS_ENABLED",
    description="If True, users can create an account.",
    editable=False,
    default=True,
)

# Add shop admin modules to the admin menu.
register_setting(
    name="ADMIN_MENU_ORDER",
    description=_("Controls the ordering and grouping of the admin menu."),
    editable=False,
    default=(
        (_("Content"), ("pages.Page", "blog.BlogPost",
            "generic.ThreadedComment", (_("Media Library"), "fb_browse"),)),
        (_("Shop"), ("shop.Product", "shop.ProductOption", "shop.DiscountCode",
            "shop.Sale", "shop.Order")),
        (_("Site"), ("sites.Site", "redirects.Redirect", "conf.Setting")),
        (_("Users"), ("auth.User", "auth.Group",)),
开发者ID:krbanton,项目名称:cartridge,代码行数:32,代码来源:defaults.py


示例16: register_setting

from django.utils.translation import ugettext as _
from mezzanine.conf import register_setting


register_setting(
    name="MEZZANINE_EDITOR_ENABLED",
    description=_("Toggles editor workflow."),
    editable=True,
    default=True,
)


register_setting(
    name="MEZZANINE_EDITOR_GROUPNAME",
    description=_("Name for editor group."),
    editable=True,
    default="Editor",
)


register_setting(
    name="MEZZANINE_EDITOR_SUPER",
    description=_("Treat superuser as an editor."),
    editable=True,
    default=False,
)
开发者ID:renyi,项目名称:mezzanine-editor,代码行数:26,代码来源:defaults.py


示例17: register_setting

from socket import gethostname

from django.utils.translation import ugettext as _

from mezzanine.conf import register_setting


register_setting(
    name="SHOP_CARD_TYPES",
    description="Sequence of available credit card types for payment.",
    editable=False,
    default=("Mastercard", "Visa", "Diners", "Amex"),
)

register_setting(
    name="SHOP_CART_EXPIRY_MINUTES",
    description="Number of minutes of inactivity until carts are abandoned.",
    editable=False,
    default=30,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_ENABLED",
    description="If True, users can create a login for the checkout process.",
    editable=False,
    default=True,
)

register_setting(
    name="SHOP_CHECKOUT_ACCOUNT_REQUIRED",
开发者ID:gwho,项目名称:cartridge,代码行数:30,代码来源:defaults.py


示例18: register_setting

from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _
from mezzanine.conf import register_setting

register_setting(
    name="BUFFER_CLIENT_ID",
    label=_("Buffer Client ID"),
    editable=True,
    default='',
)

register_setting(
    name="BUFFER_CLIENT_SECRET",
    label=_("Buffer Client Secret"),
    editable=True,
    default='',
)

register_setting(
    name="BUFFER_ACCESS_TOKEN",
    label=_("Buffer Access Token"),
    editable=True,
    default='',
)
开发者ID:caffodian,项目名称:mezzanine-buffer,代码行数:25,代码来源:defaults.py


示例19: register_setting

        "openhelpdesk.add_tipology",
        "openhelpdesk.change_tipology",
        "openhelpdesk.delete_tipology",
        "auth.add_user",
        "auth.change_user",
        "auth.add_group",
        "auth.change_group",
    ],
)
OPENHELPDESK_MAX_TIPOLOGIES_FOR_TICKET = 3
OPENHELPDESK_LDAP_OPERATOR_GROUPS = "Domain Admins"
OPENHELPDESK_LDAP_REQUESTER_GROUPS = ""

register_setting(
    name="HELPDESK_REQUESTERS",
    description="The group name of requesters.",
    editable=False,
    default=HELPDESK_REQUESTERS[0],
)

register_setting(
    name="HELPDESK_OPERATORS",
    description="The group name of helpdesk operator.",
    editable=False,
    default=HELPDESK_OPERATORS[0],
)

register_setting(
    name="HELPDESK_ADMINS", description="The group name of helpdesk admins.", editable=False, default=HELPDESK_ADMINS[0]
)

register_setting(
开发者ID:simodalla,项目名称:open-helpdesk,代码行数:32,代码来源:defaults.py


示例20: register_setting

from django.utils.translation import ugettext_lazy as _

from mezzanine.conf import register_setting


register_setting(
    name="SITE_FULL_TITLE",
    label=_("Full Site Title"),
    description="Expanded title",
    editable=True,
    default="People's Archive of Rural India",
)
register_setting(
    name="ANALYTICS_PIWIK_URL",
    label=_("PIWIK hosted instance url ( don't include the protocol)"),
    description="Anyalytics with PIWIK",
    editable=True,
    default="analytics-ruralindiaonline.rhcloud.com",
)
register_setting(
    name="ANALYTICS_ENABLED",
    description="Setting to enable / disable analytics",
    editable=True,
    default=False,
)
register_setting(
    name="SOCIAL_FACEBOOK",
    label=_("Facebook Page Url"),
    description="Facebook Page Url for PARI",
    editable=True,
    default="http://facebook.com",
开发者ID:manojlds,项目名称:pari,代码行数:31,代码来源:defaults.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python settings.use_editable函数代码示例发布时间:2022-05-27
下一篇:
Python accounts.get_profile_model函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap