[pypy-svn] r5956 - pypy/trunk/src/goal/translate_pypy

arigo at codespeak.net arigo at codespeak.net
Fri Aug 13 18:30:53 CEST 2004


Author: arigo
Date: Fri Aug 13 18:30:52 2004
New Revision: 5956

Added:
   pypy/trunk/src/goal/translate_pypy/cdef.html
Modified:
   pypy/trunk/src/goal/translate_pypy/graphserver.py
   pypy/trunk/src/goal/translate_pypy/index.html
Log:
Showing the Classdefs after annotation in the HTTP server.


Added: pypy/trunk/src/goal/translate_pypy/cdef.html
==============================================================================
--- (empty file)
+++ pypy/trunk/src/goal/translate_pypy/cdef.html	Fri Aug 13 18:30:52 2004
@@ -0,0 +1,32 @@
+<HTML>
+<HEAD>
+</HEAD>
+<BODY>
+
+<h1>%(classdef.cls.__module__)s.%(classdef.cls.__name__)s</h1>
+
+%(
+if classdef.basedef in t.annotator.getuserclassdefinitions():
+    print '<p>Parent class <a href="cdef?i=%d">%s</a>.</p>' % (
+        t.annotator.getuserclassdefinitions().index(classdef.basedef),
+        classdef.basedef.cls.__name__)
+)s
+
+<p>Revision %(classdef.revision)d.</p>
+
+<h2>Attributes and methods</h2>
+<table CELLSPACING=1 CELLPADDING=1 BORDER=1>
+%(
+attrs = classdef.attrs.items()
+attrs.sort()
+for name, s_value in attrs:
+    print "<tr><td>&nbsp;"
+    print "%s" % htmlquote(name)
+    print "&nbsp;</td><td>&nbsp;"
+    print "<code>%s</code>" % htmlquote(repr(s_value))
+    print "&nbsp;</td></tr>"
+)s
+</table>
+
+</BODY>
+</HTML>

Modified: pypy/trunk/src/goal/translate_pypy/graphserver.py
==============================================================================
--- pypy/trunk/src/goal/translate_pypy/graphserver.py	(original)
+++ pypy/trunk/src/goal/translate_pypy/graphserver.py	Fri Aug 13 18:30:52 2004
@@ -75,11 +75,21 @@
         data += '</body></html>'
         return StringIO(data), 'text/html'
 
+    def cdefloader(self, i, **options):
+        i = int(i[0])
+        t = self.translator
+        classdef = t.annotator.getuserclassdefinitions()[i]
+        return httpserver.load('cdef.html', 'text/html',
+                               {'t': t,
+                                'classdef': classdef,
+                                })
+
     def serve(self, port=8000):
         httpserver.register('', self.indexloader)
         httpserver.register('func', self.funcloader)
         httpserver.register('img', self.imgloader)
         httpserver.register('var', self.varloader)
+        httpserver.register('cdef', self.cdefloader)
         httpserver.serve(port)
 
 # ____________________________________________________________

Modified: pypy/trunk/src/goal/translate_pypy/index.html
==============================================================================
--- pypy/trunk/src/goal/translate_pypy/index.html	(original)
+++ pypy/trunk/src/goal/translate_pypy/index.html	Fri Aug 13 18:30:52 2004
@@ -13,5 +13,18 @@
     print "&nbsp;</td></tr>"
 )s
 </table>
+<h1>Classdefs</h1>
+<table CELLSPACING=1 CELLPADDING=1 BORDER=1>
+%(
+lst = t.annotator.getuserclassdefinitions()
+for i, classdef in zip(range(len(lst)), lst):
+    print "<tr><td>&nbsp;"
+    print "%s" % htmlquote(classdef.cls.__module__)
+    print "&nbsp;</td><td>&nbsp;"
+    print "<code><a href='cdef?i=%d'>%s</a></code>" % (i,
+        htmlquote(classdef.cls.__name__))
+    print "&nbsp;</td></tr>"
+)s
+</table>
 </body>
 </html>



More information about the Pypy-commit mailing list