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

Python parameters.save_admin函数代码示例

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

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



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

示例1: setUp

 def setUp(self):
     super(AccessRuleTestCase, self).setUp()
     self.activate_extensions('radicale')
     populate_database()
     self.rights_file_path = tempfile.mktemp()
     parameters.save_admin(
         "RIGHTS_FILE_PATH", self.rights_file_path, app="radicale")
开发者ID:JHei,项目名称:modoboa,代码行数:7,代码来源:tests.py


示例2: setUpTestData

 def setUpTestData(cls):
     """Create test data."""
     super(AliasAPITestCase, cls).setUpTestData()
     parameters.save_admin("ENABLE_ADMIN_LIMITS", "no", app="limits")
     factories.populate_database()
     cls.da_token = Token.objects.create(
         user=core_models.User.objects.get(username="[email protected]"))
开发者ID:cubicuboctahedron,项目名称:modoboa,代码行数:7,代码来源:test_api.py


示例3: setUpTestData

 def setUpTestData(cls):
     """Create test data."""
     super(APIDomainLimitsTestCase, cls).setUpTestData()
     parameters.save_admin("ENABLE_DOMAIN_LIMITS", "yes")
     for name, tpl in utils.get_domain_limit_templates():
         parameters.save_admin(
             "DEFLT_DOMAIN_{}_LIMIT".format(name.upper()), 2)
     populate_database()
开发者ID:cubicuboctahedron,项目名称:modoboa,代码行数:8,代码来源:test_api.py


示例4: setUp

    def setUp(self):
        super(LimitsTestCase, self).setUp()

        for tpl in LimitTemplates().templates:
            parameters.save_admin("DEFLT_{0}".format(tpl[0].upper()), 2, app="limits")
        self.user = UserFactory.create(username="reseller", groups=("Resellers",))
        self.clt.logout()
        self.clt.login(username="reseller", password="toto")
开发者ID:haitao-wang,项目名称:modoboa,代码行数:8,代码来源:tests.py


示例5: unset_default_topredirection

def unset_default_topredirection(extension):
    """
    Simple callback to change the default redirection if the
    corresponding extension is being disabled.
    """
    topredirection = parameters.get_admin("DEFAULT_TOP_REDIRECTION")
    if topredirection == extension.name:
        parameters.save_admin("DEFAULT_TOP_REDIRECTION", "userprefs")
开发者ID:juju2013,项目名称:modoboa,代码行数:8,代码来源:__init__.py


示例6: setUpTestData

 def setUpTestData(cls):
     """Custom setUpTestData method."""
     super(ResourceTestCase, cls).setUpTestData()
     for name, tpl in utils.get_limit_templates():
         parameters.save_admin(
             "DEFLT_{0}_LIMIT".format(name.upper()), 2,
             app="limits"
         )
     populate_database()
开发者ID:cl0secall,项目名称:modoboa,代码行数:9,代码来源:tests.py


示例7: setUpTestData

 def setUpTestData(cls):
     """Custom setUpTestData method."""
     super(ResourceTestCase, cls).setUpTestData()
     for tpl in LimitTemplates().templates:
         parameters.save_admin(
             "DEFLT_{0}".format(tpl[0].upper()), 2,
             app="limits"
         )
     populate_database()
开发者ID:ezhishui,项目名称:modoboa,代码行数:9,代码来源:tests.py


示例8: setUp

    def setUp(self):
        """Custom setUp method.

        The 'limits' is manually loaded to ensure extra parameters
        provided by 'postfix_relay_domains' are properly received.
        """
        super(ResourceTestCase, self).setUp()
        for tpl in LimitTemplates().templates:
            parameters.save_admin('DEFLT_%s' % tpl[0].upper(), 2, app='limits')
        populate_database()
开发者ID:kaxdev,项目名称:modoboa,代码行数:10,代码来源:tests.py


示例9: test_autocreate_disabled

 def test_autocreate_disabled(self):
     """Check if objects are not created as expected."""
     self.activate_ldap_authentication()
     self.searchbind_mode()
     parameters.save_admin("AUTO_CREATE_DOMAIN_AND_MAILBOX", "no")
     username = "[email protected]"
     self.authenticate(username, "test")
     self.assertFalse(
         models.Domain.objects.filter(name="example.com").exists())
     self.assertFalse(
         models.Mailbox.objects.filter(address="testuser").exists())
