[py-svn] r35288 - py/dist/py/apigen/source
fijal at codespeak.net
fijal at codespeak.net
Tue Dec 5 12:52:22 CET 2006
Author: fijal
Date: Tue Dec 5 12:52:20 2006
New Revision: 35288
Added:
py/dist/py/apigen/source/server.py (contents, props changed)
Log:
Added simple server (uses pypy's server base)
Added: py/dist/py/apigen/source/server.py
==============================================================================
--- (empty file)
+++ py/dist/py/apigen/source/server.py Tue Dec 5 12:52:20 2006
@@ -0,0 +1,32 @@
+
+""" web server for displaying source
+"""
+
+import py
+from pypy.translator.js.examples import server
+from py.__.apigen.source.browser import parse_path
+from py.__.apigen.source.html import create_html
+
+class Handler(server.TestHandler):
+ BASE_URL='http://codespeak.net/svn/py/dist'
+
+ def __getattr__(self, attr):
+ url = self.BASE_URL + "/" + attr
+ if url.endswith('_py'):
+ url = url[:-3] + '.py'
+ path = py.path.svnurl(url)
+ if not path.check():
+ raise AttributeError()
+ def f(self, rev='HEAD'):
+ path = py.path.svnurl(url, rev)
+ # some try.. except.. here
+ return unicode(create_html(parse_path(path)))
+ f.exposed = True
+ f.func_name = attr
+ return f
+
+def _main():
+ server.start_server(handler=Handler, start_new=False)
+
+if __name__ == '__main__':
+ _main()
More information about the pytest-commit
mailing list