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


Python server.QgsServiceRegistry类代码示例

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


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

示例1: test_1_unregister_services

    def test_1_unregister_services(self):

        reg  = QgsServiceRegistry()
        serv1 = MyService("TEST", "1.0a", "Hello")
        serv2 = MyService("TEST", "1.0b", "Hello")
        serv3 = MyService("TEST", "1.0c", "Hello")

        reg.registerService(serv1)
        reg.registerService(serv2)
        reg.registerService(serv3)

        # Check we get the default version
        service = reg.getService("TEST")
        self.assertEqual( service.version(), "1.0a" )
        
        # Remove one service
        removed = reg.unregisterService("TEST", "1.0a")
        self.assertEqual( removed, 1 )

        # Check that we get the highest version
        service = reg.getService("TEST")
        self.assertEqual( service.version(), "1.0c" )
        
         # Remove all services
        removed = reg.unregisterService("TEST")
        self.assertEqual( removed, 2 )

         # Check that there is no more services available
        service = reg.getService("TEST")
        self.assertIsNone(service)
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: test_register

    def test_register(self):

        reg = QgsServiceRegistry()

        myserv = MyService("TEST", "1.0", "Hello world")

        reg.registerService( myserv )

        # Retrieve service
        request  = QgsServerRequest("http://DoStufff", QgsServerRequest.GetMethod)
        response = Response()

        service = reg.getService("TEST")
        if service:
            service.executeRequest(request, response)
       
        io = response.io();
        io.seek(0)

        self.assertEqual(QTextStream(io).readLine(), "Hello world")
开发者ID:,项目名称:,代码行数:20,代码来源:

示例3: test_0_version_registration

    def test_0_version_registration(self):

        reg     = QgsServiceRegistry()
        myserv1 = MyService("TEST", "1.1", "Hello")
        myserv2 = MyService("TEST", "1.0", "Hello")
   
        reg.registerService( myserv1 )
        reg.registerService( myserv2)

        service = reg.getService("TEST")
        self.assertIsNotNone(service)
        self.assertEqual(service.version(), "1.1")

        service = reg.getService("TEST", "2.0")
        self.assertIsNotNone(service)
        self.assertEqual(service.version(), "1.1")

        service = reg.getService("TEST", "1.0")
        self.assertIsNotNone(service)
        self.assertEqual(service.version(), "1.0")
开发者ID:,项目名称:,代码行数:20,代码来源:


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