[Twisted-web] Subclassing a subclass of rend.Page
Patrick B. Day
uf069 at victoria.tc.ca
Wed Sep 1 12:51:00 MDT 2004
Arg! Sorry! It was actually a weird indenting thing where there wasn't an
error but my program behavior changed in a way I've never come across
before. (I'm working from userdb.py as my basis but I use tabs instead of
BTW I was coding my own web app stuff until I found Nevow. I'm impressed -
finally someone realizes that sticking code in html documents is a not the
greatest approach for web "applications". Thanks for your efforts and
getting back to me so quickly.
On Wed, 1 Sep 2004, Donovan Preston wrote:
> On Sep 1, 2004, at 1:50 PM, Patrick B. Day wrote:
> > A quick question. I have a situation where I'm starting from a base
> > html
> > template, say 'template.html', which has some global elements which
> > need
> > rendering. So I do something like this:
> > class Template (rend.Page):
> > docFactory = rend.htmlfile('template.html')
> > def render_global (self, context, data):
> > """Fill in elements common to all pages."""
> > class GreetingsPage (Template):
> > def render_contents (self, context, data):
> > """Render contents area of page with greetings information."""
> > def render_sidebar (self, context, data):
> > """Render sidebar area of page specific to greetings."""
> > When I try this approach though, nevow seems to make all it's rendering
> > calls to Template and not GreetingsPage. What is the proper approach to
> > doing what I'm trying to do?
> This should work properly, as you expect it to. Are you sure the page
> you are rendering is actually an instance of GreetingsPage and not
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
More information about the Twisted-web