[pypy-svn] r36108 - in pypy/dist/pypy: doc/js translator/js translator/js/demo/jsdemo translator/js/demo/jsdemo/djangoping translator/js/examples translator/js/modules translator/js/modules/test translator/js/test translator/js/tutorial

fijal at codespeak.net fijal at codespeak.net
Tue Jan 2 16:18:20 CET 2007


Author: fijal
Date: Tue Jan  2 16:18:14 2007
New Revision: 36108

Modified:
   pypy/dist/pypy/doc/js/webapps_with_pypy.txt
   pypy/dist/pypy/translator/js/asmgen.py
   pypy/dist/pypy/translator/js/database.py
   pypy/dist/pypy/translator/js/demo/jsdemo/consserv.py
   pypy/dist/pypy/translator/js/demo/jsdemo/controllers.py
   pypy/dist/pypy/translator/js/demo/jsdemo/djangoping/client.py
   pypy/dist/pypy/translator/js/demo/jsdemo/example.py
   pypy/dist/pypy/translator/js/demo/jsdemo/pythonconsole.py
   pypy/dist/pypy/translator/js/examples/console.py
   pypy/dist/pypy/translator/js/examples/start_bnb.py
   pypy/dist/pypy/translator/js/helper.py
   pypy/dist/pypy/translator/js/jsbuiltin.py
   pypy/dist/pypy/translator/js/modules/dom.py
   pypy/dist/pypy/translator/js/modules/test/test_dom.py
   pypy/dist/pypy/translator/js/test/test_basicexternal.py
   pypy/dist/pypy/translator/js/test/test_bltn.py
   pypy/dist/pypy/translator/js/test/test_main.py
   pypy/dist/pypy/translator/js/tutorial/step3.py
Log:
Factored out use of (deprecated) get_document() and get_window(), one might use document and window instead. This needed implementation of prebuilt BasicExternal rendering. Killed some dead code in between.


Modified: pypy/dist/pypy/doc/js/webapps_with_pypy.txt
==============================================================================
--- pypy/dist/pypy/doc/js/webapps_with_pypy.txt	(original)
+++ pypy/dist/pypy/doc/js/webapps_with_pypy.txt	Tue Jan  2 16:18:14 2007
@@ -89,4 +89,4 @@
 
 XXX hands-on guide to writing guestbook or something
 
-.. _`RPython`: ../coding-guide.html#restricted-python
\ No newline at end of file
+.. _`RPython`: ../coding-guide.html#restricted-python

Modified: pypy/dist/pypy/translator/js/asmgen.py
==============================================================================
--- pypy/dist/pypy/translator/js/asmgen.py	(original)
+++ pypy/dist/pypy/translator/js/asmgen.py	Tue Jan  2 16:18:14 2007
@@ -226,7 +226,8 @@
         if len(self.right_hand) == 0:
             return
         v = self.right_hand.pop()
-        if v is not None:
+        # if v is not calling anything, drop it
+        if v is not None and v.find('('):
             self.codegenerator.writeline(v+";")
         #self.right_hand.pop()
     

Modified: pypy/dist/pypy/translator/js/database.py
==============================================================================
--- pypy/dist/pypy/translator/js/database.py	(original)
+++ pypy/dist/pypy/translator/js/database.py	Tue Jan  2 16:18:14 2007
@@ -42,18 +42,8 @@
         self.name_manager = JavascriptNameManager(self)
         self.pending_consts = []
         self.cts = self.genoo.TypeSystem(self)
-        self.prepare_builtins()
         self.proxies = []
     
-    def prepare_builtins(self):
-        # Document Object Model elements
-        #for module in [dom]:
-        #    for i in dir(module):
-        #        if not i.startswith('__'):
-        #            # FIXME: shit, strange way of doing it
-        #            self.consts[BuiltinConst(module[i])] = i
-        return
-
     def is_primitive(self, type_):
         if type_ in [Void, Bool, Float, Signed, Unsigned, SignedLongLong, UnsignedLongLong, Char, UniChar, ootype.StringBuilder] or \
             isinstance(type_,ootype.StaticMethod):
@@ -491,4 +481,7 @@
             ilasm.new(self.get_name())
         else:
             # Otherwise they just exist, or it's not implemented
