本文整理汇总了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)
示例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()
示例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()