开发者ID:iecsp,项目名称:modoboa,代码行数:11,代码来源:test_account.py


示例10: setUpTestData

    def setUpTestData(cls):
        """Create test data."""
        super(LimitsTestCase, cls).setUpTestData()

        for tpl in LimitTemplates().templates:
            parameters.save_admin(
                "DEFLT_{0}".format(tpl[0].upper()), 2, app="limits"
            )
        cls.user = UserFactory.create(
            username='reseller', groups=('Resellers',)
        )
开发者ID:euank,项目名称:modoboa,代码行数:11,代码来源:tests.py


示例11: test_model

 def test_model(self):
     """Check few things about the model."""
     Radicale().load()
     mbox = Mailbox.objects.get(address="admin", domain__name="test.com")
     cal = UserCalendarFactory(name="MyCal", mailbox=mbox)
     with self.assertRaises(lib_exceptions.InternalError) as cm:
         url = cal.url
     self.assertEqual(
         str(cm.exception), "Server location is not set, please fix it.")
     parameters.save_admin(
         "SERVER_LOCATION", "http://localhost", app="modoboa_radicale")
     self.assertEqual(cal.url, "http://localhost/test.com/user/admin/MyCal")
开发者ID:alphacc,项目名称:modoboa-radicale,代码行数:12,代码来源:tests.py


示例12: setUp

    def setUp(self):
        """Custom setUp method.

        The 'limits' is manually loaded to ensure extra parameters
        provided by 'postfix_relay_domains' are properly received.
        """
        super(ResourceTestCase, self).setUp()
        #exts_pool.load_extension("modoboa_admin_limits")
        for tpl in LimitTemplates().templates:
            parameters.save_admin(
                "DEFLT_{0}".format(tpl[0].upper()), 2,
                app="modoboa_admin_limits"
            )
        populate_database()
开发者ID:bearstech,项目名称:modoboa-admin-limits,代码行数:14,代码来源:tests.py


示例13: setUp

    def setUp(self):
        super(LimitsTestCase, self).setUp()
        from modoboa_admin_limits.models import LimitTemplates

        for tpl in LimitTemplates().templates:
            parameters.save_admin(
                "DEFLT_{0}".format(tpl[0].upper()), 2,
                app="modoboa_admin_limits"
            )
        self.user = UserFactory.create(
            username='reseller', groups=('Resellers',)
        )
        self.clt.logout()
        self.clt.login(username='reseller', password='toto')
开发者ID:disko,项目名称:modoboa-admin-relaydomains,代码行数:14,代码来源:tests.py


示例14: test_searchbind_authentication

    def test_searchbind_authentication(self):
        """Test the bind&search method."""
        self.searchbind_mode()
        username = "[email protected]"
        self.authenticate(username, "test")
        self.check_created_user(username)
        self.client.logout()

        parameters.save_admin("LDAP_ADMIN_GROUPS", "admins")
        parameters.save_admin(
            "LDAP_GROUPS_SEARCH_BASE", "ou=groups,dc=example,dc=com")
        username = "[email protected]"
        self.authenticate(username, "test", False)
        self.check_created_user(username, "DomainAdmins")
开发者ID:carriercomm,项目名称:modoboa,代码行数:14,代码来源:tests.py


示例15: test_create_using_default_quota

 def test_create_using_default_quota(self):
     parameters.save_admin('DEFAULT_DOMAIN_QUOTA', 50, app='admin')
     values = {
         "name": "pouet.com", "create_dom_admin": "yes",
         "dom_admin_username": "toto", "create_aliases": "yes",
         "type": "domain", "stepid": 'step3'
     }
     self.ajax_post(
         reverse("admin:domain_add"),
         values
     )
     dom = Domain.objects.get(name="pouet.com")
     self.assertEqual(dom.quota, 50)
     da = User.objects.get(username="[email protected]")
     self.assertEqual(da.mailbox.quota, 50)