-            ilasm.load_str("undefined")
+            if not hasattr(self.const.value, '_render_name'):
+                raise ValueError("Prebuilt constant %s has no attribute _render_name,"
+                                  "don't know how to render" % self.const.value)
+            ilasm.load_str(self.const.value._render_name)

Modified: pypy/dist/pypy/translator/js/demo/jsdemo/consserv.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/consserv.py	(original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/consserv.py	Tue Jan  2 16:18:14 2007
@@ -13,7 +13,7 @@
 from pypy.translator.js.test.runtest import compile_function
 
 
-from pypy.translator.js.modules.dom import Node, get_document, setTimeout,\
+from pypy.translator.js.modules.dom import Node, setTimeout,\
                                            alert
 #from pypy.translator.js.modules.xmlhttp import XMLHttpRequest
 from pypy.translator.js.modules.mochikit import logDebug, createLoggingPane, log

Modified: pypy/dist/pypy/translator/js/demo/jsdemo/controllers.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/controllers.py	(original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/controllers.py	Tue Jan  2 16:18:14 2007
@@ -6,6 +6,7 @@
 
 from pypy.translator.js.test.runtest import compile_function
 from pypy.translator.js.modules import dom,xmlhttp
+from pypy.translator.js.modules.dom import document
 
 import thread
 import os
@@ -14,7 +15,6 @@
     pass
 
 def js_fun():
-    document = dom.get_document()
     obj = document.createElement('img')
     obj.id = 'gfx'
     obj.setAttribute('style', 'position:absolute; top:0; left:0;')

Modified: pypy/dist/pypy/translator/js/demo/jsdemo/djangoping/client.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/djangoping/client.py	(original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/djangoping/client.py	Tue Jan  2 16:18:14 2007
@@ -22,7 +22,7 @@
 
 def callback(data):
     mochikit.logDebug("Got response: " + data["response"])
-    log = dom.get_document().getElementById("log")
+    log = dom.document.getElementById("log")
     mochikit.logDebug("got log element")
     try:
         s = "<p>" + data["response"] + "</p>"
@@ -39,7 +39,7 @@
 
 def ping_init():
     mochikit.createLoggingPane(True)
-    button = dom.get_document().getElementById("doping")
+    button = dom.document.getElementById("doping")
     button.onclick = doping_onclick
     mochikit.logDebug("Ping button setup")
 

Modified: pypy/dist/pypy/translator/js/demo/jsdemo/example.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/example.py	(original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/example.py	Tue Jan  2 16:18:14 2007
@@ -6,7 +6,7 @@
 
 from pypy.translator.js.demo.jsdemo import support
 
-from pypy.translator.js.modules.dom import setTimeout, get_document
+from pypy.translator.js.modules.dom import setTimeout, document
 from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal
 from pypy.translator.js import commproxy
 
@@ -31,7 +31,7 @@
 httpd = None
 
 def callback(data):
-    get_document().getElementById("counter").innerHTML = data['counter']
+    document.getElementById("counter").innerHTML = data['counter']
     runjs()
 
 def runjs():

Modified: pypy/dist/pypy/translator/js/demo/jsdemo/pythonconsole.py
==============================================================================
--- pypy/dist/pypy/translator/js/demo/jsdemo/pythonconsole.py	(original)
+++ pypy/dist/pypy/translator/js/demo/jsdemo/pythonconsole.py	Tue Jan  2 16:18:14 2007
@@ -12,7 +12,7 @@
 
 import sys, os, cStringIO
 from cgi import parse_qs
-from pypy.translator.js.modules.dom import setTimeout, get_document
+from pypy.translator.js.modules.dom import setTimeout, document
 from pypy.rpython.ootypesystem.bltregistry import MethodDesc, BasicExternal
 from pypy.translator.js import commproxy
 from pypy.translator.js.modules.mochikit import escapeHTML
@@ -46,14 +46,14 @@
 httpd = None
 
 def callback(data):
-    inp_elem = get_document().getElementById("inp")
+    inp_elem = document.getElementById("inp")
     inp_elem.disabled = False
     answer = data.get('answer', '')
     add_text(answer)
     inp_elem.focus()
 
 def add_text(text):
-    data_elem = get_document().getElementById("data")
+    data_elem = document.getElementById("data")
     data_elem.innerHTML += escapeHTML(text)
 
 class Storage(object):
@@ -66,7 +66,7 @@
 def keypressed(key):
     kc = key.keyCode
     if kc == ord("\r"):
-        inp_elem = get_document().getElementById("inp")
+        inp_elem = document.getElementById("inp")
         cmd = inp_elem.value
         if storage.level == 0:
             add_text(">>> %s\n" % (cmd,))
@@ -85,8 +85,8 @@
                 storage.level = 0
 
 def setup_page():
-    get_document().onkeypress = keypressed
-    get_document().getElementById("inp").focus()
+    document.onkeypress = keypressed
+    document.getElementById("inp").focus()
 
 class Server(HTTPServer, BasicExternal):
     # Methods and signatures how they are rendered for JS

Modified: pypy/dist/pypy/translator/js/examples/console.py
==============================================================================
--- pypy/dist/pypy/translator/js/examples/console.py	(original)
+++ pypy/dist/pypy/translator/js/examples/console.py	Tue Jan  2 16:18:14 2007
@@ -12,7 +12,7 @@
 conftest.option.browser = "default"
 
 from pypy.translator.js.test.runtest import compile_function
-from pypy.translator.js.modules.dom import Node, get_document, setTimeout, \
+from pypy.translator.js.modules.dom import Node, document, setTimeout, \
                                            alert
 #from pypy.translator.js.modules.xmlhttp import XMLHttpRequest
 from pypy.translator.js.modules.mochikit import logDebug, createLoggingPane, log
@@ -27,7 +27,7 @@
         self.indent_level = 0
     
     def initialise(self):
-        self.elem = get_document().getElementById("data")
+        self.elem = document.getElementById("data")
     
     def add_data(self, data):
         if self.indent_level == 0 and data == "":
@@ -51,18 +51,17 @@
 def onchange(key):
     kc = key.keyCode
     if kc == ord("\r"):
-        inp_elem = get_document().getElementById("inp")
+        inp_elem = document.getElementById("inp")
         inp_elem.value = console.add_data(inp_elem.value)
 
 def test_run_console():
     def some_fun():
-        #cons = get_document().getElementById("data")
         #write_start(cons)
         createLoggingPane(True)
         console.initialise()
         #data_field = get_document().getElementById("data")
         #console.onload(data_field)
-        get_document().onkeypress = onchange
+        document.onkeypress = onchange
         #get_document().onkeyup = onchangedown
 
     print "It's not working"

Modified: pypy/dist/pypy/translator/js/examples/start_bnb.py
==============================================================================
--- pypy/dist/pypy/translator/js/examples/start_bnb.py	(original)
+++ pypy/dist/pypy/translator/js/examples/start_bnb.py	Tue Jan  2 16:18:14 2007
@@ -12,7 +12,7 @@
 conftest.option.browser = "default"
 
 from pypy.translator.js.test.runtest import compile_function
-from pypy.translator.js.modules.dom import get_document
+from pypy.translator.js.modules.dom import document
 from pypy.translator.js.modules.xmlhttp import XMLHttpRequest
 from pypy.translator.js.modules.mochikit import log, logWarning, createLoggingPane, logDebug
 from pypy.translator.js.modules.bltns import date
@@ -74,10 +74,10 @@
         #    img = self.sprite_queues[icon_code].pop()
         #except IndexError:
         stats.n_sprites += 1
-        img = get_document().createElement("img")
+        img = document.createElement("img")
         img.setAttribute("src", self.filenames[icon_code])
         img.setAttribute("style", 'position:absolute; left:'+x+'px; top:'+y+'px; visibility:visible')
-        get_document().getElementById("playfield").appendChild(img)
+        document.getElementById("playfield").appendChild(img)
         try:
             self.sprites[s].style.visibility = "hidden"
             # FIXME: We should delete it
@@ -144,23 +144,23 @@
 
 def appendPlayfield(msg):
     bgcolor = '#000000'
-    get_document().body.setAttribute('bgcolor', bgcolor)
-    div = get_document().createElement("div")
+    document.body.setAttribute('bgcolor', bgcolor)
+    div = document.createElement("div")
     div.setAttribute("id", "playfield")
     div.setAttribute('width', msg['width'])
     div.setAttribute('height', msg['height'])
     div.setAttribute('style', 'position:absolute; top:0px; left:0px')
-    get_document().body.appendChild(div)
+    document.body.appendChild(div)
 
 def appendPlayfieldXXX():
     bgcolor = '#000000'
-    get_document().body.setAttribute('bgcolor', bgcolor)
-    div = get_document().createElement("div")
+    document.body.setAttribute('bgcolor', bgcolor)
+    div = document.createElement("div")
     div.setAttribute("id", "playfield")
     div.setAttribute('width', 500)
     div.setAttribute('height', 250)
     div.setAttribute('style', 'position:absolute; top:0px; left:0px')
-    get_document().body.appendChild(div)
+    document.body.appendChild(div)
 
 def process_message(msg):
     if msg['type'] == 'def_playfield':
@@ -247,8 +247,8 @@
     #    stats.__init__()
     #    sm.__init__()
     #    sm.begin_clean_sprites()
-    #    playfield = get_document().getElementById("playfield")
-    #    get_document().body.removeChild(playfield)
+    #    playfield = document.getElementById("playfield")
+    #    document.body.removeChild(playfield)
     #    appendPlayfieldXXX()
 
 ##    count = int(msgs['add_data'][0]['n'])
@@ -266,20 +266,20 @@
     for msg in msgs['messages']:
         process_message(msg)
     stats.register_frame()
-    get_document().title = str(stats.n_sprites) + " sprites " + str(stats.fps)
+    document.title = str(stats.n_sprites) + " sprites " + str(stats.fps)
 
 def session_dispatcher(msgs):
     BnbRootInstance.get_message(player.id, "", bnb_dispatcher)
 
 def run_bnb():
     def bnb():
-        genjsinfo = get_document().getElementById("genjsinfo")
-        get_document().body.removeChild(genjsinfo)
+        genjsinfo = document.getElementById("genjsinfo")
+        document.body.removeChild(genjsinfo)
         createLoggingPane(True)
         log("keys: [0-9] to select player, [wsad] to walk around")
         BnbRootInstance.initialize_session(session_dispatcher)
-        get_document().onkeydown = keydown
-        get_document().onkeyup   = keyup
+        document.onkeydown = keydown
+        document.onkeyup   = keyup
     
     from pypy.translator.js.demo.jsdemo.bnb import BnbRoot
     fn = compile_function(bnb, [], root = BnbRoot, run_browser = False)

Modified: pypy/dist/pypy/translator/js/helper.py
==============================================================================
--- pypy/dist/pypy/translator/js/helper.py	(original)
+++ pypy/dist/pypy/translator/js/helper.py	Tue Jan  2 16:18:14 2007
@@ -2,7 +2,7 @@
 """ Some helpers
 """
 
-from pypy.translator.js.modules.dom import get_document
+from pypy.translator.js.modules.dom import document
 
 def escape(s):
     #return s.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;"). \
@@ -10,23 +10,23 @@
     return s
 
 def create_debug_div():
-    debug_div = get_document().createElement("div")
+    debug_div = document.createElement("div")
     debug_div.setAttribute("id", "debug_div")
     # XXX attach it somewhere...
-    #body = get_document().getElementsByTagName('body')[0]
-    get_document().childNodes[0].childNodes[1].appendChild(debug_div)
+    #body = document.getElementsByTagName('body')[0]
+    document.childNodes[0].childNodes[1].appendChild(debug_div)
     return debug_div
 
 def __show_traceback(tb, exc):
-    debug_div = get_document().getElementById("debug_div")
+    debug_div = document.getElementById("debug_div")
     if not debug_div:
         # create div here
         debug_div = create_debug_div()
 
-    pre_div = get_document().createElement("pre")
+    pre_div = document.createElement("pre")
     pre_div.style.color = "#FF0000"
     debug_div.appendChild(pre_div)
-    txt = get_document().createTextNode("")
+    txt = document.createTextNode("")
     pre_div.appendChild(txt)
     for tb_entry in tb[1:]:
         # list of tuples...

Modified: pypy/dist/pypy/translator/js/jsbuiltin.py
==============================================================================
--- pypy/dist/pypy/translator/js/jsbuiltin.py	(original)
+++ pypy/dist/pypy/translator/js/jsbuiltin.py	Tue Jan  2 16:18:14 2007
@@ -14,17 +14,12 @@
         
         self.builtin_map = {
             'll_js_jseval' : CallBuiltin('eval'),
-            #'ll_newlist' : CallBuiltin('newlist'),
-            #'ll_alloc_and_set' : CallBuiltin('alloc_and_set'),
-            'get_document' : lambda g,op: g.ilasm.load_const('document'),
             'set_on_keydown' : SetOnEvent('onkeydown'),
             'set_on_keyup' : SetOnEvent('onkeyup'),
             'setTimeout' : SetTimeout,
-            #'xmlSetCallback' : XmlSetCallback,
             'll_int_str' : lambda g,op: Call._render_builtin_method(g, 'toString' , [op.args[2]]),
             'll_strconcat' : InstructionList([PushAllArgs, '+']),
             'll_int' : CallBuiltin('parseInt'),
-            #'ll_int' : lambda g,op: Call._render_builtin(g, 'parseInt', [op.args[0], op.args[0]]),
             'alert' : CallBuiltin('alert'),
             'seval' : CallBuiltin('seval'),
             'date': NewBuiltin('Date'),

Modified: pypy/dist/pypy/translator/js/modules/dom.py
==============================================================================
--- pypy/dist/pypy/translator/js/modules/dom.py	(original)
+++ pypy/dist/pypy/translator/js/modules/dom.py	Tue Jan  2 16:18:14 2007
@@ -87,7 +87,7 @@
 
     def __setattr__(self, name, value):
         """set an attribute on the wrapped node"""
-        if name in dir(self):
+        if name in dir(self) or name.startswith('_'):
             return super(Node, self).__setattr__(name, value)
         if name not in self._fields:
             raise NameError, name
@@ -303,18 +303,10 @@
         func()
     #pass
 
-# some helper functions (XXX imo these can go, but the code seems to use them
-# a lot... isn't it possible to just use dom.window and dom.document instead?)
-
 window = Window()
-
-def get_document():
-    return window.document
-get_document.suggested_primitive = True
-
-def get_window():
-    return window
-get_window.suggested_primitive = True
+document = window.document
+window._render_name = 'window'
+document._render_name = 'document'
 
 # rtyper stuff
 
@@ -691,8 +683,6 @@
     'charCode' : 12,
 })
 
-get_window.suggested_primitive = True
-get_document.suggested_primitive = True
 setTimeout.suggested_primitive = True
 
 # the following code wraps minidom nodes with Node classes, and makes

Modified: pypy/dist/pypy/translator/js/modules/test/test_dom.py
==============================================================================
--- pypy/dist/pypy/translator/js/modules/test/test_dom.py	(original)
+++ pypy/dist/pypy/translator/js/modules/test/test_dom.py	Tue Jan  2 16:18:14 2007
@@ -19,7 +19,7 @@
 
 def get_window():
     if TRANSLATING:
-        return dom.get_window()
+        return dom.window
     else:
         return dom.Window()
 

Modified: pypy/dist/pypy/translator/js/test/test_basicexternal.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/test_basicexternal.py	(original)
+++ pypy/dist/pypy/translator/js/test/test_basicexternal.py	Tue Jan  2 16:18:14 2007
@@ -14,6 +14,7 @@
         pass
 
 a = A()
+a._render_name = 'a'
 
 class B(object):
     pass
@@ -23,7 +24,7 @@
         a.some_code("aa")
     
     fun = compile_function(dec_fun, [])
-    check_source_contains(fun, "\.some_code")
+    assert check_source_contains(fun, "\.some_code")
 
 def test_basicexternal_element():
     def be_fun():
@@ -32,7 +33,7 @@
         b.a.some_code("aa")
     
     fun = compile_function(be_fun, [])
-    check_source_contains(fun, "\.some_code")
+    assert check_source_contains(fun, "\.some_code")
 
 ##def test_basicexternal_raise():
 ##    #py.test.skip("Constant BasicExternals not implemented")
@@ -53,13 +54,14 @@
         pass
 
 ee = EE()
+ee._render_name = 'ee'
 
 def test_prebuild_basicexternal():
     def tt_fun():
         ee.bb()
     
     fun = compile_function(tt_fun, [])
-    check_source_contains(fun, "ee.bb\(")
+    assert check_source_contains(fun, "EE = ee")
 
 class C(BasicExternal):
     @described(retval=3)
@@ -67,6 +69,7 @@
         pass
 
 c = C()
+c._render_name = 'c'
 
 def test_basicexternal_raise_method_call():
     def raising_method_call():
@@ -88,6 +91,7 @@
 D._fields['c'] = [D(),D()]
 
 d = D()
+d._render_name = 'd'
 
 def test_basicexternal_list():
     def getaa(item):

Modified: pypy/dist/pypy/translator/js/test/test_bltn.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/test_bltn.py	(original)
+++ pypy/dist/pypy/translator/js/test/test_bltn.py	Tue Jan  2 16:18:14 2007
@@ -6,14 +6,11 @@
 from pypy.rpython.ootypesystem.bltregistry import BasicExternal, MethodDesc
 from pypy.translator.js.test.runtest import compile_function, check_source_contains
 
-#def setup_function(fun):
-#    rebuild_basic_external()
-
-# check rendering dom.get_document()
+# check rendering dom.document
 def test_simple_builtin():
-    from pypy.translator.js.modules.dom import get_document
+    from pypy.translator.js.modules.dom import document
     def test_document_call():
-        return get_document().getElementById("some_id")
+        return document.getElementById("some_id")
     
     fn = compile_function(test_document_call, [])
     assert check_source_contains(fn, "= document")
@@ -42,6 +39,7 @@
     assert check_source_contains(fn, "loadJSONDoc\('some_method'")
 
 SomeNodeInstance = SomeNode()
+SomeNodeInstance._render_name = 's'
 
 # next will try out the callback
 def test_callback():
@@ -58,7 +56,7 @@
     from pypy.translator.js.modules import dom
     
     def getaa(tname):
-        return dom.get_document().getElementsByTagName(tname)[0].nodeValue
+        return dom.document.getElementsByTagName(tname)[0].nodeValue
     
     def some_stuff():
         one = getaa("some")

Modified: pypy/dist/pypy/translator/js/test/test_main.py
==============================================================================
--- pypy/dist/pypy/translator/js/test/test_main.py	(original)
+++ pypy/dist/pypy/translator/js/test/test_main.py	Tue Jan  2 16:18:14 2007
@@ -17,6 +17,7 @@
     method = described(retval={'a':'a'})(method)
 
 a = A()
+a._render_name = 'a'
 
 def fun(x='3'):
     return a.method({'a':x})['a']

Modified: pypy/dist/pypy/translator/js/tutorial/step3.py
==============================================================================
--- pypy/dist/pypy/translator/js/tutorial/step3.py	(original)
+++ pypy/dist/pypy/translator/js/tutorial/step3.py	Tue Jan  2 16:18:14 2007
@@ -12,7 +12,7 @@
 
 from pypy.translator.js.examples import server
 from pypy.translator.js.main import rpython2javascript
-from pypy.translator.js.modules import dom
+from pypy.translator.js.modules.dom import document
 # dom manipulating module
 
 HTML = """
@@ -33,17 +33,15 @@
 
 # these are exposed functions
 def addrow():
-    doc = dom.get_document()
-    
     # we need to call a helper, similiar to document in JS
-    tr = doc.createElement("tr")
-    td = doc.createElement("td")
-    td.appendChild(doc.createTextNode("A row"))
+    tr = document.createElement("tr")
+    td = document.createElement("td")
+    td.appendChild(document.createTextNode("A row"))
     tr.appendChild(td)
-    dom.get_document().getElementById("atable").appendChild(tr)
+    document.getElementById("atable").appendChild(tr)
 
 def delrow():
-    table = dom.get_document().getElementById("atable")
+    table = document.getElementById("atable")
     # note -1 working here like in python, this is last element in list
     table.removeChild(table.childNodes[-1])
 



More information about the Pypy-commit mailing list