[Twisted-Python] Uninteruptable infinite loop: Woven rendering

Mary mary-twisted at puzzling.org
Sun Aug 10 03:04:52 MDT 2003


The problem I'm describing is best illustrated by the two examples
attached.

safe.py renders the following HTML for the / URL (Twisted 1.0.7alpha4):

<?xml version="1.0"?>

<html>
 <body>
  <h1>My name
  </h1>
 </body>
</html>

If I start bad.py like this: "twistd -n -y bad.py" and request the /
URL, it infinitely loops (judging from the output of --spew), and
further, renders twistd uninteruptable via either Ctrl-C or SIGTERM.

In this particular case I'm open to suggestions of "well, don't do that
then" -- the reason, incidently, that I'm trying to use another TestPage
as a submodel is in order to generate previous and next links between
certain pages.

-Mary
-------------- next part --------------
from twisted.web import server
from twisted.internet import app
from twisted.web.woven import page

class TestPage(page.Page):

    template = '''
    <html>
    <body>
    <h1 model="prev/name"/>
    </body>
    </html>
    '''

    def wmfactory_name(self, request):
        return "My name"

    def wmfactory_prev(self, request):
        return TestPage()

s = TestPage()
site = server.Site(s)
application = app.Application("Eyes")
application.listenTCP(8088, site)

-------------- next part --------------
from twisted.web import server
from twisted.internet import app
from twisted.web.woven import page

class TestPage(page.Page):

    template = '''
    <html>
    <body>
    <h1 model="name"/>
    <div model="prev">
    <h1 model="name"/>
    </div>
    </body>
    </html>
    '''

    def wmfactory_name(self, request):
        return "My name"

    def wmfactory_prev(self, request):
        return TestPage()

s = TestPage()
site = server.Site(s)
application = app.Application("Eyes")
application.listenTCP(8088, site)



More information about the Twisted-Python mailing list