gert.cuykens at gmail.com
Sat May 2 18:17:54 EDT 2009
On May 2, 10:58 pm, gert <gert.cuyk... at gmail.com> wrote:
> On May 2, 10:44 pm, gert <gert.cuyk... at gmail.com> wrote:
> > Aldo i like the cerrypy wsgi server very much, i do not like the tools
> > that go with it
> > so i am stuck with a configuration file that looks like this
> > After 152 line I finally arrived to a point where i was thinkig "thats
> > it, this is like going to work on a uni cycle and is just plain
> > ridicules"
> > So how can i generate some functions something like
> > def generate(url,type): # where type could be htm js css or wsgi
> I was thinking something like this ?
> def static(url, mime):
> def application(environ, response):
> f=open(os.path.join(os.path.dirname(__file__), url),'rb')
> response('200 OK', [('Content-type', mime+';charset=utf-8'),
> ('Content-Length', str(l))])
> return FileWrapper(f, 8192)
> return application
it works, i reduced it to this :-)
any other suggestions to make it smaller and more automatic ?
More information about the Python-list