Package wtf :: Package app :: Package services :: Module config
[hide private]
[frames] | no frames]

Source Code for Module wtf.app.services.config

 1  # -*- coding: ascii -*- 
 2  # 
 3  # Copyright 2007-2012 
 4  # Andr\xe9 Malo or his licensors, as applicable 
 5  # 
 6  # Licensed under the Apache License, Version 2.0 (the "License"); 
 7  # you may not use this file except in compliance with the License. 
 8  # You may obtain a copy of the License at 
 9  # 
10  #     http://www.apache.org/licenses/LICENSE-2.0 
11  # 
12  # Unless required by applicable law or agreed to in writing, software 
13  # distributed under the License is distributed on an "AS IS" BASIS, 
14  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
15  # See the License for the specific language governing permissions and 
16  # limitations under the License. 
17  """ 
18  Config service 
19  ============== 
20   
21  This service provides global access to the configuration object. 
22  """ 
23  __author__ = u"Andr\xe9 Malo" 
24  __docformat__ = "restructuredtext en" 
25   
26  from wtf import services as _services 
27   
28   
29 -class ConfigService(object):
30 """ 31 Config service 32 33 This service provides global access to the configuration. 34 """ 35 __implements__ = [_services.ServiceInterface] 36
37 - def __init__(self, config, opts, args):
38 """ :See: `wtf.services.ServiceInterface.__init__` """ 39 self.config = config
40
41 - def shutdown(self):
42 """ :See: `wtf.services.ServiceInterface.shutdown` """ 43 pass
44
45 - def global_service(self):
46 """ :See: `wtf.services.ServiceInterface.global_service` """ 47 return 'wtf.config', self.config
48
49 - def middleware(self, func):
50 """ :See: `wtf.services.ServiceInterface.middleware` """ 51 return func
52