[Twisted-Python] bug and patch: embedded LivePages

Mario Ruggier mario at ruggier.org
Tue May 27 03:32:31 MDT 2003


Hi,

in the case when a LivePage happens to be itself the contents of
an iframe, the input web conduit does not work as it attempts to
execute js from "top". It should be "parent".

To test, place the following script next to any LivePage example
(such as the dhtmlLivePage.rpy posted some days ago by
Donovan Preston):

iframed_dhtmlLivePage.rpy:
================================
from twisted.web.woven import page
resource = page.Page()
resource.template = '''<html>
     <body style="margin:1em; background-color: gray;">
         <iframe style="width: 80%; padding: 1em;" 
src="../dhtmlLivePage">
             iframe contents
         </iframe>
     </body>
</html>
'''
================================


The diff w.r.t. cvs version of twisted/web/woven/controller.py:
================================
--- twisted/web/woven/controller.py       Tue May 27 10:58:55 2003
+++ twisted/web/woven/controller.py   Sat May 24 12:26:22 2003
@@ -333,7 +333,7 @@
          target.onEvent(request, eventName, *eventArgs)
          sess.sendScript = orig

-        
scriptOutput.append('parent.woven_clientToServerEventComplete()')
+        scriptOutput.append('top.woven_clientToServerEventComplete()')

          #print "GATHERED JS", scriptOutput

@@ -369,7 +369,7 @@
              nodeXML = nodeXML.replace('\r', '')
              nodeXML = nodeXML.replace("\\", "\\\\")
              nodeXML = nodeXML.replace("'", "\\'")
-            js = "parent.woven_replaceElement('%s', '%s')" % (nodeId, 
nodeXML)
+            js = "top.woven_replaceElement('%s', '%s')" % (nodeId, 
nodeXML)
              #for key in widget.subviews.keys():
              #    view.subviews[key].unlinkViews()
              oldNode = page.view.subviews[nodeId]
================================

cheers, mario





More information about the Twisted-Python mailing list