开发者ID:iecsp,项目名称:modoboa,代码行数:15,代码来源:test_domain.py


示例16: test_create_using_default_quota

 def test_create_using_default_quota(self):
     parameters.save_admin('DEFAULT_DOMAIN_QUOTA', 50, app='admin')
     values = {
         "name": "pouet.com", "create_dom_admin": "yes",
         "dom_admin_username": "toto", "create_aliases": "yes",
         "stepid": 'step2'
     }
     self.ajax_post(
         reverse("modoboa.extensions.admin.views.domain.newdomain"),
         values
     )
     dom = Domain.objects.get(name="pouet.com")
     self.assertEqual(dom.quota, 50)
     da = User.objects.get(username="[email protected]")
     self.assertEqual(da.mailbox_set.all()[0].quota, 50)
开发者ID:JHei,项目名称:modoboa,代码行数:15,代码来源:domain.py


示例17: test_domain_detail_view

 def test_domain_detail_view(self):
     """Test Domain detail view."""
     parameters.save_admin(
         "ENABLE_DOMAIN_LIMITS", "no", app="limits")
     domain = Domain.objects.get(name="test.com")
     url = reverse("admin:domain_detail", args=[domain.pk])
     response = self.client.get(url)
     self.assertEqual(response.status_code, 200)
     self.assertIn("Information", response.content)
     self.assertIn("Administrators", response.content)
     self.assertNotIn("Resources usage", response.content)
     parameters.save_admin(
         "ENABLE_DOMAIN_LIMITS", "yes", app="limits")
     response = self.client.get(url)
     self.assertIn("Resources usage", response.content)
开发者ID:iecsp,项目名称:modoboa,代码行数:15,代码来源:test_domain.py


示例18: setUpTestData

    def setUpTestData(cls):
        """Create test data."""
        from modoboa.lib import parameters
        from modoboa.limits.models import LimitTemplates

        super(PermissionsTestCase, cls).setUpTestData()
        for tpl in LimitTemplates().templates:
            parameters.save_admin(
                "DEFLT_{0}".format(tpl[0].upper()), 2,
                app="limits"
            )
        factories.populate_database()
        cls.user = User.objects.get(username='[email protected]')
        cls.values = dict(
            username=cls.user.username, role="DomainAdmins",
            is_active=cls.user.is_active, email="[email protected]",
            quota_act=True
        )
开发者ID:joelfranco,项目名称:modoboa,代码行数:18,代码来源:test_account.py


示例19: setUpTestData

    def setUpTestData(cls):
        """Create test data."""
        from modoboa.lib import parameters
        from modoboa.limits import utils as limits_utils

        super(PermissionsTestCase, cls).setUpTestData()
        for name, tpl in limits_utils.get_user_limit_templates():
            parameters.save_admin(
                "DEFLT_USER_{0}_LIMIT".format(name.upper()), 2,
                app="limits"
            )
        factories.populate_database()
        cls.user = User.objects.get(username='[email protected]')
        cls.values = dict(
            username=cls.user.username, role="DomainAdmins",
            is_active=cls.user.is_active, email="[email protected]",
            quota_act=True
        )
开发者ID:cubicuboctahedron,项目名称:modoboa,代码行数:18,代码来源:test_account.py


示例20: test_directbind_authentication

    def test_directbind_authentication(self):
        """Test the directbind method."""
        self.client.logout()
        self.directbind_mode()

        # 1: must fail because usernames of simple users must be email
        # addresses
        username = "testuser"
        with self.assertRaises(TypeError):
            self.client.login(username=username, password="test")

        # 1: must work because usernames of domain admins are not
        # always email addresses
        parameters.save_admin("LDAP_ADMIN_GROUPS", "admins")
        parameters.save_admin(
            "LDAP_GROUPS_SEARCH_BASE", "ou=groups,dc=example,dc=com")
        username = "mailadmin"
        self.authenticate(username, "test", False)
        self.check_created_user(username, "DomainAdmins", False)
开发者ID:carriercomm,项目名称:modoboa,代码行数:19,代码来源:tests.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python permissions.get_object_owner函数代码示例发布时间:2022-05-27
下一篇:
Python parameters.register函数代码示例发布时间: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