[Featureserver] Minor bugs/requests in featureserver 1.09

Kurt Schwehr schwehr at ccom.unh.edu
Sat Oct 13 14:32:20 EDT 2007


Hi Christopher,

Since I'm looking at the code, I figured I'd contribute a little back to 
the project.   I've added a little big of a command line interface to the 
featureserver_http_server.py.  It's not much, but thought it might help. 
I was thinking that it might help people try out the package if they could 
specify the location of the cfg file.  This could be for either running 
multiple feature servers or having to place the cfg outside of etc 
(e.g. my case where this is required by the fink rules - 
/sw/etc/featureserver-py25/featureserver.cfg)

The comment section is epydoc format and if you aren't into that, just 
nuke that section.  I've included an example of what the epydoc html looks 
like.

The attached script output:

./featureserver_http_server.py -h
Usage: featureserver_http_server.py [options]

Options:
   --version             show program's version number and exit
   -h, --help            show this help message and exit
   -H HOST, --host=HOST  Which network name to use for serving [default:
                         localhost]
   -p PORT, --port=PORT  Which port number to use  [default: 8080]
   -v, --verbose         Make the program explain more of what it is doing

-kurt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: epydoc-html.tar.bz2
Type: application/x-bzip2
Size: 13294 bytes
Desc: 
Url : http://lists.osgeo.org/pipermail/featureserver/attachments/20071013/6bf0ffb5/epydoc-html.tar.bz2
-------------- next part --------------
#!/usr/bin/env python
__version__ = '$Revision: 123 $'.split()[1]
__date__ = '$Date: 2007-10-13 16:58:51  $'.split()[1]
__author__ = 'MetaCarta'

__doc__='''
Stand alone feature server application

@requires: U{epydoc<http://epydoc.sourceforge.net/>} > 3.0

@author: '''+__author__+'''
@version: ''' + __version__ +'''
@var __date__: Date of last svn commit
@undocumented: __version__ __author__ __doc__ parser
@status: Works
@license: Clear BSD
@since: 2007

@todo: allow the user to specify the location of the config file
@todo: specify the dependencies
'''


import sys

if __name__ == '__main__':
    from optparse import OptionParser
    parser = OptionParser(usage="%prog [options]",version="%prog "+__version__)

    parser.add_option('-H','--host',dest='host',default='localhost'
                      ,help='Which network name to use for serving [default: %default]')

    parser.add_option('-p','--port',dest='port',default='8080',type='int'
                      ,help='Which port number to use  [default: %default]')

    parser.add_option('-v','--verbose',dest='verbose',default=False,action='store_true',
                      help='Make the program explain more of what it is doing')

    (options,args) = parser.parse_args()

    
    from FeatureServer.Server import wsgiApp
    from wsgiref import simple_server

    if options.verbose: print "Starting up Server..."
    httpd = simple_server.WSGIServer((options.host,options.port), simple_server.WSGIRequestHandler,)

    if options.verbose: print "Starting application..."
    httpd.set_app(wsgiApp)

    if options.verbose: print "Now listening at http://"+options.host+":"+str(options.port)+"/"
    httpd.serve_forever()


More information about the Featureserver mailing list