Http server

Gert Cuykens gert.cuykens at gmail.com
Tue Dec 19 15:43:42 EST 2006


so far this works

<code>
import cherrypy
import os.path

class Http:

    def index(self):
        f = open(os.path.join(os.path.dirname(__file__), '../htm/index.htm'))
        xml = f.read()
        f.close()
        return xml
    index.exposed = True

cherrypy.tree.mount(Http())

if __name__ == '__main__':
    cherrypy.config.update(os.path.join(os.path.dirname(__file__),
'server.conf'))
    cherrypy.server.quickstart()
    cherrypy.engine.start()
</code>

I would like a cute secretary for Christmas but i dont think i will
get one. So i need to find a way to scan a directory. And map all
files inside the directory and generate a class member like

<code>
    def filename(self):
        f = open(os.path.join(os.path.dirname(__file__), '../htm/filename'))
        xml = f.read()
        f.close()
        return xml
    filename.exposed = True
</code>

Any idea or cute secretary maybe ?



More information about the Python-list mailing list