1 #=======================================================================
3 __version__
= '''0.0.01'''
4 __sub_version__
= '''20080307035538'''
5 __copyright__
= '''(c) Alex A. Naanou 2008'''
8 #-----------------------------------------------------------------------
10 from twisted
.web
import server
, resource
11 from twisted
.internet
import reactor
13 from test_page
import root
16 #-----------------------------------------------------------------------
18 # NOTE: set this to None to disable caching...
21 class Fetcher(resource
.Resource
):
24 def render_GET(self
, request
):
25 path
= request
.postpath
[:]
27 if path
[-1] == 'general.css':
28 return file('test/general.css', 'r').read()
29 if path
[-1].split('.')[-1] in ('html', 'rst', 'rawhtml'):
30 path
[-1], format
= path
[-1].split('.')
37 # XXX this caching is brain-dead :)
39 if (cur
, format
) in cache
:
40 return cache
[(cur
, format
)]
41 res
= cache
[(cur
, format
)] = getattr(cur
, format
)
44 return getattr(cur
, format
)
47 #- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
49 site
= server
.Site(Fetcher())
50 reactor
.listenTCP(8080, site
)
55 #=======================================================================
56 # vim:set ts=4 sw=4 nowrap :