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


Python MultiService.privilegedStartService方法代码示例

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


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

示例1: setUp

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import privilegedStartService [as 别名]
class TestServicesBase:

    run_tests_with = AsynchronousDeferredRunTest.make_factory(timeout=5)

    def setUp(self):
        super(TestServicesBase, self).setUp()
        self.observers = theLogPublisher.observers[:]
        self.services = MultiService()
        self.services.privilegedStartService()
        self.services.startService()

    def tearDown(self):
        super(TestServicesBase, self).tearDown()
        d = self.services.stopService()
        # The log file must be read in right after services have stopped,
        # before the temporary directory where the log lives is removed.
        d.addBoth(lambda ignore: self.addDetailFromLog())
        d.addBoth(lambda ignore: self.assertNoObserversLeftBehind())
        return d

    def addDetailFromLog(self):
        content = content_from_file(self.log_filename, buffer_now=True)
        self.addDetail("log", content)

    def assertNoObserversLeftBehind(self):
        self.assertEqual(self.observers, theLogPublisher.observers)
开发者ID:cloudbase,项目名称:maas,代码行数:28,代码来源:test_services.py

示例2: start_site

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import privilegedStartService [as 别名]
def start_site(reactor, site, secure_ports, insecure_ports, redirect_to_port):
    parent = MultiService()
    for secure in secure_ports:
        StreamServerEndpointService(secure, site).setServiceParent(parent)

    if insecure_ports:
        redirector = make_redirector_site(redirect_to_port)
        for insecure in insecure_ports:
            StreamServerEndpointService(insecure, redirector).setServiceParent(parent)

    parent.privilegedStartService()
    parent.startService()
开发者ID:LeastAuthority,项目名称:leastauthority.com,代码行数:14,代码来源:main.py

示例3: privilegedStartService

# 需要导入模块: from twisted.application.service import MultiService [as 别名]
# 或者: from twisted.application.service.MultiService import privilegedStartService [as 别名]
 def privilegedStartService(self):
     MultiService.privilegedStartService(self)
     self.logObserver.start()
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:5,代码来源:caldav.py


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