ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/WEBCONDDB/CondWebServer/server.py
(Generate patch)

Comparing COMP/WEBCONDDB/CondWebServer/server.py (file contents):
Revision 1.14 by xiezhen, Thu Jul 17 16:19:27 2008 UTC vs.
Revision 1.22 by xiezhen, Wed May 6 16:53:46 2009 UTC

# Line 4 | Line 4 | import cherrypy
4   from optparse import OptionParser
5   import DLFCN
6   sys.setdlopenflags(DLFCN.RTLD_GLOBAL+DLFCN.RTLD_LAZY)
7 < from Applications import iov,globaltag,serviceMap
7 > from Applications import iovInspect, iovExport, globaltag,serviceMap
8 > from Common import config
9 > from pluginCondDBPyInterface import *
10 > os.environ["QUIET_ASSERT"]='yes'
11   class Root(object):
12      @cherrypy.expose
13      def index(self):
# Line 16 | Line 19 | class Server(object):
19      def __init__(self):
20          self.__hostname='localhost'
21          self.__port=6789
22 <
22 >        self.__appconfigfile='application.conf'
23 >        self.__detconfigfile='detector.conf'
24      def start (self):
25          """Start server
26          """
# Line 25 | Line 29 | class Server(object):
29                            help="port default 6789")      
30          parser.add_option("--hostname",action="store",dest="hostname",
31                            help="hostname default localhost")      
32 +        parser.add_option("--configdir",action="store",dest="configdir",
33 +                          help="configuration dir. Default to currentdir/config")
34          (options, args) = parser.parse_args()
35          if options.hostname:
36              self.__hostname=options.hostname.strip(' ')
37          if options.port:
38              self.__port=int(options.port)
39 <        
39 >        if options.configdir:
40 >            self.__configdir = options.configdir.strip(' ')
41 >        else:
42 >            currentdir=os.path.dirname(os.path.abspath(__file__))
43 >            self.__configdir = os.path.join(currentdir,'config')
44          serverconfig={'global':{'server.socket_host':self.__hostname,'server.socket_port':self.__port,'server.environment':'production'}}
45          cherrypy.config.update(serverconfig)
46          cherrypy.tree.mount(Root(),script_name='/')
47 <        currentdir=os.path.dirname(os.path.abspath(__file__))
48 <        appconfigfile=os.path.join(currentdir,'config','application.conf')
49 <        #print 'appconfigfile',appconfigfile
50 <        cherrypy.tree.mount(iov.IOV(appconfigfile),script_name='/iov')
51 <        detconfigfile=os.path.join(currentdir,'config','detector.conf')
52 <        #print 'detconfigfile',detconfigfile
53 <        cherrypy.tree.mount(serviceMap.serviceMap(detconfigfile),script_name='/serviceMap')
54 <        cherrypy.tree.mount(globaltag.GlobalTag(appconfigfile),script_name='/globaltag')
47 >
48 >        # here for the time being
49 >        self.__config=config.Config()
50 >        self.__config.from_ini(os.path.join(self.__configdir,self.__appconfigfile))
51 >        self.__authpath=self.__config.common.auth_path
52 >        #os.environ["CORAL_AUTH_PATH"] = self.__authpath
53 >        #print "auth path ", os.environ["CORAL_AUTH_PATH"]
54 >        # this one shall be alive all the time...
55 >        #self.__cmsframe = FWIncantation
56 >        cherrypy.tree.mount(iovInspect.IOV(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/iov')
57 >        cherrypy.tree.mount(iovExport.IOV(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/exportIov')
58 >        cherrypy.tree.mount(serviceMap.serviceMap(os.path.join(self.__configdir,self.__detconfigfile)),script_name='/serviceMap')
59 >        cherrypy.tree.mount(globaltag.GlobalTag(os.path.join(self.__configdir,self.__appconfigfile)),script_name='/globaltag')
60          cherrypy.server.quickstart()
61          cherrypy.engine.start()
62  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines