thirdparty/google_appengine/google/appengine/api/capabilities/capability_stub.py
changeset 828 f5fd65cc3bf3
equal deleted inserted replaced
827:88c186556a80 828:f5fd65cc3bf3
       
     1 #!/usr/bin/env python
       
     2 #
       
     3 # Copyright 2007 Google Inc.
       
     4 #
       
     5 # Licensed under the Apache License, Version 2.0 (the "License");
       
     6 # you may not use this file except in compliance with the License.
       
     7 # You may obtain a copy of the License at
       
     8 #
       
     9 #     http://www.apache.org/licenses/LICENSE-2.0
       
    10 #
       
    11 # Unless required by applicable law or agreed to in writing, software
       
    12 # distributed under the License is distributed on an "AS IS" BASIS,
       
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
    14 # See the License for the specific language governing permissions and
       
    15 # limitations under the License.
       
    16 #
       
    17 
       
    18 """Stub version of the capability service API, everything is always enabled."""
       
    19 
       
    20 
       
    21 
       
    22 from google.appengine.api import apiproxy_stub
       
    23 from google.appengine.api import capabilities
       
    24 
       
    25 IsEnabledRequest = capabilities.IsEnabledRequest
       
    26 IsEnabledResponse = capabilities.IsEnabledResponse
       
    27 CapabilityConfig = capabilities.CapabilityConfig
       
    28 
       
    29 class CapabilityServiceStub(apiproxy_stub.APIProxyStub):
       
    30   """Python only capability service stub."""
       
    31 
       
    32   def __init__(self, service_name='capability_service'):
       
    33     """Constructor.
       
    34 
       
    35     Args:
       
    36       service_name: Service name expected for all calls.
       
    37     """
       
    38     super(CapabilityServiceStub, self).__init__(service_name)
       
    39 
       
    40 
       
    41   def _Dynamic_IsEnabled(self, request, response):
       
    42     """Implementation of CapabilityService::IsEnabled().
       
    43 
       
    44     Args:
       
    45       request: An IsEnabledRequest.
       
    46       response: An IsEnabledResponse.
       
    47     """
       
    48     response.set_summary_status(IsEnabledResponse.ENABLED)
       
    49 
       
    50     default_config = response.add_config()
       
    51     default_config.set_package('')
       
    52     default_config.set_capability('')
       
    53     default_config.set_status(CapabilityConfig.ENABLED)